Skip to content

Commit

Permalink
tests: add missing snapshot and axe coverage for ActionMenu (#4538)
Browse files Browse the repository at this point in the history
* tests: add missing axe coverage for open ActionMenu

* Update test

* test(vrt): update snapshots

* test(vrt): update snapshots

* test(vrt): update snapshots

* test(ActionMenu): disable animations for snapshot test

---------

Co-authored-by: khiga8 <khiga8@users.noreply.github.com>
Co-authored-by: Josh Black <joshblack@users.noreply.github.com>
  • Loading branch information
3 people authored May 1, 2024
1 parent 6b502fd commit c860b70
Show file tree
Hide file tree
Showing 56 changed files with 36 additions and 25 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 34 additions & 23 deletions e2e/components/ActionMenu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ test.describe('ActionMenu', () => {
colorScheme: theme,
},
})

// Default state
// Open state
await page.getByRole('button', {name: 'Open menu'}).click()
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(`ActionMenu.Default.${theme}.png`)
})

Expand All @@ -25,6 +25,7 @@ test.describe('ActionMenu', () => {
colorScheme: theme,
},
})
await page.getByRole('button', {name: 'Open menu'}).click()
await expect(page).toHaveNoViolations()
})
})
Expand All @@ -36,30 +37,30 @@ test.describe('ActionMenu', () => {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'components-actionmenu-features--links-and-actions',
id: 'components-actionmenu-features--inactive-items',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
`ActionMenu.Links And Actions.${theme}.png`,
)

// Open menu
// Open state
await page.locator('button', {hasText: 'Open menu'}).waitFor()
await page.getByRole('button', {name: 'Open menu'}).click()
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot()
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
`ActionMenu.Inactive Items.${theme}.png`,
)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-actionmenu-features--links-and-actions',
id: 'components-actionmenu-features--inactive-items',
globals: {
colorScheme: theme,
},
})
// Open menu
await page.locator('button', {hasText: 'Open menu'}).waitFor()
await page.getByRole('button', {name: 'Open menu'}).click()
await expect(page).toHaveNoViolations()
})
})
Expand All @@ -77,7 +78,8 @@ test.describe('ActionMenu', () => {
},
})

// Default state
// Open state
await page.getByRole('button', {name: 'Open menu'}).click()
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
`ActionMenu.Links And Actions.${theme}.png`,
)
Expand All @@ -90,6 +92,8 @@ test.describe('ActionMenu', () => {
colorScheme: theme,
},
})
// Open Menu
await page.getByRole('button', {name: 'Open menu'}).click()
await expect(page).toHaveNoViolations()
})
})
Expand All @@ -107,7 +111,8 @@ test.describe('ActionMenu', () => {
},
})

// Default state
// Open state
await page.getByRole('button', {name: 'Display'}).click()
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
`ActionMenu.Multi Select.${theme}.png`,
)
Expand All @@ -120,6 +125,9 @@ test.describe('ActionMenu', () => {
colorScheme: theme,
},
})

// Open state
await page.getByRole('button', {name: 'Display'}).click()
await expect(page).toHaveNoViolations()
})
})
Expand All @@ -137,7 +145,8 @@ test.describe('ActionMenu', () => {
},
})

// Default state
// Open state
await page.getByRole('button', {name: 'Options: fast Forward'}).click()
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
`ActionMenu.Single Select.${theme}.png`,
)
Expand All @@ -150,6 +159,9 @@ test.describe('ActionMenu', () => {
colorScheme: theme,
},
})

// Open state
await page.getByRole('button', {name: 'Options: fast Forward'}).click()
await expect(page).toHaveNoViolations()
})
})
Expand All @@ -167,7 +179,7 @@ test.describe('ActionMenu', () => {
},
})

// Default state
await page.getByRole('button', {name: 'Open Menu'}).click()
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
`ActionMenu.Controlled Menu.${theme}.png`,
)
Expand All @@ -180,6 +192,9 @@ test.describe('ActionMenu', () => {
colorScheme: theme,
},
})

// Open state
await page.getByRole('button', {name: 'Open Menu'}).click()
await expect(page).toHaveNoViolations()
})
})
Expand Down Expand Up @@ -257,7 +272,7 @@ test.describe('ActionMenu', () => {
},
})

// Default state
// Open state
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
`ActionMenu.Groups And Descriptions.${theme}.png`,
)
Expand All @@ -270,13 +285,9 @@ test.describe('ActionMenu', () => {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations({
rules: {
'aria-required-children': {
enabled: false,
},
},
})

// Open state
await expect(page).toHaveNoViolations()
})
})
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c860b70

Please sign in to comment.