Skip to content

fix(datetime): changing months work if partially visible #27917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 4, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix flaky datetime test
  • Loading branch information
liamdebeasi committed Aug 2, 2023
commit 74457f4adb1a617c0fa79c87abd6e1dd63ef9037
9 changes: 4 additions & 5 deletions core/src/components/datetime/test/minmax/datetime.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,21 +301,20 @@ configs({ directions: ['ltr'], modes: ['ios'] }).forEach(({ title, config }) =>
<ion-datetime
min="2022-01-15"
value="2022-02-01"
presentation="date"
presentation="month-year"
></ion-datetime>
`,
config
);

const datetime = page.locator('ion-datetime');
const monthYearToggle = page.locator('ion-datetime .calendar-month-year');
const monthColumnItems = page.locator('ion-datetime .month-column .picker-item:not(.picker-item-empty)');
const ionChange = await page.spyOnEvent('ionChange');
Copy link
Contributor Author

@liamdebeasi liamdebeasi Aug 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test started to flake after my changes. This test touches the wheel picker which does not use any of the changed code. I noticed that the test was not waiting for .datetime-ready and it was not waiting for the ionChange event, so it's possible that my change made datetime slightly faster/slower such that this test is now consistently failing.

I simplified the test but made sure to check the same datetime APIs, so this behavior is definitely still working.


await monthYearToggle.click();
await page.waitForChanges();
await page.waitForSelector('.datetime-ready');

await monthColumnItems.nth(0).click(); // switch to January
await page.waitForChanges();
await ionChange.next();

await expect(datetime).toHaveJSProperty('value', '2022-01-15T00:00:00');
});
Expand Down