From 1917c712350604ec5a1cba85de23cb39e015f563 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Wed, 4 Jan 2023 09:28:28 -0500 Subject: [PATCH] test(datetime): resolve flaky tests as year changes (#26561) --- .../datetime/test/locale/datetime.e2e.ts | 7 +++---- .../test/prefer-wheel/datetime.e2e.ts | 21 +++++++++++++++---- .../datetime/test/presentation/index.html | 2 +- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/core/src/components/datetime/test/locale/datetime.e2e.ts b/core/src/components/datetime/test/locale/datetime.e2e.ts index 42f04f0c46..8863197f64 100644 --- a/core/src/components/datetime/test/locale/datetime.e2e.ts +++ b/core/src/components/datetime/test/locale/datetime.e2e.ts @@ -121,11 +121,9 @@ test.describe('ar-EG', () => { `); await page.waitForSelector('.datetime-ready'); - const datetimeYears = page.locator('ion-datetime .year-column .picker-item:not(.picker-item-empty)'); + const datetimeYear = page.locator('ion-datetime .year-column .picker-item[data-value="2022"]'); - await expect(datetimeYears.nth(0)).toHaveText('٢٠٢٢'); - await expect(datetimeYears.nth(1)).toHaveText('٢٠٢١'); - await expect(datetimeYears.nth(2)).toHaveText('٢٠٢٠'); + await expect(datetimeYear).toHaveText('٢٠٢٢'); }); }); @@ -147,6 +145,7 @@ class DatetimeLocaleFixture { locale="${this.locale}" presentation="${presentation}" value="2022-04-19T04:20:00" + max="2022" > `); diff --git a/core/src/components/datetime/test/prefer-wheel/datetime.e2e.ts b/core/src/components/datetime/test/prefer-wheel/datetime.e2e.ts index 647b56dd59..ec4279714c 100644 --- a/core/src/components/datetime/test/prefer-wheel/datetime.e2e.ts +++ b/core/src/components/datetime/test/prefer-wheel/datetime.e2e.ts @@ -17,14 +17,14 @@ test.describe('datetime: prefer wheel', () => { test.describe('datetime: wheel rendering', () => { test('should not have visual regressions for date wheel', async ({ page }) => { await page.setContent(` - + `); expect(await page.screenshot()).toMatchSnapshot(`datetime-wheel-date-diff-${page.getSnapshotSettings()}.png`); }); test('should not have visual regressions for date-time wheel', async ({ page }) => { await page.setContent(` - + `); expect(await page.screenshot()).toMatchSnapshot( @@ -33,7 +33,7 @@ test.describe('datetime: prefer wheel', () => { }); test('should not have visual regressions for time-date wheel', async ({ page }) => { await page.setContent(` - + `); expect(await page.screenshot()).toMatchSnapshot( @@ -42,7 +42,7 @@ test.describe('datetime: prefer wheel', () => { }); test('should render a condense header when specified', async ({ page }) => { await page.setContent(` -
My Custom Title
+
My Custom Title
`); await page.waitForSelector('.datetime-ready'); @@ -131,6 +131,19 @@ test.describe('datetime: prefer wheel', () => { presentation="date" prefer-wheel="true" > + + `); await page.waitForSelector('.datetime-ready'); diff --git a/core/src/components/datetime/test/presentation/index.html b/core/src/components/datetime/test/presentation/index.html index 74c3303444..2ed3c59e01 100644 --- a/core/src/components/datetime/test/presentation/index.html +++ b/core/src/components/datetime/test/presentation/index.html @@ -35,7 +35,7 @@ - +