test(content): migrate to generators (#27302)

Issue number: N/A

---------

<!-- Please refer to our contributing documentation for any questions on
submitting a pull request, or let us know here if you need any help:
https://ionicframework.com/docs/building/contributing -->

<!-- Some docs updates need to be made in the `ionic-docs` repo, in a
separate PR. See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation
for details. -->

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Content tests are using legacy syntax

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Content tests use generator syntax

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
This commit is contained in:
Liam DeBeasi
2023-04-27 11:36:37 -04:00
committed by GitHub
parent 69ed6d9099
commit dc0f701c39
23 changed files with 66 additions and 57 deletions

View File

@ -1,15 +0,0 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
test.describe('content: basic', () => {
test('should not have visual regressions', async ({ page, skip }) => {
skip.rtl();
skip.mode('ios', 'ion-content does not have mode-specific styling');
await page.goto(`/src/components/content/test/basic`);
await page.setIonViewport();
await expect(page).toHaveScreenshot(`content-diff-${page.getSnapshotSettings()}.png`);
});
});

View File

@ -0,0 +1,17 @@
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';
/**
* ion-content does not have mode-specific styling
*/
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
test.describe(title('content: basic'), () => {
test('should not have visual regressions', async ({ page }) => {
await page.goto(`/src/components/content/test/basic`, config);
await page.setIonViewport();
await expect(page).toHaveScreenshot(screenshot(`content-diff`));
});
});
});

View File

@ -1,14 +0,0 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
test.describe('content: fixed', () => {
test('should not have visual regressions', async ({ page, skip }) => {
skip.mode('ios', 'ion-content does not have mode-specific styling');
await page.goto(`/src/components/content/test/fixed`);
await page.setIonViewport();
await expect(page).toHaveScreenshot(`content-fixed-${page.getSnapshotSettings()}.png`);
});
});

View File

@ -0,0 +1,17 @@
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';
/**
* ion-content does not have mode-specific styling
*/
configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
test.describe(title('content: fixed'), () => {
test('should not have visual regressions', async ({ page }) => {
await page.goto(`/src/components/content/test/fixed`, config);
await page.setIonViewport();
await expect(page).toHaveScreenshot(screenshot(`content-fixed`));
});
});
});

View File

@ -1,15 +0,0 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
test.describe('content: fullscreen', () => {
test('should not have visual regressions', async ({ page, skip }) => {
skip.rtl();
skip.mode('ios', 'ion-content does not have mode-specific styling');
await page.goto(`/src/components/content/test/fullscreen`);
await page.setIonViewport();
await expect(page).toHaveScreenshot(`content-fullscreen-${page.getSnapshotSettings()}.png`);
});
});

View File

@ -0,0 +1,17 @@
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';
/**
* ion-content does not have mode-specific styling
*/
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
test.describe(title('content: fullscreen'), () => {
test('should not have visual regressions', async ({ page }) => {
await page.goto(`/src/components/content/test/fullscreen`, config);
await page.setIonViewport();
await expect(page).toHaveScreenshot(screenshot(`content-fullscreen`));
});
});
});

View File

@ -1,13 +0,0 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
test.describe('content: standalone', () => {
test('should not have visual regressions', async ({ page, skip }) => {
skip.rtl();
skip.mode('ios', 'ion-content does not have mode-specific styling');
await page.goto(`/src/components/content/test/standalone`);
await expect(page).toHaveScreenshot(`content-standalone-${page.getSnapshotSettings()}.png`, { fullPage: true });
});
});

View File

@ -0,0 +1,15 @@
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';
/**
* ion-content does not have mode-specific styling
*/
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
test.describe(title('content: standalone'), () => {
test('should not have visual regressions', async ({ page }) => {
await page.goto(`/src/components/content/test/standalone`, config);
await expect(page).toHaveScreenshot(screenshot(`content-standalone`), { fullPage: true });
});
});
});