test(picker, picker-column): migrate to generators (#27352)
Issue number: N/A --------- <!-- Please refer to our contributing documentation for any questions on submitting a pull request, or let us know here if you need any help: https://ionicframework.com/docs/building/contributing --> <!-- Some docs updates need to be made in the `ionic-docs` repo, in a separate PR. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation for details. --> <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Picker and picker column tests use legacy syntax ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Picker and picker column tests use generator syntax ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
@ -1,26 +0,0 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { test } from '@utils/test/playwright';
|
||||
|
||||
test.describe('picker: basic', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.goto('/src/components/picker/test/basic');
|
||||
const didPresent = await page.spyOnEvent('ionPickerDidPresent');
|
||||
const didDismiss = await page.spyOnEvent('ionPickerDidDismiss');
|
||||
|
||||
await page.click('#basic');
|
||||
await didPresent.next();
|
||||
await page.waitForChanges();
|
||||
|
||||
await expect(page).toHaveScreenshot(`picker-basic-${page.getSnapshotSettings()}.png`);
|
||||
|
||||
await page.click('.picker-opt:nth-child(2)');
|
||||
await page.click('ion-picker .save-btn');
|
||||
await didDismiss.next();
|
||||
|
||||
await page.click('#basic');
|
||||
await didPresent.next();
|
||||
await page.waitForChanges();
|
||||
|
||||
await expect(page).toHaveScreenshot(`picker-value-selected-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
});
|
||||
28
core/src/components/picker/test/basic/picker.e2e.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
configs().forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('picker: basic'), () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.goto('/src/components/picker/test/basic', config);
|
||||
const didPresent = await page.spyOnEvent('ionPickerDidPresent');
|
||||
const didDismiss = await page.spyOnEvent('ionPickerDidDismiss');
|
||||
|
||||
await page.click('#basic');
|
||||
await didPresent.next();
|
||||
await page.waitForChanges();
|
||||
|
||||
await expect(page).toHaveScreenshot(screenshot(`picker-basic`));
|
||||
|
||||
await page.click('.picker-opt:nth-child(2)');
|
||||
await page.click('ion-picker .save-btn');
|
||||
await didDismiss.next();
|
||||
|
||||
await page.click('#basic');
|
||||
await didPresent.next();
|
||||
await page.waitForChanges();
|
||||
|
||||
await expect(page).toHaveScreenshot(screenshot(`picker-value-selected`));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
@ -1,34 +0,0 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { test } from '@utils/test/playwright';
|
||||
|
||||
test.describe('picker: isOpen', () => {
|
||||
test.beforeEach(async ({ page, skip }) => {
|
||||
skip.rtl('isOpen does not behave differently in RTL');
|
||||
skip.mode('md', 'isOpen does not behave differently in MD');
|
||||
await page.goto('/src/components/picker/test/is-open');
|
||||
});
|
||||
|
||||
test('should open the picker', async ({ page }) => {
|
||||
const ionPickerDidPresent = await page.spyOnEvent('ionPickerDidPresent');
|
||||
const picker = page.locator('ion-picker');
|
||||
|
||||
await page.click('#default');
|
||||
|
||||
await ionPickerDidPresent.next();
|
||||
await expect(picker).toBeVisible();
|
||||
});
|
||||
|
||||
test('should open the picker then close after a timeout', async ({ page }) => {
|
||||
const ionPickerDidPresent = await page.spyOnEvent('ionPickerDidPresent');
|
||||
const ionPickerDidDismiss = await page.spyOnEvent('ionPickerDidDismiss');
|
||||
const picker = page.locator('ion-picker');
|
||||
|
||||
await page.click('#timeout');
|
||||
|
||||
await ionPickerDidPresent.next();
|
||||
await expect(picker).toBeVisible();
|
||||
|
||||
await ionPickerDidDismiss.next();
|
||||
await expect(picker).toBeHidden();
|
||||
});
|
||||
});
|
||||
37
core/src/components/picker/test/is-open/picker.e2e.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
/**
|
||||
* This behavior does not vary across modes/directions.
|
||||
*/
|
||||
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
||||
test.describe(title('picker: isOpen'), () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/src/components/picker/test/is-open', config);
|
||||
});
|
||||
|
||||
test('should open the picker', async ({ page }) => {
|
||||
const ionPickerDidPresent = await page.spyOnEvent('ionPickerDidPresent');
|
||||
const picker = page.locator('ion-picker');
|
||||
|
||||
await page.click('#default');
|
||||
|
||||
await ionPickerDidPresent.next();
|
||||
await expect(picker).toBeVisible();
|
||||
});
|
||||
|
||||
test('should open the picker then close after a timeout', async ({ page }) => {
|
||||
const ionPickerDidPresent = await page.spyOnEvent('ionPickerDidPresent');
|
||||
const ionPickerDidDismiss = await page.spyOnEvent('ionPickerDidDismiss');
|
||||
const picker = page.locator('ion-picker');
|
||||
|
||||
await page.click('#timeout');
|
||||
|
||||
await ionPickerDidPresent.next();
|
||||
await expect(picker).toBeVisible();
|
||||
|
||||
await ionPickerDidDismiss.next();
|
||||
await expect(picker).toBeHidden();
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -1,35 +0,0 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { test } from '@utils/test/playwright';
|
||||
|
||||
test.describe('picker: trigger', () => {
|
||||
test.beforeEach(async ({ page, skip }) => {
|
||||
skip.rtl('trigger does not behave differently in RTL');
|
||||
skip.mode('md');
|
||||
await page.goto('/src/components/picker/test/trigger');
|
||||
});
|
||||
|
||||
test('should open the picker', async ({ page }) => {
|
||||
const ionPickerDidPresent = await page.spyOnEvent('ionPickerDidPresent');
|
||||
const picker = page.locator('#default-picker');
|
||||
|
||||
await page.click('#default');
|
||||
|
||||
await ionPickerDidPresent.next();
|
||||
await expect(picker).toBeVisible();
|
||||
});
|
||||
|
||||
test('should present a previously presented picker', async ({ page }) => {
|
||||
const ionPickerDidPresent = await page.spyOnEvent('ionPickerDidPresent');
|
||||
const ionPickerDidDismiss = await page.spyOnEvent('ionPickerDidDismiss');
|
||||
const picker = page.locator('#timeout-picker');
|
||||
|
||||
await page.click('#timeout');
|
||||
|
||||
await ionPickerDidDismiss.next();
|
||||
|
||||
await page.click('#timeout');
|
||||
|
||||
await ionPickerDidPresent.next();
|
||||
await expect(picker).toBeVisible();
|
||||
});
|
||||
});
|
||||
38
core/src/components/picker/test/trigger/picker.e2e.ts
Normal file
@ -0,0 +1,38 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
/**
|
||||
* This behavior does not vary across modes/directions.
|
||||
*/
|
||||
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
||||
test.describe(title('picker: trigger'), () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/src/components/picker/test/trigger', config);
|
||||
});
|
||||
|
||||
test('should open the picker', async ({ page }) => {
|
||||
const ionPickerDidPresent = await page.spyOnEvent('ionPickerDidPresent');
|
||||
const picker = page.locator('#default-picker');
|
||||
|
||||
await page.click('#default');
|
||||
|
||||
await ionPickerDidPresent.next();
|
||||
await expect(picker).toBeVisible();
|
||||
});
|
||||
|
||||
test('should present a previously presented picker', async ({ page }) => {
|
||||
const ionPickerDidPresent = await page.spyOnEvent('ionPickerDidPresent');
|
||||
const ionPickerDidDismiss = await page.spyOnEvent('ionPickerDidDismiss');
|
||||
const picker = page.locator('#timeout-picker');
|
||||
|
||||
await page.click('#timeout');
|
||||
|
||||
await ionPickerDidDismiss.next();
|
||||
|
||||
await page.click('#timeout');
|
||||
|
||||
await ionPickerDidPresent.next();
|
||||
await expect(picker).toBeVisible();
|
||||
});
|
||||
});
|
||||
});
|
||||