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(e2e): add toContainAStory assertion to visitStory(new) #16582

Merged
merged 22 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ae17b68
test(playwright): add toContainAStory assertion to visitStory
tay1orjones Apr 4, 2024
b703477
fix: datatable, errorboundary, modal
tay1orjones Apr 4, 2024
a69d9da
Merge branch 'main' into playwright-fail-storybook-errors
tay1orjones May 24, 2024
1622d82
fix: renamed story urls for textinput, tag and uishell
Gururajj77 May 27, 2024
8a926b5
Merge branch 'main' into storybook-issue
guidari May 28, 2024
ffc198c
fix: fixed fluid datepicker test and skipped datatable
Gururajj77 May 29, 2024
e358dfa
Merge branch 'main' into storybook-issue
guidari Jun 11, 2024
e53c392
fix: changed playwright config
Gururajj77 Jul 25, 2024
d759bc4
Merge branch 'main' into storybook-issue
tay1orjones Jul 25, 2024
e09853c
feat: removed commented test
Gururajj77 Aug 8, 2024
a03b493
Merge branch 'main' into storybook-issue
Gururajj77 Aug 8, 2024
c19acf7
Merge branch 'main' into storybook-issue
Gururajj77 Aug 9, 2024
dddd873
Merge branch 'main' into storybook-issue
Gururajj77 Aug 14, 2024
be919bd
Merge branch 'main' into storybook-issue
tay1orjones Aug 21, 2024
4e65e4e
fix(playwright): re-enable tests
tay1orjones Aug 21, 2024
d8ebc5c
Merge branch 'main' into storybook-issue
tay1orjones Aug 22, 2024
6087352
test(playwright): fix flaky tests, update playwright, improve ci arti…
tay1orjones Aug 23, 2024
62f2eff
test(datepicker): fix flaky tests
tay1orjones Aug 23, 2024
52ef989
chore: yarn dedupe
tay1orjones Aug 23, 2024
7576b3c
Merge branch 'main' into storybook-issue
Gururajj77 Aug 23, 2024
6d556b7
test(ci): fix playwright merge reports, flaky menu test
tay1orjones Aug 23, 2024
6056e1d
Merge branch 'main' into storybook-issue
tay1orjones Aug 23, 2024
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
115 changes: 96 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ jobs:
path: |
node_modules
*/**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', 'packages/**/yarn.lock') }}
key:
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock',
'packages/**/yarn.lock') }}
- name: Install dependencies
run: yarn install --immutable --immutable-cache
- name: Build project
Expand All @@ -95,7 +97,9 @@ jobs:
path: |
node_modules
*/**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', 'packages/**/yarn.lock') }}
key:
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock',
'packages/**/yarn.lock') }}
- name: Install dependencies
run: yarn install --immutable --immutable-cache
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
Expand All @@ -119,8 +123,10 @@ jobs:

vrt-runner:
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
shardIndex: [1, 2, 3, 4]
shardTotal: [4]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
Expand All @@ -135,7 +141,9 @@ jobs:
path: |
node_modules
*/**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', 'packages/**/yarn.lock') }}
key:
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock',
'packages/**/yarn.lock') }}
- name: Install dependencies
run: yarn install --immutable --immutable-cache
- name: Install browsers
Expand All @@ -161,15 +169,16 @@ jobs:
PERCY_TOKEN: c9a21a3fde4fda0a0f822d633426ab26e2ab2c1cba55221d342d4047744c8c24
PERCY_PARALLEL_TOTAL: 4
run: |
yarn percy exec --parallel -- yarn playwright test --project chromium --grep @vrt --shard="${{ matrix.shard }}/4"
yarn percy exec --parallel -- yarn playwright test --project chromium --grep @vrt --shard="${{ matrix.shardIndex }}/${{ matrix.shardTotal }}"
- name: Stop storybook
run: kill ${{ steps.storybook.outputs.pid }}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
- name: Upload blob report to GitHub Actions Artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a #4.3.6
with:
name: playwright-vrt-report
path: .playwright
name: playwright-vrt-blob-report-${{ matrix.shardIndex }}
path: playwright-vrt-blob-report
retention-days: 1

vrt:
if: ${{ always() }}
Expand All @@ -182,8 +191,10 @@ jobs:

avt-runner:
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
shardIndex: [1, 2, 3, 4]
shardTotal: [4]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
Expand All @@ -198,7 +209,9 @@ jobs:
path: |
node_modules
*/**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', 'packages/**/yarn.lock') }}
key:
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock',
'packages/**/yarn.lock') }}
- name: Install dependencies
run: yarn install --immutable --immutable-cache
- name: Install browsers
Expand All @@ -221,15 +234,16 @@ jobs:
- name: Run AVT
if: github.repository == 'carbon-design-system/carbon'
run: |
yarn playwright test --project chromium --grep @avt --shard="${{ matrix.shard }}/4"
yarn playwright test --project chromium --grep @avt --shard="${{ matrix.shardIndex }}/${{ matrix.shardTotal }}"
- name: Stop storybook
run: kill ${{ steps.storybook.outputs.pid }}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
- name: Upload blob report to GitHub Actions Artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a #4.3.6
with:
name: playwright-avt-report
path: .playwright
name: playwright-avt-blob-report-${{ matrix.shardIndex }}
path: playwright-avt-blob-report
retention-days: 1

avt:
if: ${{ always() }}
Expand All @@ -238,4 +252,67 @@ jobs:
steps:
- name: Check AVT Runner job status
if: ${{ needs.avt-runner.result != 'success' }}
run: exit 1
run: exit 1

merge-playwright-reports:
# Merge reports after *-runner jobs, even if some shards have failed
if: ${{ !cancelled() }}
needs: [vrt-runner, avt-runner]

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Use Node.js 20.x
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b #v4.0.3
with:
node-version: '20.x'
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 #v4.0.2
if: github.event_name != 'merge_group'
id: cache
with:
path: |
node_modules
*/**/node_modules
key:
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock',
'packages/**/yarn.lock') }}
- name: Install dependencies
run: yarn install --immutable --immutable-cache

- name: Download vrt blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
path: all-playwright-vrt-blob-reports
pattern: playwright-vrt-blob-report-*
merge-multiple: true

- name: Merge vrt reports into HTML Report
run:
npx playwright merge-reports --reporter html
./all-playwright-vrt-blob-reports

- name: Upload vrt HTML report
uses: actions/upload-artifact@v4
with:
name: html-playwright-vrt-report--attempt-${{ github.run_attempt }}
path: playwright-vrt-report
retention-days: 14

- name: Download avt blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
path: all-playwright-avt-blob-reports
pattern: playwright-avt-blob-report-*
merge-multiple: true

- name: Merge avt reports into HTML Report
run:
npx playwright merge-reports --reporter html
./all-playwright-avt-blob-reports

- name: Upload avt HTML report
uses: actions/upload-artifact@v4
with:
name: html-playwright-avt-report--attempt-${{ github.run_attempt }}
path: playwright-avt-report
retention-days: 14
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
run: kill ${{ steps.storybook.outputs.pid }}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a #4.3.6
with:
name: playwright-avt-report
path: .playwright
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion e2e/components/Button/Button-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ test.describe('@avt Button', () => {
},
});
await expect(page.getByRole('button')).toBeVisible();
page.getByRole('button').hover();
await page.getByRole('button').hover();

await expect(page).toHaveNoACViolations('Button-hover');
});
Expand Down
2 changes: 1 addition & 1 deletion e2e/components/CodeSnippet/CodeSnippet-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test.describe('@avt CodeSnippet', () => {
});

await expect(page.getByRole('button')).toBeVisible();
page.getByRole('button').hover();
await page.getByRole('button').hover();
await expect(page).toHaveNoACViolations('CodeSnippet inline hover');
});

Expand Down
9 changes: 6 additions & 3 deletions e2e/components/DataTable/DataTable-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,16 +276,19 @@ test.describe('@avt DataTable', () => {
'components-datatable-selection--default'
);
});
test('@avt-advanced-states with-radio-expansion', async ({ page }) => {
test.skip('@avt-advanced-states with-radio-expansion', async ({ page }) => {
tay1orjones marked this conversation as resolved.
Show resolved Hide resolved
await visitStory(page, {
component: 'DataTable',
id: 'components-datatable-selection--with-radio-expansion',
id: 'components-datatable-dynamic--playground',
globals: {
theme: 'white',
},
args: {
radio: true,
},
});
await expect(page).toHaveNoACViolations(
'components-datatable-selection--with-radio-expansion'
'components-datatable-with-radio-expansion'
);
});
test('@avt-advanced-states with-selection-and-sorting', async ({
Expand Down
32 changes: 22 additions & 10 deletions e2e/components/DatePicker/DatePicker-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ test.describe('@avt DatePicker', () => {
await expect(page).toHaveNoACViolations('DatePicker-Disabled');
});

// skipping for now due to accessibility violation
test('@avt-advanced-states skeleton', async ({ page }) => {
await visitStory(page, {
component: 'DatePicker',
Expand All @@ -62,8 +61,8 @@ test.describe('@avt DatePicker', () => {
await expect(page).toHaveNoACViolations('DatePicker-Skeleton');
});

// skipping for now due to accessibility violation
test('@avt-advanced-states open', async ({ page }) => {
// skipped due to text contrast accessibility violation
test.skip('@avt-advanced-states open', async ({ page }) => {
await visitStory(page, {
component: 'DatePicker',
id: 'components-datepicker--playground',
Expand Down Expand Up @@ -92,13 +91,26 @@ test.describe('@avt DatePicker', () => {
await expect(
page.getByRole('textbox', { name: 'Date Picker label' })
).toBeFocused();
await expect(page.locator('div.flatpickr-calendar')).toHaveClass(/open/);
await page.keyboard.press('ArrowDown');
await expect(page.locator('span.today')).toBeFocused();
await page.keyboard.press('Escape');
await expect(page.locator('div.flatpickr-calendar')).not.toHaveClass(
/open/
);
const calendar = await page.locator('div.flatpickr-calendar');
await expect(calendar).toHaveClass(/open/);

// avoid flaky test failures from the keyboard press happening too quickly
// this retries the keypress along with the focus assertion until it passes
await expect(async () => {
await page.keyboard.press('ArrowDown');
const today = await page.locator('span.today');
await expect(today).toBeVisible();
await expect(today).toBeFocused();
}).toPass();

// avoid flaky test failures from the keyboard press happening too quickly
// this retries the keypress along with the focus assertion until it passes
await expect(async () => {
await page.keyboard.press('Escape');
await expect(page.locator('div.flatpickr-calendar')).not.toHaveClass(
/open/
);
}).toPass();
});

test('@avt-keyboard-nav range state', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test.describe('@avt ErrorBoundary', () => {
test('@avt-advanced-states with Custom context', async ({ page }) => {
await visitStory(page, {
component: 'ErrorBoundary',
id: 'components-errorboundary--skeleton',
id: 'components-errorboundary--with-custom-context',
globals: {
theme: 'white',
},
Expand Down
31 changes: 23 additions & 8 deletions e2e/components/FluidDatePicker/FluidDatePicker-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,29 @@ test.describe('@avt FluidDatePicker', () => {
});
// for some reason the firs tab is not working to focus the first tabstop, so focusing manually
await page.getByRole('textbox', { name: 'Label' }).focus();
await expect(page.getByRole('textbox', { name: 'Label' })).toBeFocused();
await expect(page.locator('div.flatpickr-calendar')).toHaveClass(/open/);
await page.keyboard.press('ArrowDown');
await expect(page.locator('span.today')).toBeFocused();
await page.keyboard.press('Escape');
await expect(page.locator('div.flatpickr-calendar')).not.toHaveClass(
/open/
);
const textbox = await page.getByRole('textbox', { name: 'Label' });
await expect(textbox).toBeFocused();
const calendar = await page.locator('div.flatpickr-calendar');
await expect(calendar).toHaveClass(/open/);
await expect(calendar).toBeVisible();

const today = await page.locator('.flatpickr-day.today');

// avoid flaky test failures from the keyboard press happening too quickly
// this retries the keypress along with the focus assertion until it passes
await expect(async () => {
await page.keyboard.press('ArrowDown');
await expect(today).toBeVisible();
await expect(today).toBeFocused();
}).toPass();

// avoid flaky test failures from the keyboard press happening too quickly
// this retries the keypress along with the focus assertion until it passes
await expect(async () => {
await page.keyboard.press('Escape');
await expect(calendar).not.toHaveClass(/open/);
await expect(calendar).toBeHidden();
}).toPass();
});

test('@avt-keyboard-nav range', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test.describe('@avt FluidTextInput', () => {
test('@avt-advanced-states password input', async ({ page }) => {
await visitStory(page, {
component: 'FluidTextInput',
id: 'experimental-fluid-components-unstable-fluidtextinput--password-input',
id: 'experimental-fluid-components-unstable-fluidpasswordinput--default',
globals: {
theme: 'white',
},
Expand Down
4 changes: 2 additions & 2 deletions e2e/components/FluidTextInput/FluidTextInput-test.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ test.describe('FluidTextInput', () => {
});

await snapshotStory(page, {
component: 'FluidTextInput',
id: 'experimental-fluid-components-unstable-fluidtextinput--password-input',
component: 'FluidPasswordInput',
id: 'experimental-fluid-components-unstable-fluidpasswordinput--default',
theme,
});
});
Expand Down
Loading
Loading