test(text): migrate tests to playwright (#26288)

This commit is contained in:
Liam DeBeasi
2022-11-16 14:27:29 -05:00
committed by GitHub
parent 73ea64c02f
commit 7f393e0fdf
8 changed files with 29 additions and 10 deletions

View File

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

View File

@ -0,0 +1,29 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
test.describe('text: basic', () => {
test.beforeEach(({ skip }) => {
skip.rtl();
skip.mode('ios', 'Text does not have per-mode styles');
});
test('should render default text', async ({ page }) => {
await page.setContent(`
<ion-text>
<strong>The quick brown fox <ion-text><sup>jumps</sup></ion-text> over the <ion-text><sub>lazy dog</sub></ion-text></strong>
</ion-text>
`);
const text = page.locator('ion-text');
expect(await text.nth(0).screenshot()).toMatchSnapshot(`text-${page.getSnapshotSettings()}.png`);
});
test('should render text with color prop', async ({ page }) => {
await page.setContent(`
<ion-text color="primary">
<strong>The quick brown fox <ion-text color="success"><sup>jumps</sup></ion-text> over the <ion-text color="danger"><sub>lazy dog</sub></ion-text></strong>
</ion-text>
`);
const text = page.locator('ion-text');
expect(await text.nth(0).screenshot()).toMatchSnapshot(`text-color-${page.getSnapshotSettings()}.png`);
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB