Skip to content

test: Become a mentee Section #143#202

Open
joanaBrit wants to merge 8 commits intoWomen-Coding-Community:mainfrom
joanaBrit:test-143-become-a-mentee-playwright
Open

test: Become a mentee Section #143#202
joanaBrit wants to merge 8 commits intoWomen-Coding-Community:mainfrom
joanaBrit:test-143-become-a-mentee-playwright

Conversation

@joanaBrit
Copy link
Contributor

Description

Add Playwright tests for the "Become a mentee Section" page

Type

  • Bug Fix
  • New Feature
  • Code Refactor
  • Documentation
  • Other

Related Issue

#143

Screenshots

image

Testing

Playwright test

Pull request checklist

Please check if your PR fulfills the following requirements:

  • I checked and followed the contributor guide
  • I have tested my changes locally.
  • [] I have added a screenshot from the website after I tested it locally

@vercel
Copy link

vercel bot commented Feb 8, 2026

@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.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 8, 2026

@joanaBrit
Copy link
Contributor Author

joanaBrit commented Feb 15, 2026

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.
image

Comment on lines +6 to +37
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/);
});
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
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 :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please try this approach?

buttonText={'Join as a mentor'}
></MentorBecomeCard>
<MentorBecomeCard
listTestId="mentee-card"
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
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');
Copy link
Contributor

Choose a reason for hiding this comment

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

In order to locate by data-testid, it is enough to call this.page.getByTestId(<data-testid>).

@nora-weisser
Copy link
Contributor

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. image

Great job! I left a few more comments :)

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.

2 participants