test(note): migrate tests to playwright (#26052)

This commit is contained in:
Liam DeBeasi
2022-10-03 11:59:23 -05:00
committed by GitHub
parent d17d6c20b4
commit de279c2ad8
38 changed files with 75 additions and 10 deletions

View File

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

View File

@ -0,0 +1,75 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
test.describe('note: rendering', () => {
test.beforeEach(({ skip }) => {
skip.rtl('Note has no custom RTL logic');
});
test('should not have visual regressions', async ({ page }) => {
await page.setContent(`
<ion-note>99</ion-note>
`);
const note = page.locator('ion-note');
expect(await note.screenshot()).toMatchSnapshot(`note-diff-${page.getSnapshotSettings()}.png`);
});
test('should render color correctly', async ({ page }) => {
await page.setContent(`
<ion-note color="danger">99</ion-note>
`);
const note = page.locator('ion-note');
expect(await note.screenshot()).toMatchSnapshot(`note-color-${page.getSnapshotSettings()}.png`);
});
});
test.describe('note: item', () => {
test.beforeEach(({ skip }) => {
skip.mode('ios', 'Only MD ion-item has ion-note specific logic');
});
test('should not have visual regressions when in the start slot of an item', async ({ page }) => {
await page.setContent(`
<ion-item>
<ion-label>Label</ion-label>
<ion-note slot="start">Start Note</ion-note>
</ion-item>
`);
const item = page.locator('ion-item');
expect(await item.screenshot()).toMatchSnapshot(`note-item-start-${page.getSnapshotSettings()}.png`);
});
test('should not have visual regressions when in the end slot of an item', async ({ page }) => {
await page.setContent(`
<ion-item>
<ion-label>Label</ion-label>
<ion-note slot="end">End Note</ion-note>
</ion-item>
`);
const item = page.locator('ion-item');
expect(await item.screenshot()).toMatchSnapshot(`note-item-end-${page.getSnapshotSettings()}.png`);
});
});
test.describe('note: item-divider', () => {
test.beforeEach(({ skip }) => {
skip.mode('ios', 'Only MD ion-item-divider has ion-note specific logic');
});
test('should not have visual regressions when in the start slot of an item-divider', async ({ page }) => {
await page.setContent(`
<ion-item-divider>
<ion-note slot="start">Start Note</ion-note>
</ion-item-divider>
`);
const itemDivider = page.locator('ion-item-divider');
expect(await itemDivider.screenshot()).toMatchSnapshot(`note-item-divider-start-${page.getSnapshotSettings()}.png`);
});
test('should not have visual regressions when in the end slot of an item-divider', async ({ page }) => {
await page.setContent(`
<ion-item-divider>
<ion-note slot="start">End Note</ion-note>
</ion-item-divider>
`);
const itemDivider = page.locator('ion-item-divider');
expect(await itemDivider.screenshot()).toMatchSnapshot(`note-item-divider-end-${page.getSnapshotSettings()}.png`);
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1020 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB