test(img): migrate tests to playwright (#25488)

This commit is contained in:
Liam DeBeasi
2022-06-16 16:15:46 -04:00
committed by GitHub
parent e52392e648
commit b6e9c01ad3
30 changed files with 41 additions and 36 deletions

View File

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

View File

@ -0,0 +1,12 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
test.describe('img: basic', () => {
test('should not have visual regressions', async ({ page }) => {
await page.goto('/src/components/img/test/basic');
await page.setIonViewport();
expect(await page.screenshot()).toMatchSnapshot(`img-basic-${page.getSnapshotSettings()}.png`);
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

View File

@ -1,16 +0,0 @@
import { newE2EPage } from '@stencil/core/testing';
test('img: draggable', async () => {
const page = await newE2EPage({
url: '/src/components/img/test/draggable?ionic:_testing=true',
});
const imgDraggableTrue = await page.find('#img-draggable-true >>> img');
expect(imgDraggableTrue.getAttribute('draggable')).toEqual('true');
const imgDraggableFalse = await page.find('#img-draggable-false >>> img');
expect(imgDraggableFalse.getAttribute('draggable')).toEqual('false');
const imgDraggableUnset = await page.find('#img-draggable-unset >>> img');
expect(imgDraggableUnset.getAttribute('draggable')).toEqual(null);
});

View File

@ -0,0 +1,17 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
test.describe('img: draggable', () => {
test('should correctly set draggable attribute on inner img element', async ({ page }) => {
await page.goto('/src/components/img/test/draggable');
const imgDraggableTrue = page.locator('#img-draggable-true img');
expect(imgDraggableTrue).toHaveAttribute('draggable', 'true');
const imgDraggableFalse = page.locator('#img-draggable-false img');
expect(imgDraggableFalse).toHaveAttribute('draggable', 'false');
const imgDraggableUnset = page.locator('#img-draggable-unset img');
expect(imgDraggableUnset).toHaveAttribute('draggable', '');
});
});

View File

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

View File

@ -0,0 +1,12 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
test.describe('img: standalone', () => {
test('should not have visual regressions', async ({ page }) => {
await page.goto('/src/components/img/test/standalone');
await page.setIonViewport();
expect(await page.screenshot()).toMatchSnapshot(`img-standalone-${page.getSnapshotSettings()}.png`);
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB