From 999a3a4c3011bbbcc66b37926c31655adef6f775 Mon Sep 17 00:00:00 2001 From: Thomas Scholtes Date: Tue, 13 Jun 2023 18:02:39 +0200 Subject: [PATCH] Use non-dev port for webserver during end-to-end tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The end-to-end tests no run against the app served on port 3001 so that we don’t need to shut down the development server. Signed-off-by: Thomas Scholtes --- playwright.config.ts | 7 +++---- playwright.ipfs.config.ts | 4 ++-- tests/support/fixtures.ts | 6 ++---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/playwright.config.ts b/playwright.config.ts index dc918d6ea..7dfcef835 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -17,7 +17,7 @@ const config: PlaywrightTestConfig = { globalSetup: "./tests/support/globalSetup", use: { actionTimeout: 0, - baseURL: "http://localhost:3000", + baseURL: "http://localhost:3001", trace: "retain-on-failure", }, @@ -58,15 +58,14 @@ const config: PlaywrightTestConfig = { ...devices["Desktop Chrome"], actionTimeout: 0, deviceScaleFactor: 2, - baseURL: "http://localhost:3000", trace: "off", }, }, ], webServer: { - command: "npm run start", - port: 3000, + command: "npm run start -- --strictPort --port 3001", + port: 3001, }, }; diff --git a/playwright.ipfs.config.ts b/playwright.ipfs.config.ts index 6bb6c6f94..79a259c20 100644 --- a/playwright.ipfs.config.ts +++ b/playwright.ipfs.config.ts @@ -6,8 +6,8 @@ const config: PlaywrightTestConfig = { ...base, testIgnore: undefined, webServer: { - command: "npm run start:ipfs", - port: 3000, + command: "npm run start:ipfs -- --strictPort --port 3001", + port: 3001, }, }; diff --git a/tests/support/fixtures.ts b/tests/support/fixtures.ts index 357500769..0b6a6b001 100644 --- a/tests/support/fixtures.ts +++ b/tests/support/fixtures.ts @@ -174,7 +174,7 @@ export const test = base.extend<{ const { stdout } = await peer.rad([ "web", "--frontend", - "http://localhost:3000", + "http://localhost:3001", "--backend", "http://127.0.0.1:8070", "--json", @@ -182,9 +182,7 @@ export const test = base.extend<{ const result = authSchema.safeParse(JSON.parse(stdout)); if (result.success) { const { sessionId, publicKey, signature } = result.data; - await page.goto( - `http://localhost:3000/session/${sessionId}?pk=${publicKey}&sig=${signature}`, - ); + await page.goto(`/session/${sessionId}?pk=${publicKey}&sig=${signature}`); await expect(page.getByText("Authenticated")).toBeVisible(); await page.getByRole("button", { name: "Close" }).click(); } else {