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

add cypress test to bulk select #1314

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

opacut
Copy link

@opacut opacut commented Dec 9, 2024

Description

Associated Jira ticket: RHINENG-14744

Add Cypress test to Bulk Selector

How to test the PR

run npm test:ct

Before the change

90 tests are run

After the change

At least 91 tests are run, including The Bulk selector shows the correct number of systems selected.

Dependent work link

Checklist:

  • The commit message has the Jira ticket linked
  • PR has a short description
  • Screenshots before and after the change are added
  • Tests for the changes have been added
  • README.md is updated if necessary
  • Needs additional dependent work

@opacut opacut requested a review from a team as a code owner December 9, 2024 12:32
src/SmartComponents/SystemAdvisor/SystemAdvisor.cy.js Outdated Show resolved Hide resolved
src/SmartComponents/SystemAdvisor/SystemAdvisor.cy.js Outdated Show resolved Hide resolved

// select a couple
// but only ones that can be selected
cy.get('.pf-v5-c-table__tbody').then(rows => {selectRandomEnabledRows({rows: rows, numberOfRowsToSelect: 3})});
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
cy.get('.pf-v5-c-table__tbody').then(rows => {selectRandomEnabledRows({rows: rows, numberOfRowsToSelect: 3})});
cy.get(TABLE).then(rows => selectRandomEnabledRows({rows: rows, numberOfRowsToSelect: 3}));

https://github.com/RedHatInsights/frontend-components/blob/master/packages/utils/src/TestingUtils/CypressUtils/selectors.js#L18

Copy link
Author

@opacut opacut Dec 10, 2024

Choose a reason for hiding this comment

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

This one doesn't work - the test gets stuck

cy.get(':nth-child(2) > .pf-v5-c-menu-toggle').should('have.text', '3 selected')

// Select None
cy.get(':nth-child(2) > .pf-v5-c-menu-toggle > .pf-v5-c-menu-toggle__controls').click();
Copy link
Contributor

Choose a reason for hiding this comment

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

Use PT_BULK_SELECT from FEC to select the bulk select toggle

Copy link
Author

Choose a reason for hiding this comment

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

PT_BULK_SELECT results in a flaky test. I think it's because it targets the pf-v5-c-menu-toggle element, instead of the pf-v5-c-menu-toggle__controls element. In some cases it then doesn't open the BS menu

src/SmartComponents/SystemAdvisor/SystemAdvisor.cy.js Outdated Show resolved Hide resolved
@johnsonm325
Copy link
Contributor

Your errors are for linting. npm run lint should give you everything you need.

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.

3 participants