-
Notifications
You must be signed in to change notification settings - Fork 32
test: Become a mentee Section #143 #202
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
base: main
Are you sure you want to change the base?
test: Become a mentee Section #143 #202
Conversation
|
| level: 4, | ||
| name: /Become a Mentee/i, | ||
| }); | ||
| await sectionTitle.scrollIntoViewIfNeeded(); |
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.
There is no need to scroll to the section to validate it.
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.
Okay, why is it not necessary? Because we don’t have any interactions, apart from the button to go to a different page? Thank you! I’ll remove it. @nora-weisser
| await expect(findMentorButton).toBeVisible(); | ||
| await expect(findMentorButton).toBeEnabled(); | ||
| await findMentorButton.click(); |
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.
Visibility and enabled checks (44, 45 lines) are redundant before a click.
Playwright automatically ensures that:
- the locator resolves to exactly one element
- the element is visible
- the element is stable (not animating)
- the element is enabled
See the docs:
https://playwright.dev/docs/actionability
| } | ||
|
|
||
| // Validate "Find a mentor" button | ||
| const findMentorButton = page.getByRole('button', { |
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.
Could you replace locator with the existing one on homePage: findMentorButton?
| for (const item of items) { | ||
| await expect(page.getByText(item)).toBeVisible(); | ||
| } |
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.
Since those items are list items in the DOM, I would locate list of items and validate against array you mentioned above.
https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-text
| await page.goto('/mentorship'); | ||
|
|
||
| // Scroll to "Become a Mentee" section | ||
| const sectionTitle = page.getByRole('heading', { |
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.
Could you please move this locator to mentorship.page.ts POM?
| await expect(sectionTitle).toBeVisible(); | ||
|
|
||
| // Validate description text | ||
| const description = page.getByRole('heading', { |
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.
Could you move this to the mentorship page definition?



Description
Add Playwright tests for the "Become a mentee Section" page
Type
Related Issue
#143
Screenshots
Testing
Playwright test
Pull request checklist
Please check if your PR fulfills the following requirements: