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(menu): playwright refactor #6466

Merged
merged 1 commit into from
Dec 14, 2023
Merged

test(menu): playwright refactor #6466

merged 1 commit into from
Dec 14, 2023

Conversation

stephenogorman
Copy link
Contributor

@stephenogorman stephenogorman commented Dec 4, 2023

Proposed behaviour

Refactor Menu tests from Cypress to Playwright

Current behaviour

Tests are currently Cypress

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Cypress automation tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in CodeSandbox/storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

N/A

Testing instructions

Testing instructions

  • Run Form tests in Playwright Test Runner to check if the menu.pw.tsx file passed
  • Run all other tests in Playwright Test Runner to check none of the other *.pw.tsx files have regressed

Copy link

codesandbox-ci bot commented Dec 4, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit bbaa149:

Sandbox Source
carbon-quickstart Configuration
carbon-quickstart-typescript Configuration


const menuTypes: MenuType[] = ["white", "light", "dark", "black"];

export const MenuComponent = (props: Partial<MenuProps> & MenuDividerProps) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we delete these mock components from menu-test.stories.tsx since they are already moved to the components.test-pw.tsx?

@@ -0,0 +1,2426 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion, no-await-in-loop */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this line still necessary?

["dark", "rgb(0, 25, 38)", 4],
["black", "rgb(38, 38, 38)", 6],
] as [string, string, number][]).forEach(([colorName, color, menuNumber]) => {
test(`should verify submenu background color is ${colorName}`, async ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test(`should verify submenu background color is ${colorName}`, async ({
test(`should verify the ${menuNumber}th submenu background color is ${colorName}`, async ({

["dark", "rgb(0, 50, 76)", 8],
["black", "rgb(0, 0, 0)", 12],
] as [string, string, number][]).forEach(([colorName, color, menuNumber]) => {
test(`should verify Menu background color is ${colorName}`, async ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test(`should verify Menu background color is ${colorName}`, async ({
test(`should verify the ${menuNumber}th menu background color is ${colorName}`, async ({

["default", 1],
["large", 4],
] as [MenuDividerProps["size"], number][]).forEach(([size, height]) => {
test(`should verify Menu Divider size is ${size}`, async ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test(`should verify Menu Divider size is ${size}`, async ({
test(`should verify Menu Divider has the proper height when the size is ${size}`, async ({

["ArrowDown", 0],
["ArrowUp", 2],
] as [string, number][]).forEach(([key, tabs]) => {
test(`should verify the Search component is focusable by using the ${key} key`, async ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test(`should verify the Search component is focusable by using the ${key} key`, async ({
test(`should verify the Search component is focusable by pressing the ${key} key`, async ({

await expect(subMenuBlock).toBeVisible();
});

test(`should render with a menu item with a very long label and verify the width of the whole submenu is determined by this item`, async ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test(`should render with a menu item with a very long label and verify the width of the whole submenu is determined by this item`, async ({
test(`should render with a menu item that has a very long label and verify the width of the whole submenu is determined by this item`, async ({

CHARACTERS.DIACRITICS,
CHARACTERS.SPECIALCHARACTERS,
].forEach((text) => {
test(`should render with Menu Item text ${text}`, async ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test(`should render with Menu Item text ${text}`, async ({
test(`should render with submenu text set to ${text}`, async ({

["250px", 250],
] as [ScrollableBlockProps["height"], number][]).forEach(
([height, pixels]) => {
test(`should render with scroll block height of ${pixels}px when height prop is passed a number or string`, async ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test(`should render with scroll block height of ${pixels}px when height prop is passed a number or string`, async ({
test(`should render with scroll block height of ${pixels}px when height prop is passed as a number or string`, async ({

await expect(fullMenuItem).toBeFocused();
});

test(`should verify that inner Menu without link is NOT available with tabbing in Fullscreen Menu`, async ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test(`should verify that inner Menu without link is NOT available with tabbing in Fullscreen Menu`, async ({
test(`should verify that inner Menu without link is NOT available when tabbing in Fullscreen Menu`, async ({

});

test.describe("Accessibility tests for Menu component", () => {
test(`should pass tests for default Menu`, async ({ mount, page }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test(`should pass tests for default Menu`, async ({ mount, page }) => {
test(`should pass accessibility tests for default Menu`, async ({ mount, page }) => {

same as below for all the accessibility tests

edleeks87
edleeks87 previously approved these changes Dec 12, 2023
@stephenogorman stephenogorman marked this pull request as ready for review December 14, 2023 12:21
@stephenogorman stephenogorman requested a review from a team as a code owner December 14, 2023 12:21
@stephenogorman stephenogorman requested a review from a team as a code owner December 14, 2023 12:21
@stephenogorman stephenogorman merged commit 8d94333 into master Dec 14, 2023
19 checks passed
@stephenogorman stephenogorman deleted the pw_refactor_menu branch December 14, 2023 14:03
@carbonci
Copy link
Collaborator

🎉 This PR is included in version 124.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants