Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(pie-chip): DSW-2373 refactor pie-chip component/a11y tests to use @playwright/test #2137

Merged
merged 4 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions apps/pie-storybook/stories/testing/pie-chip.test.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,12 @@ const chipStoryMeta: ChipStoryMeta = {

export default chipStoryMeta;

const clickAction = action('clicked');
const closeAction = action('pie-chip-close');
const clickAction = () => {
console.log('pie-chip clicked');
}
const closeAction = () => {
console.log('pie-chip-close clicked');
}

const Template: TemplateFunction<ChipProps> = ({
aria,
Expand Down
6 changes: 3 additions & 3 deletions packages/components/pie-chip/playwright-lit.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from '@sand4rt/experimental-ct-web';
import { getPlaywrightConfig } from '@justeattakeaway/pie-components-config';
import { defineConfig } from '@playwright/test';
import { getPlaywrightNativeConfig } from '@justeattakeaway/pie-components-config';

export default defineConfig(getPlaywrightConfig());
export default defineConfig(getPlaywrightNativeConfig());
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import { test, expect } from '@justeattakeaway/pie-webc-testing/src/playwright/webc-fixtures.ts';
import { PieChip, type ChipProps } from '../../src/index.ts';
import { test, expect } from '@justeattakeaway/pie-webc-testing/src/playwright/playwright-fixtures.ts';
import { BasePage } from '@justeattakeaway/pie-webc-testing/src/helpers/page-object/base-page.ts';

test.describe('PieChip - Accessibility tests', () => {
test('a11y - should test the PieChip component WCAG compliance', async ({ makeAxeBuilder, mount }) => {
await mount(
PieChip,
{
props: {} as ChipProps,
slots: {
default: 'Label',
},
},
);
test('a11y - should test the PieChip component WCAG compliance', async ({ makeAxeBuilder, page }) => {
const pieChipPage = new BasePage(page, 'chip--default');
await pieChipPage.load();

const results = await makeAxeBuilder().analyze();

Expand Down
Loading
Loading