fix: resolve workspace integration blockers (#5)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import path from 'node:path';
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test('viewer2d loads DWG, DXF, and an uploaded file', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
await page.getByRole('button', { name: 'Sample DWG' }).click();
|
||||
await expect(page.locator('#status')).toContainText('✓ BasicSample.dwg · 7309 entities');
|
||||
|
||||
await page.getByRole('button', { name: 'Layers' }).click();
|
||||
await expect(page.locator('#layerList label').first()).toBeVisible();
|
||||
|
||||
await page.getByRole('button', { name: 'Sample DXF' }).click();
|
||||
await expect(page.locator('#status')).toContainText('✓ simple.dxf · 6 entities');
|
||||
|
||||
await page.locator('#file').setInputFiles(
|
||||
path.resolve('apps/viewer-2d-sample/public/samples/simple.dxf'),
|
||||
);
|
||||
await expect(page.locator('#status')).toContainText('✓ simple.dxf · 6 entities');
|
||||
});
|
||||
|
||||
test('viewer2d rejects cross-origin and oversized CAD input', async ({ page }) => {
|
||||
await page.goto('/?model=https://attacker.example/oversized.dxf');
|
||||
await expect(page.locator('#status')).toContainText('같은 origin');
|
||||
|
||||
await page.goto('/');
|
||||
await page.evaluate(() => {
|
||||
const file = new File([new Uint8Array(50 * 1024 * 1024 + 1)], 'oversized.dxf');
|
||||
const transfer = new DataTransfer();
|
||||
transfer.items.add(file);
|
||||
window.dispatchEvent(new DragEvent('drop', { dataTransfer: transfer }));
|
||||
});
|
||||
await expect(page.locator('#status')).toContainText('50 MiB');
|
||||
});
|
||||
Reference in New Issue
Block a user