test: Become a mentee Section #143#202
test: Become a mentee Section #143#202joanaBrit wants to merge 8 commits intoWomen-Coding-Community:mainfrom
Conversation
|
@joanaBrit is attempting to deploy a commit to the Women Coding Community's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
|
Hi @nora-weisser, I’ve made all the requested changes and pushed the updates. Please let me know if there’s anything else you’d like me to adjust. I don't know why the test is failing. |
| test('Validate "Become a Mentee" section and Find a Mentor button', async ({ | ||
| page, | ||
| }) => { | ||
| // Navigate to Mentorship page | ||
| await page.goto('/mentorship'); | ||
|
|
||
| // "Become a Mentee" section | ||
| const { sectionTitle, description, menteeListItems } = new MentorshipPage( | ||
| page, | ||
| ); | ||
|
|
||
| await expect(sectionTitle).toBeVisible(); | ||
| 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', | ||
| ]; | ||
|
|
||
| await expect(menteeListItems).toHaveText(items); | ||
|
|
||
| // Validate "Find a mentor" button | ||
| const { findMentorButton } = new HomePage(page); | ||
| await findMentorButton.click(); | ||
|
|
||
| // Verify redirection | ||
| await expect(page).toHaveURL(/\/mentorship\/mentors/); | ||
| }); |
There was a problem hiding this comment.
| test('Validate "Become a Mentee" section and Find a Mentor button', async ({ | |
| page, | |
| }) => { | |
| // Navigate to Mentorship page | |
| await page.goto('/mentorship'); | |
| // "Become a Mentee" section | |
| const { sectionTitle, description, menteeListItems } = new MentorshipPage( | |
| page, | |
| ); | |
| await expect(sectionTitle).toBeVisible(); | |
| 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', | |
| ]; | |
| await expect(menteeListItems).toHaveText(items); | |
| // Validate "Find a mentor" button | |
| const { findMentorButton } = new HomePage(page); | |
| await findMentorButton.click(); | |
| // Verify redirection | |
| await expect(page).toHaveURL(/\/mentorship\/mentors/); | |
| }); | |
| test('Validate "Become a Mentee" section and Find a Mentor button', async ({ | |
| page, mentorshipPage, homePage | |
| }) => { | |
| // Navigate to Mentorship page | |
| await page.goto('/mentorship'); | |
| await expect(mentorshipPage.sectionTitle).toBeVisible(); | |
| await expect(mentorshipPage.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', | |
| ]; | |
| await expect(mentorshipPage.menteeListItems).toHaveText(items); | |
| await homePage.findMentorButton.click(); | |
| await expect(page).toHaveURL(/\/mentorship\/mentors/); | |
| }); |
Since homePage and mentorshipPage are fixtures, they can be called directly in the test case :)
There was a problem hiding this comment.
Could you please try this approach?
| buttonText={'Join as a mentor'} | ||
| ></MentorBecomeCard> | ||
| <MentorBecomeCard | ||
| listTestId="mentee-card" |
There was a problem hiding this comment.
| listTestId="mentee-card" | |
| listTestId="become-mentee-card" |
Maybe better to call it become-mentee-card? :)
| level: 5, | ||
| name: /You should become a mentee if you:/i, | ||
| }); | ||
| this.menteeListItems = page.locator('ol[data-testid="mentee-card"] > li'); |
There was a problem hiding this comment.
In order to locate by data-testid, it is enough to call this.page.getByTestId(<data-testid>).
Great job! I left a few more comments :) |





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: