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(ProductiveCard): add avt test coverage #6518

Conversation

devadula-nandan
Copy link
Contributor

@devadula-nandan devadula-nandan commented Nov 29, 2024

Closes #6472

adds accessibility tests for productive card

Since we are in v12 OverflowMenu. i noticed that passing aria-label prop to v12 OverflowMenu spreads it to the overflow menu container which is a div and is reported as violation
v12 OverflowMenu uses single Label prop to set tooltip text on menu button and aria-label for list container (ul)
which means we might need to deprecate either iconDescription or overflowAriaLabel as Label prop handles both with v12 OverflowMenu.

useful references
#5803
#6395

i have passed label as below, and awaiting for any review suggestions

label={iconDescription || overflowAriaLabel}

What did you change?

e2e/components/ProductiveCard/ProductiveCard-test.avt.e2e.js
packages/ibm-products/src/components/Card/Card.tsx

How did you test and verify your work?

yarn avt

@devadula-nandan devadula-nandan requested a review from a team as a code owner November 29, 2024 14:38
@devadula-nandan devadula-nandan requested review from elycheea and anamikaanu96 and removed request for a team November 29, 2024 14:38
Copy link

netlify bot commented Nov 29, 2024

Deploy Preview for carbon-for-ibm-products ready!

Name Link
🔨 Latest commit 3354055
🔍 Latest deploy log https://app.netlify.com/sites/carbon-for-ibm-products/deploys/6756cdbec331250008320888
😎 Deploy Preview https://deploy-preview-6518--carbon-for-ibm-products.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Nov 29, 2024

Deploy Preview for ibm-products-web-components ready!

Name Link
🔨 Latest commit 3354055
🔍 Latest deploy log https://app.netlify.com/sites/ibm-products-web-components/deploys/6756cdbefcb6ef0008dfaa8a
😎 Deploy Preview https://deploy-preview-6518--ibm-products-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Nov 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.96%. Comparing base (6e58e9d) to head (3354055).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6518      +/-   ##
==========================================
- Coverage   79.97%   79.96%   -0.01%     
==========================================
  Files         394      394              
  Lines       12894    12895       +1     
  Branches     4273     4274       +1     
==========================================
  Hits        10312    10312              
- Misses       2582     2583       +1     
Components Coverage Δ
ibm-products ∅ <ø> (∅)
ibm-products-web-components ∅ <ø> (∅)

@devadula-nandan devadula-nandan marked this pull request as draft December 2, 2024 13:30
@devadula-nandan devadula-nandan marked this pull request as ready for review December 3, 2024 13:22
Copy link
Contributor

@elycheea elycheea left a comment

Choose a reason for hiding this comment

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

Looks good overall, but I think there are a few places where we could also use role/text locators rather than by query selectors. :)

Comment on lines 48 to 50
const buttons = page.locator(`button.${carbon.prefix}--btn`);
const disabledButton = buttons.nth(2);
expect(await disabledButton.getAttribute('disabled')).not.toBeNull();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we typically try to query by role or text over a specific query selector.

In this case, we could probably do

const disabledButton = page.getByRole('button', { name: 'Read more' });

Or some similar variation of that.

Comment on lines 77 to 78
const menuButton = page.locator('button[aria-haspopup="true"]');
const menu = page.locator('ul[role="menu"]');
Copy link
Contributor

Choose a reason for hiding this comment

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

We can probably use the roles here as well. :)

https://playwright.dev/docs/locators#locate-by-role

@devadula-nandan
Copy link
Contributor Author

@elycheea fixed it

elycheea
elycheea previously approved these changes Dec 5, 2024
Copy link
Contributor

@elycheea elycheea left a comment

Choose a reason for hiding this comment

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

Also agree it might be good to deprecate iconDescription or overflowAriaLabel if they are now redundant. If iconDescription overrides overflowAriaLabel, that may be preferable unless the latter is more widely used. 🤔

@elycheea elycheea added adopter: automation Issues connected to work that accelerates IBM's automation offerings. status: one more review 👀 and removed adopter: automation Issues connected to work that accelerates IBM's automation offerings. labels Dec 5, 2024
@devadula-nandan
Copy link
Contributor Author

Also agree it might be good to deprecate iconDescription or overflowAriaLabel if they are now redundant. If iconDescription overrides overflowAriaLabel, that may be preferable unless the latter is more widely used. 🤔

im pretty sure we can deprecate iconDescription as it has been introduced recently compared to overflowAriaLabel.
also changed the override order to prioritise overflowAriaLabel. and updated the pr accordingly.

although a more generic name label could be more convenient (just like we have in core. a common prop to pass to button tooltip and aria-label for v12 OverflowMenu) when compared to having overflowAriaLabel that also sets tooltip text.

any additional thoughts or suggestions?

elycheea
elycheea previously approved these changes Dec 6, 2024
Copy link
Contributor

@anamikaanu96 anamikaanu96 left a comment

Choose a reason for hiding this comment

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

Hi @devadula-nandan can you add test for hover state.

@devadula-nandan
Copy link
Contributor Author

@anamikaanu96 done

@anamikaanu96 anamikaanu96 added this pull request to the merge queue Dec 11, 2024
Merged via the queue into carbon-design-system:main with commit dd60a2e Dec 11, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Evaluate ProductiveCard for WCAG 2.2 readiness
3 participants