-
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?
Changes from all commits
50547c4
8b589e5
1e372c0
8032165
832ae3e
c58ff9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import { expect } from '@playwright/test'; | ||
| import { test } from '@utils/fixtures'; | ||
|
|
||
| test('Validate "Become a Mentee" section and Find a Mentor button', async ({ | ||
| page, | ||
| }) => { | ||
| // Navigate to Mentorship page | ||
| await page.goto('/mentorship'); | ||
|
|
||
| // Scroll to "Become a Mentee" section | ||
| const sectionTitle = page.getByRole('heading', { | ||
| level: 4, | ||
| name: /Become a Mentee/i, | ||
| }); | ||
| await sectionTitle.scrollIntoViewIfNeeded(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no need to scroll to the section to validate it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| // Validate title | ||
| await expect(sectionTitle).toBeVisible(); | ||
|
|
||
| // Validate description text | ||
| const description = page.getByRole('heading', { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you move this to the mentorship page definition? |
||
| level: 5, | ||
| name: /You should become a mentee if you:/i, | ||
| }); | ||
| await expect(description).toBeVisible(); | ||
|
|
||
| // List items | ||
| const items = [ | ||
| 'Want to start a career in software engineering', | ||
| 'Want to find a better job', | ||
| 'Want to be promoted at work', | ||
| 'Want to apply for a leadership position', | ||
| 'Need support in advancing your career', | ||
| ]; | ||
|
|
||
| for (const item of items) { | ||
| await expect(page.getByText(item)).toBeVisible(); | ||
| } | ||
|
Comment on lines
+36
to
+38
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
|
|
||
| // Validate "Find a mentor" button | ||
| const findMentorButton = page.getByRole('button', { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you replace locator with the existing one on homePage: |
||
| name: 'Find a mentor', | ||
| }); | ||
| await expect(findMentorButton).toBeVisible(); | ||
| await expect(findMentorButton).toBeEnabled(); | ||
| await findMentorButton.click(); | ||
|
Comment on lines
+44
to
+46
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Visibility and enabled checks (44, 45 lines) are redundant before a click.
See the docs: |
||
|
|
||
| // Verify redirection | ||
| await expect(page).toHaveURL(/\/mentorship\/mentors/); | ||
| }); | ||
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?