Skip to content

Commit

Permalink
test(e2e): add proper tags to avt tests (#14915)
Browse files Browse the repository at this point in the history
      * test(e2e): add proper tags to avt tests

* ci(avt): shard avt tests

* fix: typo

* test(config): increase playwright expect timeout

* test(playwright): increase timeout config

* test(progressindicator): update to use proper tags

* test(progressindicator): correct focus order

---------

Co-authored-by: Andrea N. Cardona <[email protected]>
Co-authored-by: Alison Joseph <[email protected]>
Co-authored-by: TJ Egan <[email protected]>
  • Loading branch information
4 people authored Nov 8, 2023
1 parent 5b6ba55 commit 5f4f2ad
Show file tree
Hide file tree
Showing 75 changed files with 773 additions and 724 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ jobs:
if: ${{ needs.vrt-runner.result != 'success' }}
run: exit 1

avt:
avt-runner:
strategy:
matrix:
shard: [1, 2, 3, 4]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
Expand Down Expand Up @@ -210,15 +213,15 @@ jobs:
run: |
npx serve -l 3000 packages/react/storybook-static &
pid=$!
echo ::set-output name=pid::"$pid"
echo "pid=$pid" >> $GITHUB_OUTPUT
- uses: ./actions/wait-for-it
with:
URL: 'http://localhost:3000'
timeout-minutes: 3
- name: Run AVT
if: github.repository == 'carbon-design-system/carbon'
run: |
yarn playwright test --project chromium --grep @avt
yarn playwright test --project chromium --grep @avt --shard="${{ matrix.shard }}/4"
- name: Stop storybook
run: kill ${{ steps.storybook.outputs.pid }}
- name: Upload test results
Expand All @@ -227,3 +230,12 @@ jobs:
with:
name: playwright-avt-report
path: .playwright

avt:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: avt-runner
steps:
- name: Check AVT Runner job status
if: ${{ needs.avt-runner.result != 'success' }}
run: exit 1
180 changes: 0 additions & 180 deletions README.md

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions e2e/components/AspectRatio/AspectRatio-test.avt.e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Copyright IBM Corp. 2016, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

const { expect, test } = require('@playwright/test');
const { visitStory } = require('../../test-utils/storybook');

test.describe('AspectRatio @avt', () => {
test('@avt-default-state', async ({ page }) => {
await visitStory(page, {
component: 'AspectRatio',
id: 'components-aspectratio--default',
globals: {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations('AspectRatio @avt-default-state');
});
});
15 changes: 2 additions & 13 deletions e2e/components/AspectRatio/AspectRatio-test.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

'use strict';

const { expect, test } = require('@playwright/test');
const { test } = require('@playwright/test');
const { themes } = require('../../test-utils/env');
const { snapshotStory, visitStory } = require('../../test-utils/storybook');
const { snapshotStory } = require('../../test-utils/storybook');

test.describe('AspectRatio', () => {
themes.forEach((theme) => {
Expand All @@ -23,15 +23,4 @@ test.describe('AspectRatio', () => {
});
});
});

test('accessibility-checker @avt', async ({ page }) => {
await visitStory(page, {
component: 'AspectRatio',
id: 'components-aspectratio--default',
globals: {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations('AspectRatio');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test.describe('breadcrumb @avt', () => {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations('Breadcrumb');
await expect(page).toHaveNoACViolations('Breadcrumb-default-state');
});

test('@avt-advanced-states with overflow menu', async ({ page }) => {
Expand Down
24 changes: 12 additions & 12 deletions e2e/components/Button/Button-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const { expect, test } = require('@playwright/test');
const { visitStory } = require('../../test-utils/storybook');

test.describe('Button @avt', () => {
test('accessibility-checker', async ({ page }) => {
test('@avt-default-state', async ({ page }) => {
await visitStory(page, {
component: 'Button',
id: 'components-button--default',
Expand All @@ -22,7 +22,7 @@ test.describe('Button @avt', () => {
await expect(page).toHaveNoACViolations('Button');
});

test('accessibility-checker button danger', async ({ page }) => {
test('@avt-advanced-states danger', async ({ page }) => {
await visitStory(page, {
component: 'Button',
id: 'components-button--danger',
Expand All @@ -33,7 +33,7 @@ test.describe('Button @avt', () => {
await expect(page).toHaveNoACViolations('Button-danger');
});

test('accessibility-checker button ghost', async ({ page }) => {
test('@avt-advanced-states ghost', async ({ page }) => {
await visitStory(page, {
component: 'Button',
id: 'components-button--ghost',
Expand All @@ -44,7 +44,7 @@ test.describe('Button @avt', () => {
await expect(page).toHaveNoACViolations('Button-ghost');
});

test('accessibility-checker button icon-button', async ({ page }) => {
test('@avt-advanced-states icon-button', async ({ page }) => {
await visitStory(page, {
component: 'Button',
id: 'components-button--icon-button',
Expand All @@ -55,7 +55,7 @@ test.describe('Button @avt', () => {
await expect(page).toHaveNoACViolations('Button-icon-button');
});

test('accessibility-checker button secondary', async ({ page }) => {
test('@avt-advanced-states secondary', async ({ page }) => {
await visitStory(page, {
component: 'Button',
id: 'components-button--secondary',
Expand All @@ -66,7 +66,7 @@ test.describe('Button @avt', () => {
await expect(page).toHaveNoACViolations('Button-secondary');
});

test('accessibility-checker button set-of-buttons', async ({ page }) => {
test('@avt-advanced-states set-of-buttons', async ({ page }) => {
await visitStory(page, {
component: 'Button',
id: 'components-button--set-of-buttons',
Expand All @@ -77,7 +77,7 @@ test.describe('Button @avt', () => {
await expect(page).toHaveNoACViolations('Button-set-of-buttons');
});

test('accessibility-checker button skeleton', async ({ page }) => {
test('@avt-advanced-states skeleton', async ({ page }) => {
await visitStory(page, {
component: 'Button',
id: 'components-button--skeleton',
Expand All @@ -88,7 +88,7 @@ test.describe('Button @avt', () => {
await expect(page).toHaveNoACViolations('Button-skeleton');
});

test('accessibility-checker button tertiary', async ({ page }) => {
test('@avt-advanced-states tertiary', async ({ page }) => {
await visitStory(page, {
component: 'Button',
id: 'components-button--tertiary',
Expand All @@ -99,7 +99,7 @@ test.describe('Button @avt', () => {
await expect(page).toHaveNoACViolations('Button-tertiary');
});

test('accessibility-checker disabled button', async ({ page }) => {
test('@avt-advanced-states disabled', async ({ page }) => {
await visitStory(page, {
component: 'Button',
id: 'components-button--default',
Expand All @@ -115,7 +115,7 @@ test.describe('Button @avt', () => {
await expect(page).toHaveNoACViolations('Button-disabled');
});

test('accessibility-checker keyboard interaction', async ({ page }) => {
test('@avt-keyboard-nav', async ({ page }) => {
await visitStory(page, {
component: 'Button',
id: 'components-button--default',
Expand All @@ -128,7 +128,7 @@ test.describe('Button @avt', () => {
await expect(page.getByRole('button')).toBeFocused();
});

test('accessibility-checker mouse interaction', async ({ page }) => {
test('@avt-advanced-states mouse interaction', async ({ page }) => {
await visitStory(page, {
component: 'Button',
id: 'components-button--default',
Expand All @@ -141,7 +141,7 @@ test.describe('Button @avt', () => {
await expect(page.getByRole('button')).toBeFocused();
});

test('accessibility-checker hover state', async ({ page }) => {
test('@avt-advanced-states hover state', async ({ page }) => {
await visitStory(page, {
component: 'Button',
id: 'components-button--default',
Expand Down
24 changes: 24 additions & 0 deletions e2e/components/ClassPrefix/ClassPrefix-test.avt.e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Copyright IBM Corp. 2016, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

const { expect, test } = require('@playwright/test');
const { visitStory } = require('../../test-utils/storybook');

test.describe('ClassPrefix @avt', () => {
test('@avt-default-state', async ({ page }) => {
await visitStory(page, {
component: 'ClassPrefix',
id: 'components-classprefix--default',
globals: {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations('ClassPrefix @avt-default-state');
});
});
15 changes: 2 additions & 13 deletions e2e/components/ClassPrefix/ClassPrefix-test.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*/

'use strict';
const { expect, test } = require('@playwright/test');
const { test } = require('@playwright/test');
const { themes } = require('../../test-utils/env');
const { snapshotStory, visitStory } = require('../../test-utils/storybook');
const { snapshotStory } = require('../../test-utils/storybook');

test.describe('ClassPrefix', () => {
themes.forEach((theme) => {
Expand All @@ -22,15 +22,4 @@ test.describe('ClassPrefix', () => {
});
});
});

test('accessibility-checker @avt', async ({ page }) => {
await visitStory(page, {
component: 'ClassPrefix',
id: 'components-classprefix--default',
globals: {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations('ClassPrefix');
});
});
31 changes: 10 additions & 21 deletions e2e/components/CodeSnippet/CodeSnippet-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const { expect, test } = require('@playwright/test');
const { visitStory } = require('../../test-utils/storybook');

test.describe('CodeSnippet @avt', () => {
test('accessibility-checker CodeSnippet inline', async ({ page }) => {
test('@avt-default-state inline', async ({ page }) => {
await visitStory(page, {
component: 'CodeSnippet',
id: 'components-codesnippet--inline',
Expand All @@ -22,9 +22,7 @@ test.describe('CodeSnippet @avt', () => {
await expect(page).toHaveNoACViolations('CodeSnippet inline');
});

test('accessibility-checker CodeSnippet inline hover @avt', async ({
page,
}) => {
test('@avt-advanced-states inline hover', async ({ page }) => {
await visitStory(page, {
component: 'CodeSnippet',
id: 'components-codesnippet--inline',
Expand All @@ -38,9 +36,7 @@ test.describe('CodeSnippet @avt', () => {
await expect(page).toHaveNoACViolations('CodeSnippet inline hover');
});

test('accessibility-checker CodeSnippet inline focused @avt', async ({
page,
}) => {
test('@avt-advanced-states inline focused', async ({ page }) => {
await visitStory(page, {
component: 'CodeSnippet',
id: 'components-codesnippet--inline',
Expand All @@ -54,7 +50,8 @@ test.describe('CodeSnippet @avt', () => {
await expect(page).toHaveNoACViolations('CodeSnippet inline focused');
});

test('accessibility-checker CodeSnippet multiline @avt', async ({ page }) => {
// Skipping due to a11y violation issue #14237
test.skip('@avt-default-state multiline', async ({ page }) => {
await visitStory(page, {
component: 'CodeSnippet',
id: 'components-codesnippet--multiline',
Expand All @@ -65,9 +62,7 @@ test.describe('CodeSnippet @avt', () => {
await expect(page).toHaveNoACViolations('CodeSnippet multiline');
});

test('accessibility-checker CodeSnippet singleline @avt', async ({
page,
}) => {
test('@avt-default-state singleline', async ({ page }) => {
await visitStory(page, {
component: 'CodeSnippet',
id: 'components-codesnippet--singleline',
Expand All @@ -78,7 +73,7 @@ test.describe('CodeSnippet @avt', () => {
await expect(page).toHaveNoACViolations('CodeSnippet singleline');
});

test('accessibility-checker CodeSnippet skeleton @avt', async ({ page }) => {
test('@avt-advanced-states skeleton', async ({ page }) => {
await visitStory(page, {
component: 'CodeSnippet',
id: 'components-codesnippet--skeleton',
Expand All @@ -89,9 +84,7 @@ test.describe('CodeSnippet @avt', () => {
await expect(page).toHaveNoACViolations('CodeSnippet skeleton');
});

test('accessibility-checker CodeSnippet inline keyboard nav', async ({
page,
}) => {
test('inline @avt-keyboard-nav', async ({ page }) => {
await visitStory(page, {
component: 'CodeSnippet',
id: 'components-codesnippet--inline',
Expand All @@ -110,9 +103,7 @@ test.describe('CodeSnippet @avt', () => {
await expect(page.getByRole('tooltip')).toHaveText('Copied to clipboard');
});

test('accessibility-checker CodeSnippet multiline keyboard nav', async ({
page,
}) => {
test('multiline @avt-keyboard-nav', async ({ page }) => {
await visitStory(page, {
component: 'CodeSnippet',
id: 'components-codesnippet--multiline',
Expand All @@ -139,9 +130,7 @@ test.describe('CodeSnippet @avt', () => {
await expect(page.getByText('Show more')).not.toBeVisible();
});

test('accessibility-checker CodeSnippet singleline keyboard nav', async ({
page,
}) => {
test('singleline @avt-keyboard-nav', async ({ page }) => {
await visitStory(page, {
component: 'CodeSnippet',
id: 'components-codesnippet--singleline',
Expand Down
6 changes: 3 additions & 3 deletions e2e/components/ComboBox/ComboBox-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const { expect, test } = require('@playwright/test');
const { visitStory } = require('../../test-utils/storybook');

test.describe('ComboBox @avt', () => {
test('accessibility-checker combobox', async ({ page }) => {
test('@avt-default-state', async ({ page }) => {
await visitStory(page, {
component: 'ComboBox',
id: 'components-combobox--default',
Expand All @@ -23,7 +23,7 @@ test.describe('ComboBox @avt', () => {
});

// Skipping now due to AVT violation, possible false positive
test.skip('accessibility-checker open combobox', async ({ page }) => {
test.skip('@avt-advanced-states open', async ({ page }) => {
await visitStory(page, {
component: 'ComboBox',
id: 'components-combobox--default',
Expand All @@ -44,7 +44,7 @@ test.describe('ComboBox @avt', () => {
await expect(page).toHaveNoACViolations('ComboBox-open');
});

test('combobox - keyboard nav', async ({ page }) => {
test('@avt-keyboard-nav', async ({ page }) => {
await visitStory(page, {
component: 'ComboBox',
id: 'components-combobox--default',
Expand Down
Loading

0 comments on commit 5f4f2ad

Please sign in to comment.