Skip to content

Update tests to not use a hard coded localhost:3000#1949

Open
jeesunikim wants to merge 1 commit intomainfrom
update-tests
Open

Update tests to not use a hard coded localhost:3000#1949
jeesunikim wants to merge 1 commit intomainfrom
update-tests

Conversation

@jeesunikim
Copy link
Contributor

  • removing localhost:3000 so that I can run multiple repos in parallel, make updates, and able to pass tests.

Copilot AI review requested due to automatic review settings March 11, 2026 02:31
@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Mar 11, 2026
@jeesunikim jeesunikim mentioned this pull request Mar 11, 2026
@jeesunikim jeesunikim requested a review from quietbits March 11, 2026 02:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Playwright E2E tests to avoid hard-coded http://localhost:3000 URLs so tests can run against a configurable port (and leverage Playwright’s baseURL support).

Changes:

  • Replaced many page.goto("http://localhost:3000/...") calls with relative navigations like page.goto("/...").
  • Introduced BASE_URL (derived from process.env.PORT) in a few tests/mocks that still construct absolute URLs.
  • Updated mocked storage state origin/shareable URLs to use the configurable base URL.

Reviewed changes

Copilot reviewed 35 out of 35 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/e2e/viewXdrToJsonPage.test.ts Switches navigation to relative URL.
tests/e2e/viewJsonToXdrPage.test.ts Switches navigation to relative URL.
tests/e2e/urlParams.test.ts Uses BASE_URL for deep-link navigations with query params.
tests/e2e/txDashTokenSummary.test.ts Switches navigation to relative URL.
tests/e2e/txDashStateChange.test.ts Switches navigation to relative URL.
tests/e2e/txDashSignatures.test.ts Switches navigation to relative URL.
tests/e2e/txDashResourceProfiler.test.ts Switches navigation to relative URL.
tests/e2e/txDashInfo.test.ts Switches navigation to relative URL.
tests/e2e/txDashFeeBreakdown.test.ts Switches navigation to relative URL.
tests/e2e/txDashEvents.test.ts Switches navigation to relative URL.
tests/e2e/txDashContracts.test.ts Switches navigation to relative URL.
tests/e2e/txDashClassicOperations.test.ts Switches navigation to relative URL.
tests/e2e/submitTransactionPage.test.ts Switches navigation to relative URL.
tests/e2e/smartContractsVersionHistory.test.ts Switches navigation to relative URL.
tests/e2e/smartContractsStorage.test.ts Switches navigation to relative URL in helper.
tests/e2e/smartContractsContractInfo.test.ts Switches navigation to relative URL.
tests/e2e/simulateTransactionPage.test.ts Switches navigation to relative URL.
tests/e2e/signerSelector.test.ts Uses BASE_URL when creating a new context/page for navigation.
tests/e2e/signTransactionPage.test.ts Switches navigation to relative URL.
tests/e2e/savedTransactions.test.ts Switches navigation to relative URL (includes manual context usage).
tests/e2e/savedSmartContractIds.test.ts Switches navigation to relative URL (includes manual context usage).
tests/e2e/savedRequests.test.ts Switches navigation to relative URL (includes manual context usage).
tests/e2e/savedKeypairs.test.ts Switches navigation to relative URL (includes manual context usage).
tests/e2e/parseMuxedAccountPage.test.ts Switches navigation to relative URL.
tests/e2e/networkSelector.test.ts Uses relative navigation for base page and BASE_URL for deep-link case.
tests/e2e/networkLimitsPage.test.ts Uses BASE_URL for one deep-link and relative URL elsewhere.
tests/e2e/mock/localStorage.ts Makes storageState origin/shareable URLs depend on process.env.PORT.
tests/e2e/introductionPage.test.ts Switches navigation to relative URL (includes manual context usage).
tests/e2e/fundAccountPage.test.ts Switches navigation to relative URLs.
tests/e2e/feeBumpPage.test.ts Switches navigation to relative URL.
tests/e2e/endpointsPage.test.ts Uses relative navigation for most pages and BASE_URL for some deep-links.
tests/e2e/diffXdrsPage.test.ts Switches navigation to relative URL.
tests/e2e/createMuxedAccountPage.test.ts Switches navigation to relative URL.
tests/e2e/createAccountPage.test.ts Switches navigation to relative URL.
tests/e2e/buildTransaction.test.ts Switches navigation to relative URL.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 43 to 48
const browserContext = await browser.newContext({
storageState: MOCK_LOCAL_STORAGE,
});
pageContext = await browserContext.newPage();
await pageContext.goto("http://localhost:3000/endpoints/saved");
await pageContext.goto("/endpoints/saved");

Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pageContext is created via browser.newContext() without a baseURL. Relative pageContext.goto("/endpoints/saved") will fail because there’s no base URL to resolve against. Provide baseURL in newContext or navigate to an absolute URL.

Copilot uses AI. Check for mistakes.
Comment on lines 26 to 32
const browserContext = await browser.newContext({
storageState: MOCK_LOCAL_STORAGE,
});
pageContext = await browserContext.newPage();

await pageContext.goto("http://localhost:3000/smart-contracts/saved");
await pageContext.goto("/smart-contracts/saved");
});
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page is created from a manually constructed context (browser.newContext). Without passing baseURL into that context, pageContext.goto("/smart-contracts/saved") won’t resolve and will fail. Set baseURL when creating the context or use an absolute URL here.

Copilot uses AI. Check for mistakes.
Comment on lines 34 to 40
const browserContext = await browser.newContext({
storageState: MOCK_LOCAL_STORAGE,
});
pageContext = await browserContext.newPage();

await pageContext.goto("http://localhost:3000/account/saved");
await pageContext.goto("/account/saved");

Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pageContext is created via browser.newContext({ storageState }) without baseURL. Relative navigation (pageContext.goto("/account/saved")) relies on baseURL and will fail in this setup. Pass baseURL into newContext (preferred) or use an absolute URL.

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +4
const BASE_URL = `http://localhost:${process.env.PORT || 3000}`;

Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reintroduces a second “source of truth” for the test server URL (BASE_URL built from process.env.PORT). Since playwright.config.ts already sets use.baseURL, these navigations can use relative URLs (including query strings) to automatically respect whatever baseURL/webServer URL Playwright is using. Keeping a local BASE_URL risks drift if the config baseURL ever changes (host, protocol, etc.).

Copilot uses AI. Check for mistakes.
Comment on lines 97 to 100
const context = await browser.newContext();
const page = await context.newPage();
await page.goto("http://localhost:3000/");
await page.goto("/");

Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

page.goto("/") only works when the page/context has a baseURL configured. Here the page is created via browser.newContext() (not the Playwright page fixture), so no baseURL is applied and this navigation will fail. Pass baseURL when creating the context (recommended) or navigate using an absolute URL derived from the same baseURL used in playwright.config.ts.

Copilot uses AI. Check for mistakes.
Comment on lines 29 to 34
const browserContext = await browser.newContext({
storageState: MOCK_LOCAL_STORAGE,
});
pageContext = await browserContext.newPage();
await pageContext.goto("http://localhost:3000/transaction/saved");
await pageContext.goto("/transaction/saved");
});
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pageContext comes from a manually created browser.newContext(). Relative navigation (pageContext.goto("/transaction/saved")) requires a context baseURL, which isn’t set here, so the test will fail. Set baseURL in browser.newContext({ ..., baseURL }) or use an absolute URL for this navigation.

Copilot uses AI. Check for mistakes.
@stellar-jenkins
Copy link

Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one comment from Copilot that's worth looking at; otherwise it looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog (Not Ready)

Development

Successfully merging this pull request may close these issues.

4 participants