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:
counterweight 2025-12-26 11:44:08 +01:00
parent eff0698acb
commit b8b3e8b9f6
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C

View file

@ -97,10 +97,12 @@ test.describe("Exchange Page - Regular User Access", () => {
// Test date selection appears after continue
await page.getByRole("button", { name: "Continue to Booking" }).click();
await expect(page.getByRole("heading", { name: "Select a Date" })).toBeVisible();
const dateButtons = page
.locator("button")
.filter({ hasText: /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)/ });
await expect(dateButtons.first()).toBeVisible();
// Date formatting uses Spanish locale (es-ES), so weekdays are in Spanish: Lun, Mar, Mié, Jue, Vie, Sáb, Dom
// Use data-testid selector which is more reliable than text matching
// Wait for at least one date button to appear (they have data-testid="date-YYYY-MM-DD")
await expect(page.locator('button[data-testid^="date-"]').first()).toBeVisible({
timeout: 10000,
});
});
});