From f402d8e052755af492471d4e79c7667be9ed45ce Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Wed, 3 May 2023 20:07:12 -0400 Subject: [PATCH] test(text): migrate to generators (#27379) Issue number: N/A --------- ## What is the current behavior? Text tests are using legacy syntax ## What is the new behavior? - Text tests are using modern syntax ## Does this introduce a breaking change? - [ ] Yes - [x] No ## Other information --- .../text/test/basic/text.e2e-legacy.ts | 29 -------------- .../components/text/test/basic/text.e2e.ts | 36 ++++++++++++++++++ .../text-color-md-ltr-Mobile-Chrome-linux.png | Bin ...text-color-md-ltr-Mobile-Firefox-linux.png | Bin .../text-color-md-ltr-Mobile-Safari-linux.png | Bin .../text-md-ltr-Mobile-Chrome-linux.png | Bin .../text-md-ltr-Mobile-Firefox-linux.png | Bin .../text-md-ltr-Mobile-Safari-linux.png | Bin 8 files changed, 36 insertions(+), 29 deletions(-) delete mode 100644 core/src/components/text/test/basic/text.e2e-legacy.ts create mode 100644 core/src/components/text/test/basic/text.e2e.ts rename core/src/components/text/test/basic/{text.e2e-legacy.ts-snapshots => text.e2e.ts-snapshots}/text-color-md-ltr-Mobile-Chrome-linux.png (100%) rename core/src/components/text/test/basic/{text.e2e-legacy.ts-snapshots => text.e2e.ts-snapshots}/text-color-md-ltr-Mobile-Firefox-linux.png (100%) rename core/src/components/text/test/basic/{text.e2e-legacy.ts-snapshots => text.e2e.ts-snapshots}/text-color-md-ltr-Mobile-Safari-linux.png (100%) rename core/src/components/text/test/basic/{text.e2e-legacy.ts-snapshots => text.e2e.ts-snapshots}/text-md-ltr-Mobile-Chrome-linux.png (100%) rename core/src/components/text/test/basic/{text.e2e-legacy.ts-snapshots => text.e2e.ts-snapshots}/text-md-ltr-Mobile-Firefox-linux.png (100%) rename core/src/components/text/test/basic/{text.e2e-legacy.ts-snapshots => text.e2e.ts-snapshots}/text-md-ltr-Mobile-Safari-linux.png (100%) diff --git a/core/src/components/text/test/basic/text.e2e-legacy.ts b/core/src/components/text/test/basic/text.e2e-legacy.ts deleted file mode 100644 index e5b69fb57c..0000000000 --- a/core/src/components/text/test/basic/text.e2e-legacy.ts +++ /dev/null @@ -1,29 +0,0 @@ -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(` - - The quick brown fox jumps over the lazy dog - - `); - - const text = page.locator('ion-text'); - await expect(text.nth(0)).toHaveScreenshot(`text-${page.getSnapshotSettings()}.png`); - }); - test('should render text with color prop', async ({ page }) => { - await page.setContent(` - - The quick brown fox jumps over the lazy dog - - `); - - const text = page.locator('ion-text'); - await expect(text.nth(0)).toHaveScreenshot(`text-color-${page.getSnapshotSettings()}.png`); - }); -}); diff --git a/core/src/components/text/test/basic/text.e2e.ts b/core/src/components/text/test/basic/text.e2e.ts new file mode 100644 index 0000000000..a98baa015d --- /dev/null +++ b/core/src/components/text/test/basic/text.e2e.ts @@ -0,0 +1,36 @@ +import { expect } from '@playwright/test'; +import { configs, test } from '@utils/test/playwright'; + +/** + * Text does not have per-mode styles + */ +configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { + test.describe(title('text: basic'), () => { + test('should render default text', async ({ page }) => { + await page.setContent( + ` + + The quick brown fox jumps over the lazy dog + + `, + config + ); + + const text = page.locator('ion-text'); + await expect(text.nth(0)).toHaveScreenshot(screenshot(`text`)); + }); + test('should render text with color prop', async ({ page }) => { + await page.setContent( + ` + + The quick brown fox jumps over the lazy dog + + `, + config + ); + + const text = page.locator('ion-text'); + await expect(text.nth(0)).toHaveScreenshot(screenshot(`text-color`)); + }); + }); +}); diff --git a/core/src/components/text/test/basic/text.e2e-legacy.ts-snapshots/text-color-md-ltr-Mobile-Chrome-linux.png b/core/src/components/text/test/basic/text.e2e.ts-snapshots/text-color-md-ltr-Mobile-Chrome-linux.png similarity index 100% rename from core/src/components/text/test/basic/text.e2e-legacy.ts-snapshots/text-color-md-ltr-Mobile-Chrome-linux.png rename to core/src/components/text/test/basic/text.e2e.ts-snapshots/text-color-md-ltr-Mobile-Chrome-linux.png diff --git a/core/src/components/text/test/basic/text.e2e-legacy.ts-snapshots/text-color-md-ltr-Mobile-Firefox-linux.png b/core/src/components/text/test/basic/text.e2e.ts-snapshots/text-color-md-ltr-Mobile-Firefox-linux.png similarity index 100% rename from core/src/components/text/test/basic/text.e2e-legacy.ts-snapshots/text-color-md-ltr-Mobile-Firefox-linux.png rename to core/src/components/text/test/basic/text.e2e.ts-snapshots/text-color-md-ltr-Mobile-Firefox-linux.png diff --git a/core/src/components/text/test/basic/text.e2e-legacy.ts-snapshots/text-color-md-ltr-Mobile-Safari-linux.png b/core/src/components/text/test/basic/text.e2e.ts-snapshots/text-color-md-ltr-Mobile-Safari-linux.png similarity index 100% rename from core/src/components/text/test/basic/text.e2e-legacy.ts-snapshots/text-color-md-ltr-Mobile-Safari-linux.png rename to core/src/components/text/test/basic/text.e2e.ts-snapshots/text-color-md-ltr-Mobile-Safari-linux.png diff --git a/core/src/components/text/test/basic/text.e2e-legacy.ts-snapshots/text-md-ltr-Mobile-Chrome-linux.png b/core/src/components/text/test/basic/text.e2e.ts-snapshots/text-md-ltr-Mobile-Chrome-linux.png similarity index 100% rename from core/src/components/text/test/basic/text.e2e-legacy.ts-snapshots/text-md-ltr-Mobile-Chrome-linux.png rename to core/src/components/text/test/basic/text.e2e.ts-snapshots/text-md-ltr-Mobile-Chrome-linux.png diff --git a/core/src/components/text/test/basic/text.e2e-legacy.ts-snapshots/text-md-ltr-Mobile-Firefox-linux.png b/core/src/components/text/test/basic/text.e2e.ts-snapshots/text-md-ltr-Mobile-Firefox-linux.png similarity index 100% rename from core/src/components/text/test/basic/text.e2e-legacy.ts-snapshots/text-md-ltr-Mobile-Firefox-linux.png rename to core/src/components/text/test/basic/text.e2e.ts-snapshots/text-md-ltr-Mobile-Firefox-linux.png diff --git a/core/src/components/text/test/basic/text.e2e-legacy.ts-snapshots/text-md-ltr-Mobile-Safari-linux.png b/core/src/components/text/test/basic/text.e2e.ts-snapshots/text-md-ltr-Mobile-Safari-linux.png similarity index 100% rename from core/src/components/text/test/basic/text.e2e-legacy.ts-snapshots/text-md-ltr-Mobile-Safari-linux.png rename to core/src/components/text/test/basic/text.e2e.ts-snapshots/text-md-ltr-Mobile-Safari-linux.png