test(spinner): migrate to generators (#27377)

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

Spinner tests are using legacy syntax

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

- Spinner tests are using generator syntax


93e189af52

The color tests do not vary across directions, so I removed the extra
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-03 20:04:05 -04:00
committed by GitHub
parent 4cac4cf4a9
commit 99f6412b85
28 changed files with 37 additions and 30 deletions

View File

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

View File

@ -0,0 +1,17 @@
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';
configs().forEach(({ title, screenshot, config }) => {
test.describe(title('spinner: basic'), () => {
test.beforeEach(async ({ page }) => {
await page.goto('/src/components/spinner/test/basic', config);
});
test.describe('spinner: visual regression tests', () => {
test('should not have visual regressions', async ({ page }) => {
await page.setIonViewport();
await expect(page).toHaveScreenshot(screenshot(`spinner-basic-diff`));
});
});
});
});

View File

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

View File

@ -0,0 +1,20 @@
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('spinner: color'), () => {
test.beforeEach(async ({ page }) => {
await page.goto('/src/components/spinner/test/color', config);
});
test.describe('spinner: visual regression tests', () => {
test('should not have visual regressions', async ({ page }) => {
await page.setIonViewport();
await expect(page).toHaveScreenshot(screenshot(`spinner-color-diff`));
});
});
});
});