refactors
This commit is contained in:
parent
4e1a339432
commit
82c4d0168e
28 changed files with 1042 additions and 782 deletions
|
|
@ -65,7 +65,9 @@ test.describe("Availability Page - Admin Access", () => {
|
|||
|
||||
// Get the testid so we can find the same card later
|
||||
const testId = await dayCardWithNoAvailability.getAttribute("data-testid");
|
||||
const targetCard = page.locator(`[data-testid="${testId}"]`);
|
||||
if (!testId) {
|
||||
throw new Error("Could not get testid from day card");
|
||||
}
|
||||
|
||||
// First add availability
|
||||
await dayCardWithNoAvailability.click();
|
||||
|
|
@ -83,8 +85,14 @@ test.describe("Availability Page - Admin Access", () => {
|
|||
await saveGetPromise;
|
||||
await expect(page.getByRole("heading", { name: /Edit Time Slots/ })).not.toBeVisible();
|
||||
|
||||
// Verify slot exists in the specific card we clicked
|
||||
await expect(targetCard.getByText("09:00 - 17:00")).toBeVisible();
|
||||
// Re-query the card after save to avoid stale element references
|
||||
// React may have re-rendered the entire list, so we need a fresh reference
|
||||
const targetCard = page.locator(`[data-testid="${testId}"]`);
|
||||
|
||||
// Wait for "No availability" to disappear first, indicating slots have been loaded
|
||||
await expect(targetCard.getByText("No availability")).not.toBeVisible({ timeout: 10000 });
|
||||
// Then verify the specific slot text appears - this ensures the component has re-rendered
|
||||
await expect(targetCard.getByText("09:00 - 17:00")).toBeVisible({ timeout: 5000 });
|
||||
|
||||
// Now clear it - click on the same card using the testid
|
||||
await targetCard.click();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue