Merge remote-tracking branch 'origin/main' into chore/sync-with-main-5-3

This commit is contained in:
Sean Perkins
2023-05-03 13:38:03 -04:00
2722 changed files with 42605 additions and 10074 deletions

View File

@ -1,12 +1,14 @@
import AxeBuilder from '@axe-core/playwright';
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
import { configs, 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`);
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([]);
const results = await new AxeBuilder({ page }).analyze();
expect(results.violations).toEqual([]);
});
});
});

View File

@ -1,12 +1,14 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
import { configs, 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`);
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 page.setIonViewport();
await expect(page).toHaveScreenshot(`breadcrumb-diff-${page.getSnapshotSettings()}.png`);
await expect(page).toHaveScreenshot(screenshot(`breadcrumb-diff`));
});
});
});

View File

@ -1,12 +1,14 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
import { configs, 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`);
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 page.setIonViewport();
await expect(page).toHaveScreenshot(`breadcrumb-collapsed-diff-${page.getSnapshotSettings()}.png`);
await expect(page).toHaveScreenshot(screenshot(`breadcrumb-collapsed-diff`));
});
});
});

View File

@ -1,71 +1,70 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
import { configs, 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/);
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('should not have visual regressions', async ({ page }) => {
await page.setIonViewport();
test.describe('adding a breadcrumb item', () => {
test('should update the active item', async ({ page }) => {
const breadcrumbItems = page.locator('ion-breadcrumb');
const breadcrumbs = page.locator('ion-breadcrumbs');
const addItemButton = page.locator('ion-button#add-btn');
await page.click('#add-btn');
await page.waitForChanges();
await expect(breadcrumbItems).toHaveCount(4);
await expect(breadcrumbs).toHaveScreenshot(`breadcrumbs-reactive-add-diff-${page.getSnapshotSettings()}.png`);
});
});
await addItemButton.click();
await page.waitForChanges();
test.describe('removing a breadcrumb item', () => {
test('should update the active item', async ({ page }) => {
const breadcrumbItems = page.locator('ion-breadcrumb');
await expect(breadcrumbItems).toHaveCount(5);
await expect(breadcrumbItems).toHaveCount(4);
const previousActiveItem = breadcrumbItems.nth(3);
const lastBreadcrumbItem = breadcrumbItems.nth(4);
await page.click('#remove-btn');
await page.waitForChanges();
await expect(previousActiveItem).not.toHaveClass(/breadcrumb-active/);
await expect(lastBreadcrumbItem).toHaveClass(/breadcrumb-active/);
});
await expect(breadcrumbItems).toHaveCount(3);
test('should not have visual regressions', async ({ page }) => {
await page.setIonViewport();
const lastBreadcrumbItem = breadcrumbItems.nth(2);
const breadcrumbs = page.locator('ion-breadcrumbs');
await expect(lastBreadcrumbItem).toHaveClass(/breadcrumb-active/);
await page.click('#add-btn');
await page.waitForChanges();
await expect(breadcrumbs).toHaveScreenshot(screenshot(`breadcrumbs-reactive-add-diff`));
});
});
test('should not have visual regressions', async ({ page }) => {
await page.setIonViewport();
test.describe('removing a breadcrumb item', () => {
test('should update the active item', async ({ page }) => {
const breadcrumbItems = page.locator('ion-breadcrumb');
const breadcrumbs = page.locator('ion-breadcrumbs');
await expect(breadcrumbItems).toHaveCount(4);
await page.click('#remove-btn');
await page.waitForChanges();
await page.click('#remove-btn');
await page.waitForChanges();
await expect(breadcrumbs).toHaveScreenshot(`breadcrumbs-reactive-remove-diff-${page.getSnapshotSettings()}.png`);
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`));
});
});
});
});