test(menu-button): migrate tests to playwright (#26174)

This commit is contained in:
Sean Perkins
2022-10-27 10:34:25 -04:00
committed by GitHub
parent b364d58710
commit c0f4381745
10 changed files with 33 additions and 21 deletions

View File

@ -1,11 +0,0 @@
import { AxePuppeteer } from '@axe-core/puppeteer';
import { newE2EPage } from '@stencil/core/testing';
test('menu-button: axe', async () => {
const page = await newE2EPage({
url: '/src/components/menu-button/test/a11y?ionic:_testing=true',
});
const results = await new AxePuppeteer(page).analyze();
expect(results.violations.length).toEqual(0);
});

View File

@ -0,0 +1,17 @@
import AxeBuilder from '@axe-core/playwright';
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
test.describe('menu-button: a11y', () => {
test.beforeEach(({ skip }) => {
skip.rtl();
});
test('should not have accessibility violations', async ({ page }) => {
await page.goto('/src/components/menu-button/test/a11y');
const results = await new AxeBuilder({ page }).analyze();
expect(results.violations).toEqual([]);
});
});

View File

@ -1,10 +0,0 @@
import { newE2EPage } from '@stencil/core/testing';
test('menu-button: basic', async () => {
const page = await newE2EPage({
url: '/src/components/menu-button/test/basic?ionic:_testing=true',
});
const compare = await page.compareScreenshot();
expect(compare).toMatchScreenshot();
});

View File

@ -0,0 +1,16 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
test.describe('menu-button: basic', () => {
test.beforeEach(({ skip }) => {
skip.rtl();
});
test('should not have visual regressions', async ({ page }) => {
await page.goto(`/src/components/menu-button/test/basic`);
await page.setIonViewport();
expect(await page.screenshot()).toMatchSnapshot(`menu-button-diff-${page.getSnapshotSettings()}.png`);
});
});