test(avatar): migrate to playwright (#25925)

This commit is contained in:
Sean Perkins
2022-09-14 11:53:56 -04:00
committed by GitHub
parent 91636c36b7
commit 9b244dd3f0
27 changed files with 26 additions and 14 deletions

View File

@@ -0,0 +1,22 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
test.describe('avatar: basic', () => {
test('should not have visual regressions', async ({ page, skip }) => {
skip.rtl('Avatar does not test RTL behaviors. Usages of Avatar in slots are tested in components that use Avatar.');
await page.goto(`/src/components/avatar/test/basic`);
const avatar = page.locator('#avatar');
const avatarChip = page.locator('#avatar-chip');
const avatarItemStart = page.locator('#avatar-item-start');
const avatarItemEnd = page.locator('#avatar-item-end');
expect(await avatar.screenshot()).toMatchSnapshot(`avatar-diff-${page.getSnapshotSettings()}.png`);
expect(await avatarChip.screenshot()).toMatchSnapshot(`avatar-chip-diff-${page.getSnapshotSettings()}.png`);
expect(await avatarItemStart.screenshot()).toMatchSnapshot(
`avatar-item-start-diff-${page.getSnapshotSettings()}.png`
);
expect(await avatarItemEnd.screenshot()).toMatchSnapshot(`avatar-item-end-diff-${page.getSnapshotSettings()}.png`);
});
});

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@@ -23,25 +23,25 @@
</ion-header>
<ion-content>
<ion-avatar>
<ion-avatar id="avatar">
<img src="/src/components/avatar/test/avatar.svg" />
</ion-avatar>
<ion-chip>
<ion-chip id="avatar-chip">
<ion-avatar>
<img src="/src/components/avatar/test/avatar.svg" />
</ion-avatar>
<ion-label>Chip Avatar</ion-label>
</ion-chip>
<ion-item>
<ion-item id="avatar-item-start">
<ion-avatar slot="start">
<img src="/src/components/avatar/test/avatar.svg" />
</ion-avatar>
<ion-label>Item Avatar</ion-label>
</ion-item>
<ion-item>
<ion-item id="avatar-item-end">
<ion-avatar slot="end">
<img src="/src/components/avatar/test/avatar.svg" />
</ion-avatar>

View File

@@ -1,10 +0,0 @@
import { newE2EPage } from '@stencil/core/testing';
test('avatar: standalone', async () => {
const page = await newE2EPage({
url: '/src/components/avatar/test/standalone?ionic:_testing=true',
});
const compare = await page.compareScreenshot();
expect(compare).toMatchScreenshot();
});