From 892a269d181e504c66d1c97f61279d23e7ab4867 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Mon, 4 Dec 2023 11:03:57 -0500 Subject: [PATCH] test: migrate some datetime tests --- .../components/datetime/test/readonly/datetime.e2e.ts | 4 ++-- .../components/datetime/test/values/datetime.e2e.ts | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/core/src/components/datetime/test/readonly/datetime.e2e.ts b/core/src/components/datetime/test/readonly/datetime.e2e.ts index 1a1c3c8553..ea47e7ded8 100644 --- a/core/src/components/datetime/test/readonly/datetime.e2e.ts +++ b/core/src/components/datetime/test/readonly/datetime.e2e.ts @@ -49,7 +49,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config, scree await calendarMonthYear.click(); await page.waitForChanges(); - await page.locator('.month-column .picker-item[data-value="3"]').click(); + await page.locator('.month-column ion-picker-column-option').nth(2).click(); await page.waitForChanges(); await expect(calendarMonthYear).toHaveText('March 2022'); @@ -78,7 +78,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config, scree await page.keyboard.press('Enter'); await page.waitForChanges(); - const marchPickerItem = page.locator('.month-column .picker-item[data-value="3"]'); + const marchPickerItem = page.locator('.month-column ion-picker-column-option').nth(2); await expect(marchPickerItem).toBeVisible(); }); diff --git a/core/src/components/datetime/test/values/datetime.e2e.ts b/core/src/components/datetime/test/values/datetime.e2e.ts index 19b3e8478c..23a9e4a382 100644 --- a/core/src/components/datetime/test/values/datetime.e2e.ts +++ b/core/src/components/datetime/test/values/datetime.e2e.ts @@ -65,7 +65,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => const items = page.locator('ion-picker-column:nth-of-type(2) ion-picker-column-option'); await expect(items).toHaveText(['01', '02', '03']); }); - test.only('should adjust default parts for allowed hour and minute values', async ({ page }) => { + test('should adjust default parts for allowed hour and minute values', async ({ page }) => { /** * Mock today's date for testing. * Playwright does not support this natively @@ -96,13 +96,12 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => const minuteColumn = page.locator('ion-picker-column').nth(1); const minuteItems = minuteColumn.locator('ion-picker-column-option'); - const text = await minuteItems.nth(1).textContent(); - await expect(minuteItems).toHaveText(['00', '15', '30', '45'], { useInnerText: true }); + await expect(minuteItems).toHaveText(['00', '15', '30', '45']); await expect(minuteColumn).toHaveJSProperty('value', 15); const hourColumn = page.locator('ion-picker-column').nth(0); const hourItems = hourColumn.locator('ion-picker-column-option'); - await expect(hourItems).toHaveText(['2'], { useInnerText: true }); + await expect(hourItems).toHaveText(['2']); await expect(hourColumn).toHaveJSProperty('value', 2); /** @@ -111,7 +110,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => */ const ampmColumn = page.locator('ion-picker-column').nth(2); const ampmItems = ampmColumn.locator('ion-picker-column-option'); - await expect(ampmItems).toHaveText(['AM', 'PM'], { useInnerText: true }); + await expect(ampmItems).toHaveText(['AM', 'PM']); await expect(ampmColumn).toHaveJSProperty('value', 'am'); }); test('should adjust default parts month for allowed month values', async ({ page }) => { @@ -144,7 +143,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => const monthItems = page.locator('.month-column ion-picker-column-option'); await expect(monthItems).toHaveText(['January']); - await expect(monthItems.nth(0)).toHaveClass(/picker-item-active/); + await expect(monthItems.nth(0)).toHaveClass(/option-active/); }); test('today date highlight should persist even if disallowed from dayValues', async ({ page }) => { /**