Skip to content

Commit 6367a1b

Browse files
committed
#270 fix playwright esm
1 parent 2d15749 commit 6367a1b

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

data-browser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"predeploy": "build && touch build/.nojekyll",
6767
"preview": "vite preview",
6868
"start": "vite",
69-
"test": "playwright test",
69+
"test": "playwright test --config=./tests/playwright.config.ts",
7070
"test-debug": "PWDEBUG=1 playwright test",
7171
"test-new": "playwright codegen http://localhost:5173",
7272
"test-query": "PWDEBUG=1 npx playwright test \"e2e.spec.ts\" -g",

data-browser/tests/e2e.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// This file is copied from `atomic-data-browser` to `atomic-data-server` when `pnpm build-server` is run.
22
// This is why the `testConfig` is imported.
33

4-
import { test, expect, Page, Browser } from '@playwright/test';
5-
import { testConfig } from './test-config';
4+
import { test, expect } from '@playwright/test';
5+
import type { Browser, Page } from '@playwright/test';
6+
import { testConfig } from './test-config.js';
67

78
export interface TestConfig {
89
demoFileName: string;
@@ -42,13 +43,16 @@ test.describe('data-browser', async () => {
4243
if (!serverUrl) {
4344
throw new Error('serverUrl is not set');
4445
}
46+
4547
// Open the server
4648
await page.goto(frontEndUrl);
49+
4750
// Sometimes we run the test server on a different port, but we should
4851
// only change the drive if it is non-default.
4952
if (serverUrl !== 'http://localhost:9883') {
5053
await changeDrive(serverUrl, page);
5154
}
55+
5256
await expect(page.locator(currentDriveTitle)).toBeVisible();
5357
});
5458

@@ -659,10 +663,12 @@ async function openNewSubjectWindow(browser: Browser, url: string) {
659663
const context2 = await browser.newContext();
660664
const page = await context2.newPage();
661665
await page.goto(frontEndUrl);
666+
662667
// Only when we run on `localhost` we don't need to change drive during tests
663668
if (serverUrl !== defaultDevServer) {
664669
await changeDrive(serverUrl, page);
665670
}
671+
666672
await openSubject(page, url);
667673
await page.setViewportSize({ width: 1000, height: 400 });
668674

data-browser/playwright.config.ts renamed to data-browser/tests/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PlaywrightTestConfig } from '@playwright/test';
1+
import type { PlaywrightTestConfig } from '@playwright/test';
22

33
const config: PlaywrightTestConfig = {
44
use: {

data-browser/tests/test-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TestConfig } from './e2e.spec';
1+
import type { TestConfig } from './e2e.spec.js';
22
const demoFileName = 'testimage.svg';
33

44
export const testConfig: TestConfig = {

data-browser/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
},
1616
"include": [
1717
"./src",
18+
"./tests"
1819
],
1920
"references": [
2021
{

0 commit comments

Comments
 (0)