test(spinner): migrate tests to playwright (#25259)

This commit is contained in:
Liam DeBeasi
2022-05-09 13:57:51 -04:00
committed by GitHub
parent 7cfde330e6
commit 7220b4b46f
43 changed files with 45 additions and 47 deletions

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

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

View File

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

View File

@ -1,17 +0,0 @@
import { newE2EPage } from '@stencil/core/testing';
// made to catch animation issues when transform is applied to host
// example: https://github.com/ionic-team/ionic-framework/issues/19247
test('spinner: transform', async () => {
const page = await newE2EPage({
url: '/src/components/spinner/test/transform?ionic:_testing=true',
});
const compare = await page.compareScreenshot();
expect(compare).toMatchScreenshot();
// wait for a bit less than the spinner's duration (to avoid looping before screenshot is taken)
await new Promise((resolve) => setTimeout(resolve, 1500));
expect(compare).toMatchScreenshot();
});