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,19 +1,22 @@
import { test } from '@utils/test/playwright';
import { configs, test } from '@utils/test/playwright';
import { testPickerColumn } from '../test.utils';
test.describe('picker-column', () => {
test.describe('single column', () => {
test('should not have any visual regressions', async ({ page }) => {
await page.goto('/src/components/picker-column/test/standalone');
await testPickerColumn(page, '#single-column-button', 'single');
configs().forEach(({ title, screenshot, config }) => {
test.describe(title('picker-column'), () => {
test.beforeEach(async ({ page }) => {
await page.goto('/src/components/picker-column/test/standalone', config);
});
test.describe('single column', () => {
test('should not have any visual regressions', async ({ page }) => {
await testPickerColumn(page, screenshot, '#single-column-button', 'single');
});
});
});
test.describe('multiple columns', () => {
test('should not have any visual regressions', async ({ page }) => {
await page.goto('/src/components/picker-column/test/standalone');
await testPickerColumn(page, '#multiple-column-button', 'multiple');
test.describe('multiple columns', () => {
test('should not have any visual regressions', async ({ page }) => {
await testPickerColumn(page, screenshot, '#multiple-column-button', 'multiple');
});
});
});
});

View File

@ -1,13 +1,19 @@
import { expect } from '@playwright/test';
import type { E2EPage } from '@utils/test/playwright';
import type { E2EPage, ScreenshotFn } from '@utils/test/playwright';
/**
* Visual regression tests for picker-column.
* @param page - The page to run the tests on.
* @param screenshot - The screenshot function to generate unique screenshot names
* @param buttonSelector - The selector for the button that opens the picker.
* @param description - The description to amend to the screenshot names (typically 'single' or 'multiple').
*/
export async function testPickerColumn(page: E2EPage, buttonSelector: string, description: string) {
export async function testPickerColumn(
page: E2EPage,
screenshot: ScreenshotFn,
buttonSelector: string,
description: string
) {
const ionPickerDidPresentSpy = await page.spyOnEvent('ionPickerDidPresent');
await page.click(buttonSelector);
@ -15,7 +21,7 @@ export async function testPickerColumn(page: E2EPage, buttonSelector: string, de
await page.waitForChanges();
await expect(page).toHaveScreenshot(`picker-${description}-column-initial-${page.getSnapshotSettings()}.png`);
await expect(page).toHaveScreenshot(screenshot(`picker-${description}-column-initial`));
// TODO FW-3403
/*