test(toolbar): migrate to generators (#27389)

Issue number: N/A

---------

<!-- 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. -->

Toolbar tests are using legacy syntax

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

- Toolbar tests are using generator syntax


7ca8c57ed3

- The color behavior tests do not vary across directions, so I removed
the extra RTL checks.

## 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-05-04 12:39:29 -04:00
committed by GitHub
parent 54bf6040e6
commit 4b41b7f5a8
28 changed files with 31 additions and 24 deletions

View File

@ -1,12 +0,0 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
test.describe('toolbar: basic', () => {
test('should not have visual regressions', async ({ page }) => {
await page.goto(`/src/components/toolbar/test/basic`);
// capture both header toolbars at once, but don't include all the white space in the ion-content
const header = page.locator('ion-header');
await expect(header).toHaveScreenshot(`toolbar-basic-${page.getSnapshotSettings()}.png`);
});
});

View File

@ -0,0 +1,14 @@
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';
configs().forEach(({ title, screenshot, config }) => {
test.describe(title('toolbar: basic'), () => {
test('should not have visual regressions', async ({ page }) => {
await page.goto(`/src/components/toolbar/test/basic`, config);
// capture both header toolbars at once, but don't include all the white space in the ion-content
const header = page.locator('ion-header');
await expect(header).toHaveScreenshot(screenshot(`toolbar-basic`));
});
});
});

View File

@ -1,12 +0,0 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
test.describe('toolbar: colors', () => {
test('should not have visual regressions', async ({ page }) => {
await page.goto(`/src/components/toolbar/test/colors`);
await page.setIonViewport();
await expect(page).toHaveScreenshot(`toolbar-colors-${page.getSnapshotSettings()}.png`);
});
});

View File

@ -0,0 +1,17 @@
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';
/**
* This behavior does not vary across directions.
*/
configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
test.describe(title('toolbar: colors'), () => {
test('should not have visual regressions', async ({ page }) => {
await page.goto(`/src/components/toolbar/test/colors`, config);
await page.setIonViewport();
await expect(page).toHaveScreenshot(screenshot(`toolbar-colors`));
});
});
});