-
Notifications
You must be signed in to change notification settings - Fork 137
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
Cypress test for resource page #2700
Conversation
frontend/src/__tests__/cypress/cypress/e2e/Resources/Resources.cy.ts
Outdated
Show resolved
Hide resolved
frontend/src/__tests__/cypress/cypress/e2e/Resources/Resources.cy.ts
Outdated
Show resolved
Hide resolved
frontend/src/__tests__/cypress/cypress/e2e/Resources/Resources.cy.ts
Outdated
Show resolved
Hide resolved
return this.find().findAllByTestId(['card']); | ||
} | ||
|
||
findCard(id: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This returns a page object for working with specific card, should this be a get
function ?
cc @christianvogt
findCard(id: string) { | |
getCard(id: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This returns return this.find().findByTestId(['card', id]);
which is a selector.
Using find
here is correct. Unless the function returns a new PageObject
in which case get
should be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That being said I think I know where @pnaik1 is going with this.
I would expect getCard(id: string)
to return a new page object which has all the selectors scoped to that code instead of having the CardView
parameterize each method to target a specific card.
eg.
getCard(id: string) {
return new Card(() => this.find().findByTestId(['card', id]));
}
class Card extends Contextual {
...
findSomethingOnACard() { ... }
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is precisely what I was indicating.
We do indeed have a generic Card component in place, Can we make use of that if possible?
Updated PR, ready for re-review. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: christianvogt The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Closes: RHOAIENG-3812
Description
This PR aims to add cypress test for resources page.
How Has This Been Tested?
npm run test
Test Impact
Request review criteria:
Self checklist (all need to be checked):
If you have UI changes:
After the PR is posted & before it merges:
main