test(thumbnail): migrate to generators (#27381)
Issue number: N/A --------- <!-- 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. --> Thumbnail tests are using legacy syntax ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Thumbnail tests are using 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,47 +0,0 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { test } from '@utils/test/playwright';
|
||||
|
||||
test.describe('thumbnail: basic', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(`/src/components/thumbnail/test/basic`);
|
||||
});
|
||||
test('should not have visual regressions when rendering <img>', async ({ page, skip }) => {
|
||||
skip.rtl('ion-thumbnail does not have RTL-specific logic');
|
||||
skip.mode('md', 'ion-thumbnail does not have mode-specific logic');
|
||||
|
||||
const referenceEl = page.locator('#img');
|
||||
|
||||
await expect(referenceEl).toHaveScreenshot(`thumbnail-img-diff-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
|
||||
/**
|
||||
* ion-item has mode and RTL specific logic
|
||||
* for ion-thumbnail which is why we do not skip
|
||||
* RTL and mode tests here.
|
||||
*/
|
||||
test('should not have visual regressions when rendering inside of an <ion-item>', async ({ page }) => {
|
||||
const referenceEl = page.locator('#ion-item');
|
||||
|
||||
await expect(referenceEl).toHaveScreenshot(`thumbnail-ion-item-diff-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
|
||||
test('size should be customizable in <ion-item>', async ({ page, skip }) => {
|
||||
skip.rtl();
|
||||
|
||||
test.info().annotations.push({
|
||||
type: 'issue',
|
||||
description: 'https://github.com/ionic-team/ionic-framework/issues/22935',
|
||||
});
|
||||
|
||||
await page.setContent(`
|
||||
<ion-item>
|
||||
<ion-thumbnail style="--size: 20px">
|
||||
<img src="/src/components/thumbnail/test/thumbnail.svg" />
|
||||
</ion-thumbnail>
|
||||
</ion-item>
|
||||
`);
|
||||
|
||||
const item = page.locator('ion-item');
|
||||
await expect(item).toHaveScreenshot(`thumbnail-ion-item-size-diff-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
});
|
57
core/src/components/thumbnail/test/basic/thumbnail.e2e.ts
Normal file
@ -0,0 +1,57 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
/**
|
||||
* ion-thumbnail does not have mode/RTL-specific logic
|
||||
*/
|
||||
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('thumbnail: rendering'), () => {
|
||||
test('should not have visual regressions when rendering <img>', async ({ page }) => {
|
||||
await page.goto(`/src/components/thumbnail/test/basic`, config);
|
||||
|
||||
const referenceEl = page.locator('#img');
|
||||
|
||||
await expect(referenceEl).toHaveScreenshot(screenshot(`thumbnail-img-diff`));
|
||||
});
|
||||
|
||||
test('size should be customizable in <ion-item>', async ({ page }) => {
|
||||
test.info().annotations.push({
|
||||
type: 'issue',
|
||||
description: 'https://github.com/ionic-team/ionic-framework/issues/22935',
|
||||
});
|
||||
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-item>
|
||||
<ion-thumbnail style="--size: 20px">
|
||||
<img src="/src/components/thumbnail/test/thumbnail.svg" />
|
||||
</ion-thumbnail>
|
||||
</ion-item>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const item = page.locator('ion-item');
|
||||
await expect(item).toHaveScreenshot(screenshot(`thumbnail-ion-item-size-diff`));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
configs().forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('thumbnail: item rendering'), () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(`/src/components/thumbnail/test/basic`, config);
|
||||
});
|
||||
|
||||
/**
|
||||
* ion-item has mode and RTL specific logic
|
||||
* for ion-thumbnail which is why we do not skip
|
||||
* RTL and mode tests here.
|
||||
*/
|
||||
test('should not have visual regressions when rendering inside of an <ion-item>', async ({ page }) => {
|
||||
const referenceEl = page.locator('#ion-item');
|
||||
|
||||
await expect(referenceEl).toHaveScreenshot(screenshot(`thumbnail-ion-item-diff`));
|
||||
});
|
||||
});
|
||||
});
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 708 B After Width: | Height: | Size: 708 B |
Before Width: | Height: | Size: 992 B After Width: | Height: | Size: 992 B |
Before Width: | Height: | Size: 842 B After Width: | Height: | Size: 842 B |
Before Width: | Height: | Size: 722 B After Width: | Height: | Size: 722 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 857 B After Width: | Height: | Size: 857 B |