fix: replace hardcoded wait with explicit wait for loading

Replace page.waitForTimeout(1000) with a proper wait for the
loading state to disappear. This makes the test more reliable
and faster.
This commit is contained in:
counterweight 2025-12-23 12:26:43 +01:00
parent 06ad7fefe1
commit b5d831b364
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C

View file

@ -250,8 +250,8 @@ test.describe("Trades Page", () => {
test("trades page shows Start trading link when empty", async ({ page }) => { test("trades page shows Start trading link when empty", async ({ page }) => {
await page.goto("/trades"); await page.goto("/trades");
// Wait for content to load // Wait for loading to finish - either "Loading trades..." disappears or we see content
await page.waitForTimeout(1000); await expect(page.getByText("Loading trades...")).not.toBeVisible({ timeout: 5000 });
// Check if it shows empty state with link, or trades exist // Check if it shows empty state with link, or trades exist
const startTradingLink = page.getByRole("link", { name: "Start trading" }); const startTradingLink = page.getByRole("link", { name: "Start trading" });