test(icon): migrate to generators (#27318)
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. --> Icon tests use legacy syntax ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Icon tests use modern 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,16 +0,0 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { test } from '@utils/test/playwright';
|
||||
|
||||
test.describe('icon: basic', () => {
|
||||
test('should render icon when passed', async ({ page, skip }) => {
|
||||
skip.rtl();
|
||||
skip.mode('ios');
|
||||
|
||||
await page.setContent(`
|
||||
<ion-icon name="star"></ion-icon>
|
||||
`);
|
||||
|
||||
const icon = page.locator('ion-icon');
|
||||
await expect(icon).toHaveScreenshot(`icon-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
});
|
||||
18
core/src/components/icon/test/basic/icon.e2e.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('icon: basic'), () => {
|
||||
test('should render icon when passed', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-icon name="star"></ion-icon>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const icon = page.locator('ion-icon');
|
||||
await expect(icon).toHaveScreenshot(screenshot(`icon`));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Before Width: | Height: | Size: 325 B After Width: | Height: | Size: 325 B |
|
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 372 B |
|
Before Width: | Height: | Size: 314 B After Width: | Height: | Size: 314 B |
@ -1,25 +0,0 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { test } from '@utils/test/playwright';
|
||||
|
||||
test.describe('icon: rtl', () => {
|
||||
test('should flip icon when rtl is active', async ({ page, skip }) => {
|
||||
skip.mode('ios');
|
||||
|
||||
await page.setContent(`
|
||||
<ion-icon name="cut" flip-rtl="true"></ion-icon>
|
||||
`);
|
||||
|
||||
const icon = page.locator('ion-icon');
|
||||
await expect(icon).toHaveScreenshot(`icon-flip-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
test('should not flip icon when rtl is active', async ({ page, skip }) => {
|
||||
skip.mode('ios');
|
||||
|
||||
await page.setContent(`
|
||||
<ion-icon name="cut" flip-rtl="false"></ion-icon>
|
||||
`);
|
||||
|
||||
const icon = page.locator('ion-icon');
|
||||
await expect(icon).toHaveScreenshot(`icon-no-flip-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
});
|
||||
29
core/src/components/icon/test/dir/icon.e2e.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('icon: rtl'), () => {
|
||||
test('should flip icon when rtl is active', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-icon name="cut" flip-rtl="true"></ion-icon>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const icon = page.locator('ion-icon');
|
||||
await expect(icon).toHaveScreenshot(screenshot(`icon-flip`));
|
||||
});
|
||||
test('should not flip icon when rtl is active', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-icon name="cut" flip-rtl="false"></ion-icon>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const icon = page.locator('ion-icon');
|
||||
await expect(icon).toHaveScreenshot(screenshot(`icon-no-flip`));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Before Width: | Height: | Size: 458 B After Width: | Height: | Size: 458 B |
|
Before Width: | Height: | Size: 463 B After Width: | Height: | Size: 463 B |
|
Before Width: | Height: | Size: 455 B After Width: | Height: | Size: 455 B |
|
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 440 B |
|
Before Width: | Height: | Size: 467 B After Width: | Height: | Size: 467 B |
|
Before Width: | Height: | Size: 459 B After Width: | Height: | Size: 459 B |
|
Before Width: | Height: | Size: 458 B After Width: | Height: | Size: 458 B |
|
Before Width: | Height: | Size: 463 B After Width: | Height: | Size: 463 B |
|
Before Width: | Height: | Size: 455 B After Width: | Height: | Size: 455 B |
|
Before Width: | Height: | Size: 458 B After Width: | Height: | Size: 458 B |
|
Before Width: | Height: | Size: 463 B After Width: | Height: | Size: 463 B |
|
Before Width: | Height: | Size: 455 B After Width: | Height: | Size: 455 B |