From 79d5716baf1517378ffaaba9cf274dc71c583137 Mon Sep 17 00:00:00 2001 From: ShaneK Date: Fri, 12 Dec 2025 07:29:30 -0800 Subject: [PATCH] fix(tests): updating tests to wait for datetime --- .../datetime-button/test/a11y/datetime-button.e2e.ts | 2 ++ .../datetime-button/test/overlays/datetime-button.e2e.ts | 6 ++++++ core/src/components/datetime/test/custom/datetime.e2e.ts | 1 + .../datetime/test/first-day-of-week/datetime.e2e.ts | 1 + .../datetime/test/highlighted-dates/datetime.e2e.ts | 1 + 5 files changed, 11 insertions(+) diff --git a/core/src/components/datetime-button/test/a11y/datetime-button.e2e.ts b/core/src/components/datetime-button/test/a11y/datetime-button.e2e.ts index a48a06a289..0f4d682a6d 100644 --- a/core/src/components/datetime-button/test/a11y/datetime-button.e2e.ts +++ b/core/src/components/datetime-button/test/a11y/datetime-button.e2e.ts @@ -21,6 +21,7 @@ configs({ directions: ['ltr'], modes: ['ios'] }).forEach(({ title, screenshot, c ); const datetimeButton = page.locator('ion-datetime-button'); + await page.locator('.datetime-ready').waitFor(); await expect(datetimeButton).toHaveScreenshot(screenshot(`datetime-button-scale`)); }); @@ -40,6 +41,7 @@ configs({ directions: ['ltr'], modes: ['ios'] }).forEach(({ title, screenshot, c ); const datetimeButton = page.locator('ion-datetime-button'); + await page.locator('.datetime-ready').waitFor(); await expect(datetimeButton).toHaveScreenshot(screenshot(`datetime-button-scale-wrap`)); }); diff --git a/core/src/components/datetime-button/test/overlays/datetime-button.e2e.ts b/core/src/components/datetime-button/test/overlays/datetime-button.e2e.ts index a626dd9085..5e4fefd243 100644 --- a/core/src/components/datetime-button/test/overlays/datetime-button.e2e.ts +++ b/core/src/components/datetime-button/test/overlays/datetime-button.e2e.ts @@ -24,6 +24,9 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { await dateButton.click(); await ionModalDidPresent.next(); + // Wait for datetime to be ready before taking screenshot + await page.locator('ion-datetime.datetime-ready').waitFor(); + await expect(page).toHaveScreenshot(screenshot(`datetime-overlay-modal`)); }); @@ -44,6 +47,9 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { await dateButton.click(); await ionPopoverDidPresent.next(); + // Wait for datetime to be ready before taking screenshot + await page.locator('ion-datetime.datetime-ready').waitFor(); + await expect(page).toHaveScreenshot(screenshot(`datetime-overlay-popover`)); }); }); diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts b/core/src/components/datetime/test/custom/datetime.e2e.ts index 60339fbf74..b62622f0ad 100644 --- a/core/src/components/datetime/test/custom/datetime.e2e.ts +++ b/core/src/components/datetime/test/custom/datetime.e2e.ts @@ -52,6 +52,7 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { test.describe(title('datetime: custom focus'), () => { test('should focus the selected day and then the day after', async ({ page }) => { await page.goto(`/src/components/datetime/test/custom`, config); + await page.locator('.datetime-ready').last().waitFor(); const datetime = page.locator('#custom-calendar-days'); diff --git a/core/src/components/datetime/test/first-day-of-week/datetime.e2e.ts b/core/src/components/datetime/test/first-day-of-week/datetime.e2e.ts index 3630d2c5f4..9cb8862415 100644 --- a/core/src/components/datetime/test/first-day-of-week/datetime.e2e.ts +++ b/core/src/components/datetime/test/first-day-of-week/datetime.e2e.ts @@ -7,6 +7,7 @@ configs().forEach(({ title, screenshot, config }) => { await page.goto('/src/components/datetime/test/first-day-of-week', config); const datetime = page.locator('ion-datetime'); + await page.locator('.datetime-ready').waitFor(); await expect(datetime).toHaveScreenshot(screenshot(`datetime-day-of-week`)); }); }); diff --git a/core/src/components/datetime/test/highlighted-dates/datetime.e2e.ts b/core/src/components/datetime/test/highlighted-dates/datetime.e2e.ts index 12f014b74e..89ada6a9d7 100644 --- a/core/src/components/datetime/test/highlighted-dates/datetime.e2e.ts +++ b/core/src/components/datetime/test/highlighted-dates/datetime.e2e.ts @@ -10,6 +10,7 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { `, config ); + await page.locator('.datetime-ready').waitFor(); }); test('should render highlights correctly when using an array', async ({ page }) => {