Skip to content

Commit 79d5716

Browse files
committed
fix(tests): updating tests to wait for datetime
1 parent 1441928 commit 79d5716

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

core/src/components/datetime-button/test/a11y/datetime-button.e2e.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ configs({ directions: ['ltr'], modes: ['ios'] }).forEach(({ title, screenshot, c
2121
);
2222

2323
const datetimeButton = page.locator('ion-datetime-button');
24+
await page.locator('.datetime-ready').waitFor();
2425

2526
await expect(datetimeButton).toHaveScreenshot(screenshot(`datetime-button-scale`));
2627
});
@@ -40,6 +41,7 @@ configs({ directions: ['ltr'], modes: ['ios'] }).forEach(({ title, screenshot, c
4041
);
4142

4243
const datetimeButton = page.locator('ion-datetime-button');
44+
await page.locator('.datetime-ready').waitFor();
4345

4446
await expect(datetimeButton).toHaveScreenshot(screenshot(`datetime-button-scale-wrap`));
4547
});

core/src/components/datetime-button/test/overlays/datetime-button.e2e.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
2424
await dateButton.click();
2525
await ionModalDidPresent.next();
2626

27+
// Wait for datetime to be ready before taking screenshot
28+
await page.locator('ion-datetime.datetime-ready').waitFor();
29+
2730
await expect(page).toHaveScreenshot(screenshot(`datetime-overlay-modal`));
2831
});
2932

@@ -44,6 +47,9 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
4447
await dateButton.click();
4548
await ionPopoverDidPresent.next();
4649

50+
// Wait for datetime to be ready before taking screenshot
51+
await page.locator('ion-datetime.datetime-ready').waitFor();
52+
4753
await expect(page).toHaveScreenshot(screenshot(`datetime-overlay-popover`));
4854
});
4955
});

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
5252
test.describe(title('datetime: custom focus'), () => {
5353
test('should focus the selected day and then the day after', async ({ page }) => {
5454
await page.goto(`/src/components/datetime/test/custom`, config);
55+
await page.locator('.datetime-ready').last().waitFor();
5556

5657
const datetime = page.locator('#custom-calendar-days');
5758

core/src/components/datetime/test/first-day-of-week/datetime.e2e.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ configs().forEach(({ title, screenshot, config }) => {
77
await page.goto('/src/components/datetime/test/first-day-of-week', config);
88

99
const datetime = page.locator('ion-datetime');
10+
await page.locator('.datetime-ready').waitFor();
1011
await expect(datetime).toHaveScreenshot(screenshot(`datetime-day-of-week`));
1112
});
1213
});

core/src/components/datetime/test/highlighted-dates/datetime.e2e.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
1010
`,
1111
config
1212
);
13+
await page.locator('.datetime-ready').waitFor();
1314
});
1415

1516
test('should render highlights correctly when using an array', async ({ page }) => {

0 commit comments

Comments
 (0)