test(breadcrumbs): migrate to generators (#27291)
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. --> - Breadcrumbs uses legacy test format ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Breadcrumbs uses 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. -->
@ -1,12 +0,0 @@
|
|||||||
import AxeBuilder from '@axe-core/playwright';
|
|
||||||
import { expect } from '@playwright/test';
|
|
||||||
import { test } from '@utils/test/playwright';
|
|
||||||
|
|
||||||
test.describe('breadcrumbs: axe', () => {
|
|
||||||
test('should not have accessibility violations', async ({ page }) => {
|
|
||||||
await page.goto(`/src/components/breadcrumbs/test/a11y`);
|
|
||||||
|
|
||||||
const results = await new AxeBuilder({ page }).analyze();
|
|
||||||
expect(results.violations).toEqual([]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
14
core/src/components/breadcrumbs/test/a11y/breadcrumbs.e2e.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import AxeBuilder from '@axe-core/playwright';
|
||||||
|
import { expect } from '@playwright/test';
|
||||||
|
import { configs, test } from '@utils/test/playwright';
|
||||||
|
|
||||||
|
configs().forEach(({ config, title }) => {
|
||||||
|
test.describe(title('breadcrumbs: axe'), () => {
|
||||||
|
test('should not have accessibility violations', async ({ page }) => {
|
||||||
|
await page.goto(`/src/components/breadcrumbs/test/a11y`, config);
|
||||||
|
|
||||||
|
const results = await new AxeBuilder({ page }).analyze();
|
||||||
|
expect(results.violations).toEqual([]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -1,12 +0,0 @@
|
|||||||
import { expect } from '@playwright/test';
|
|
||||||
import { test } from '@utils/test/playwright';
|
|
||||||
|
|
||||||
test.describe('breadcrumbs: basic', () => {
|
|
||||||
test('should not have visual regressions', async ({ page }) => {
|
|
||||||
await page.goto(`/src/components/breadcrumbs/test/basic`);
|
|
||||||
|
|
||||||
await page.setIonViewport();
|
|
||||||
|
|
||||||
await expect(page).toHaveScreenshot(`breadcrumb-diff-${page.getSnapshotSettings()}.png`);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
import { expect } from '@playwright/test';
|
||||||
|
import { configs, test } from '@utils/test/playwright';
|
||||||
|
|
||||||
|
configs().forEach(({ config, screenshot, title }) => {
|
||||||
|
test.describe(title('breadcrumbs: basic'), () => {
|
||||||
|
test('should not have visual regressions', async ({ page }) => {
|
||||||
|
await page.goto(`/src/components/breadcrumbs/test/basic`, config);
|
||||||
|
|
||||||
|
await page.setIonViewport();
|
||||||
|
|
||||||
|
await expect(page).toHaveScreenshot(screenshot(`breadcrumb-diff`));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Before Width: | Height: | Size: 144 KiB After Width: | Height: | Size: 144 KiB |
|
Before Width: | Height: | Size: 183 KiB After Width: | Height: | Size: 183 KiB |
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 134 KiB |
|
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 143 KiB |
|
Before Width: | Height: | Size: 183 KiB After Width: | Height: | Size: 183 KiB |
|
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 135 KiB |
|
Before Width: | Height: | Size: 141 KiB After Width: | Height: | Size: 141 KiB |
|
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 182 KiB |
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 184 KiB After Width: | Height: | Size: 184 KiB |
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 122 KiB |
@ -1,12 +0,0 @@
|
|||||||
import { expect } from '@playwright/test';
|
|
||||||
import { test } from '@utils/test/playwright';
|
|
||||||
|
|
||||||
test.describe('breadcrumbs: collapsed', () => {
|
|
||||||
test('should not have visual regressions', async ({ page }) => {
|
|
||||||
await page.goto(`/src/components/breadcrumbs/test/collapsed`);
|
|
||||||
|
|
||||||
await page.setIonViewport();
|
|
||||||
|
|
||||||
await expect(page).toHaveScreenshot(`breadcrumb-collapsed-diff-${page.getSnapshotSettings()}.png`);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
import { expect } from '@playwright/test';
|
||||||
|
import { configs, test } from '@utils/test/playwright';
|
||||||
|
|
||||||
|
configs().forEach(({ config, screenshot, title }) => {
|
||||||
|
test.describe(title('breadcrumbs: collapsed'), () => {
|
||||||
|
test('should not have visual regressions', async ({ page }) => {
|
||||||
|
await page.goto(`/src/components/breadcrumbs/test/collapsed`, config);
|
||||||
|
|
||||||
|
await page.setIonViewport();
|
||||||
|
|
||||||
|
await expect(page).toHaveScreenshot(screenshot(`breadcrumb-collapsed-diff`));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 99 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 99 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 98 KiB |
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 98 KiB |
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 65 KiB |
@ -1,71 +0,0 @@
|
|||||||
import { expect } from '@playwright/test';
|
|
||||||
import { test } from '@utils/test/playwright';
|
|
||||||
|
|
||||||
test.describe('breadcrumbs: reactive', () => {
|
|
||||||
test.beforeEach(async ({ page, skip }) => {
|
|
||||||
skip.rtl();
|
|
||||||
skip.mode('ios');
|
|
||||||
|
|
||||||
await page.goto(`/src/components/breadcrumbs/test/reactive`);
|
|
||||||
});
|
|
||||||
|
|
||||||
test.describe('adding a breadcrumb item', () => {
|
|
||||||
test('should update the active item', async ({ page }) => {
|
|
||||||
const breadcrumbItems = page.locator('ion-breadcrumb');
|
|
||||||
|
|
||||||
const addItemButton = page.locator('ion-button#add-btn');
|
|
||||||
|
|
||||||
await expect(breadcrumbItems).toHaveCount(4);
|
|
||||||
|
|
||||||
await addItemButton.click();
|
|
||||||
await page.waitForChanges();
|
|
||||||
|
|
||||||
await expect(breadcrumbItems).toHaveCount(5);
|
|
||||||
|
|
||||||
const previousActiveItem = breadcrumbItems.nth(3);
|
|
||||||
const lastBreadcrumbItem = breadcrumbItems.nth(4);
|
|
||||||
|
|
||||||
await expect(previousActiveItem).not.toHaveClass(/breadcrumb-active/);
|
|
||||||
await expect(lastBreadcrumbItem).toHaveClass(/breadcrumb-active/);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should not have visual regressions', async ({ page }) => {
|
|
||||||
await page.setIonViewport();
|
|
||||||
|
|
||||||
const breadcrumbs = page.locator('ion-breadcrumbs');
|
|
||||||
|
|
||||||
await page.click('#add-btn');
|
|
||||||
await page.waitForChanges();
|
|
||||||
|
|
||||||
await expect(breadcrumbs).toHaveScreenshot(`breadcrumbs-reactive-add-diff-${page.getSnapshotSettings()}.png`);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test.describe('removing a breadcrumb item', () => {
|
|
||||||
test('should update the active item', async ({ page }) => {
|
|
||||||
const breadcrumbItems = page.locator('ion-breadcrumb');
|
|
||||||
|
|
||||||
await expect(breadcrumbItems).toHaveCount(4);
|
|
||||||
|
|
||||||
await page.click('#remove-btn');
|
|
||||||
await page.waitForChanges();
|
|
||||||
|
|
||||||
await expect(breadcrumbItems).toHaveCount(3);
|
|
||||||
|
|
||||||
const lastBreadcrumbItem = breadcrumbItems.nth(2);
|
|
||||||
|
|
||||||
await expect(lastBreadcrumbItem).toHaveClass(/breadcrumb-active/);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should not have visual regressions', async ({ page }) => {
|
|
||||||
await page.setIonViewport();
|
|
||||||
|
|
||||||
const breadcrumbs = page.locator('ion-breadcrumbs');
|
|
||||||
|
|
||||||
await page.click('#remove-btn');
|
|
||||||
await page.waitForChanges();
|
|
||||||
|
|
||||||
await expect(breadcrumbs).toHaveScreenshot(`breadcrumbs-reactive-remove-diff-${page.getSnapshotSettings()}.png`);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
import { expect } from '@playwright/test';
|
||||||
|
import { configs, test } from '@utils/test/playwright';
|
||||||
|
|
||||||
|
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ config, screenshot, title }) => {
|
||||||
|
test.describe(title('breadcrumbs: reactive'), () => {
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
await page.goto(`/src/components/breadcrumbs/test/reactive`, config);
|
||||||
|
});
|
||||||
|
|
||||||
|
test.describe('adding a breadcrumb item', () => {
|
||||||
|
test('should update the active item', async ({ page }) => {
|
||||||
|
const breadcrumbItems = page.locator('ion-breadcrumb');
|
||||||
|
|
||||||
|
const addItemButton = page.locator('ion-button#add-btn');
|
||||||
|
|
||||||
|
await expect(breadcrumbItems).toHaveCount(4);
|
||||||
|
|
||||||
|
await addItemButton.click();
|
||||||
|
await page.waitForChanges();
|
||||||
|
|
||||||
|
await expect(breadcrumbItems).toHaveCount(5);
|
||||||
|
|
||||||
|
const previousActiveItem = breadcrumbItems.nth(3);
|
||||||
|
const lastBreadcrumbItem = breadcrumbItems.nth(4);
|
||||||
|
|
||||||
|
await expect(previousActiveItem).not.toHaveClass(/breadcrumb-active/);
|
||||||
|
await expect(lastBreadcrumbItem).toHaveClass(/breadcrumb-active/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should not have visual regressions', async ({ page }) => {
|
||||||
|
await page.setIonViewport();
|
||||||
|
|
||||||
|
const breadcrumbs = page.locator('ion-breadcrumbs');
|
||||||
|
|
||||||
|
await page.click('#add-btn');
|
||||||
|
await page.waitForChanges();
|
||||||
|
|
||||||
|
await expect(breadcrumbs).toHaveScreenshot(screenshot(`breadcrumbs-reactive-add-diff`));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test.describe('removing a breadcrumb item', () => {
|
||||||
|
test('should update the active item', async ({ page }) => {
|
||||||
|
const breadcrumbItems = page.locator('ion-breadcrumb');
|
||||||
|
|
||||||
|
await expect(breadcrumbItems).toHaveCount(4);
|
||||||
|
|
||||||
|
await page.click('#remove-btn');
|
||||||
|
await page.waitForChanges();
|
||||||
|
|
||||||
|
await expect(breadcrumbItems).toHaveCount(3);
|
||||||
|
|
||||||
|
const lastBreadcrumbItem = breadcrumbItems.nth(2);
|
||||||
|
|
||||||
|
await expect(lastBreadcrumbItem).toHaveClass(/breadcrumb-active/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should not have visual regressions', async ({ page }) => {
|
||||||
|
await page.setIonViewport();
|
||||||
|
|
||||||
|
const breadcrumbs = page.locator('ion-breadcrumbs');
|
||||||
|
|
||||||
|
await page.click('#remove-btn');
|
||||||
|
await page.waitForChanges();
|
||||||
|
|
||||||
|
await expect(breadcrumbs).toHaveScreenshot(screenshot(`breadcrumbs-reactive-remove-diff`));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |