Skip to content

Commit e2c7e31

Browse files
committed
test(datetime): fix flaky custom test
1 parent b095789 commit e2c7e31

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

core/src/components/datetime/test/custom/datetime.e2e.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
55
test.describe(title('datetime: custom'), () => {
66
test.beforeEach(async ({ page }) => {
77
await page.goto(`/src/components/datetime/test/custom`, config);
8+
9+
await page.locator('.datetime-ready').last().waitFor();
810
});
911

1012
test('should allow styling wheel style datetimes', async ({ page }) => {
@@ -30,7 +32,12 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
3032
test('should allow styling calendar days in grid style datetimes', async ({ page }) => {
3133
const datetime = page.locator('#custom-calendar-days');
3234

33-
await page.locator('.datetime-ready').last().waitFor();
35+
// Wait for calendar days to be rendered
36+
await page.waitForFunction(() => {
37+
const datetime = document.querySelector('#custom-calendar-days');
38+
const calendarDays = datetime?.shadowRoot?.querySelectorAll('.calendar-day');
39+
return calendarDays && calendarDays.length > 0;
40+
});
3441

3542
await expect(datetime).toHaveScreenshot(screenshot(`datetime-custom-calendar-days`));
3643
});

0 commit comments

Comments
 (0)