Fix e2e test: Update date button selector to use data-testid
- Replace text-based selector that expected English weekdays with data-testid selector - Dates now use Spanish locale (es-ES) formatting, so weekday text changed - Using data-testid is more reliable and language-agnostic - Fixes failing test: 'regular user can access exchange page, all UI elements work, and buy/sell toggle functions'
This commit is contained in:
parent
eff0698acb
commit
b8b3e8b9f6
1 changed files with 6 additions and 4 deletions
|
|
@ -97,10 +97,12 @@ test.describe("Exchange Page - Regular User Access", () => {
|
||||||
// Test date selection appears after continue
|
// Test date selection appears after continue
|
||||||
await page.getByRole("button", { name: "Continue to Booking" }).click();
|
await page.getByRole("button", { name: "Continue to Booking" }).click();
|
||||||
await expect(page.getByRole("heading", { name: "Select a Date" })).toBeVisible();
|
await expect(page.getByRole("heading", { name: "Select a Date" })).toBeVisible();
|
||||||
const dateButtons = page
|
// Date formatting uses Spanish locale (es-ES), so weekdays are in Spanish: Lun, Mar, Mié, Jue, Vie, Sáb, Dom
|
||||||
.locator("button")
|
// Use data-testid selector which is more reliable than text matching
|
||||||
.filter({ hasText: /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)/ });
|
// Wait for at least one date button to appear (they have data-testid="date-YYYY-MM-DD")
|
||||||
await expect(dateButtons.first()).toBeVisible();
|
await expect(page.locator('button[data-testid^="date-"]').first()).toBeVisible({
|
||||||
|
timeout: 10000,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue