run the tests on a different port (so there's no conflict when running the development server)

This commit is contained in:
2025-01-09 08:51:09 -07:00
parent 27622ad9e5
commit 00fc80036a
2 changed files with 10 additions and 5 deletions

View File

@@ -25,7 +25,7 @@ export default defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: { use: {
/* Base URL to use in actions like `await page.goto('/')`. */ /* Base URL to use in actions like `await page.goto('/')`. */
baseURL: "http://localhost:8080", baseURL: "http://localhost:8081",
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry", trace: "on-first-retry",
@@ -91,8 +91,8 @@ export default defineConfig({
*/ */
webServer: { webServer: {
command: command:
"VITE_APP_SERVER=http://localhost:8080 VITE_DEFAULT_ENDORSER_API_SERVER=http://localhost:3000 VITE_PASSKEYS_ENABLED=true npm run dev", "VITE_APP_SERVER=http://localhost:8081 VITE_DEFAULT_ENDORSER_API_SERVER=http://localhost:3000 VITE_PASSKEYS_ENABLED=true npm run dev -- --port=8081",
url: "http://localhost:8080", url: "http://localhost:8081",
reuseExistingServer: !process.env.CI, reuseExistingServer: !process.env.CI,
}, },
}); });

View File

@@ -200,7 +200,7 @@ test('Add contact, copy details, delete, and import from paste & from file', asy
}); });
test('Copy contact to clipboard, then import ', async ({ page, context }) => { test('Copy contact to clipboard, then import ', async ({ page, context }, testInfo) => {
await importUser(page, '00'); await importUser(page, '00');
await page.goto('./account'); await page.goto('./account');
@@ -244,7 +244,12 @@ test('Copy contact to clipboard, then import ', async ({ page, context }) => {
const clipboardText = await page.evaluate(async () => { const clipboardText = await page.evaluate(async () => {
return navigator.clipboard.readText(); return navigator.clipboard.readText();
}); });
const PATH_PART = "http://localhost:8080/contact-import/";
// look into the playwright.config file for the server URL
const webServer = testInfo.config.webServer;
const clientServerUrl = webServer?.url;
const PATH_PART = clientServerUrl + "/contact-import/";
expect(clipboardText).toContain(PATH_PART); expect(clipboardText).toContain(PATH_PART);
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss alert await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss alert