-
Notifications
You must be signed in to change notification settings - Fork 116
Update tests to not use a hard coded localhost:3000
#1949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ test.describe("Introduction Page", () => { | |
| let sections: Locator; | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| await page.goto("http://localhost:3000/"); | ||
| await page.goto("/"); | ||
| sections = page.locator(".Lab__home__section"); | ||
| }); | ||
|
|
||
|
|
@@ -96,7 +96,7 @@ test.describe("Introduction Page", () => { | |
| // Using isolated browser context to make sure the network change won’t affect other tests. | ||
| const context = await browser.newContext(); | ||
| const page = await context.newPage(); | ||
| await page.goto("http://localhost:3000/"); | ||
| await page.goto("/"); | ||
|
|
||
|
Comment on lines
97
to
100
|
||
| const networksSection = page.locator(".Lab__home__section").nth(3); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| import { test, expect, type Page } from "@playwright/test"; | ||
|
|
||
| const BASE_URL = `http://localhost:${process.env.PORT || 3000}`; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To avoid writing this in every test file, we can try to make it a config or a helper (not sure where Can we use |
||
|
|
||
| import { | ||
| formatLedgersToDays, | ||
| formatLedgersToMonths, | ||
|
|
@@ -13,7 +15,7 @@ import { MAINNET_LIMITS } from "@/constants/networkLimits"; | |
| test.describe("Network Limits page on Mainnet", () => { | ||
| test.beforeEach(async ({ page }) => { | ||
| await page.goto( | ||
| "http://localhost:3000/network-limits?$=network$id=mainnet", | ||
| `${BASE_URL}/network-limits?$=network$id=mainnet`, | ||
| ); | ||
| }); | ||
|
|
||
|
|
@@ -288,7 +290,7 @@ test.describe("Network Limits page on Mainnet", () => { | |
|
|
||
| test("Custom network shows warning message", async ({ page }) => { | ||
| // Navigate directly to custom network | ||
| await page.goto("http://localhost:3000/network-limits?$=network$id=custom"); | ||
| await page.goto("/network-limits?$=network$id=custom"); | ||
|
|
||
| // Verify we're on custom network | ||
| await expect(page.getByTestId("networkSelector-button")).toHaveText( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use absolute URL in tests. Relative navigation can be tricky and we might get more flaky tests.