mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
test(text): migrate tests to playwright (#26288)
This commit is contained in:
@ -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();
|
|
||||||
});
|
|
29
core/src/components/text/test/basic/text.e2e.ts
Normal file
29
core/src/components/text/test/basic/text.e2e.ts
Normal 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 |
Reference in New Issue
Block a user