Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@
"engines": {
"node": ">=20",
"pnpm": ">=9"
}
},
"packageManager": "pnpm@9.15.4+sha512.b2dc20e2fc72b3e18848459b37359a32064663e5627a51e4c74b2c29dd8e8e0491483c3abb40789cfd578bf362fb6ba8261b05f0387d76792ed6e23ea3b1b6a0"
}
12 changes: 12 additions & 0 deletions playwright-tests/pages/mentorship.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export class MentorshipPage extends BasePage {
readonly feedbackArea: Locator;
readonly testimonialCards: Locator;
readonly showMoreButton: Locator;
readonly sectionTitle: Locator;
readonly description: Locator;
readonly menteeListItems: Locator;

// Mentors listing page locators
readonly mentorsPageTitle: Locator;
Expand All @@ -62,6 +65,15 @@ export class MentorshipPage extends BasePage {
this.feedbackArea = page.getByTestId('feedback-area');
this.testimonialCards = this.feedbackArea.getByTestId('feedback-card');
this.showMoreButton = this.feedbackArea.getByTestId('feedback-show-more');
this.sectionTitle = page.getByRole('heading', {
level: 4,
name: /Become a Mentee/i,
});
this.description = page.getByRole('heading', {
level: 5,
name: /You should become a mentee if you:/i,
});
this.menteeListItems = page.getByTestId('become-mentee-card').locator('li');

this.mentorsPageTitle = page.getByRole('heading', {
name: 'Meet Our Mentors',
Expand Down
28 changes: 28 additions & 0 deletions playwright-tests/tests/becomeAMentee.page.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { expect } from '@playwright/test';
import { test } from '@utils/fixtures';
import { HomePage } from '@pages/home.page';

Check warning on line 3 in playwright-tests/tests/becomeAMentee.page.spec.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused import of 'HomePage'.

See more on https://sonarcloud.io/project/issues?id=Women-Coding-Community_wcc-frontend&issues=AZ5axt61cVnEFZITIPrN&open=AZ5axt61cVnEFZITIPrN&pullRequest=202
import { MentorshipPage } from '@pages/mentorship.page';

Check warning on line 4 in playwright-tests/tests/becomeAMentee.page.spec.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused import of 'MentorshipPage'.

See more on https://sonarcloud.io/project/issues?id=Women-Coding-Community_wcc-frontend&issues=AZ5axt61cVnEFZITIPrO&open=AZ5axt61cVnEFZITIPrO&pullRequest=202

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/);
});
Comment thread
joanaBrit marked this conversation as resolved.
4 changes: 3 additions & 1 deletion src/components/MentorBecomeCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ interface MentorBecomeCardProps {
topics: string[];
buttonText: string;
buttonUrl: string;
listTestId?: string;
}

export const MentorBecomeCard = ({
mentorOrMentee,
topics,
buttonText,
buttonUrl,
listTestId,
}: MentorBecomeCardProps) => {
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
return (
Expand Down Expand Up @@ -48,7 +50,7 @@ export const MentorBecomeCard = ({
You should become a {mentorOrMentee} if you:
</Typography>

<ol>
<ol data-testid={listTestId}>
{topics.map((topic: any, index: number) => (
<li
style={{ fontSize: '24px' }}
Expand Down
2 changes: 2 additions & 0 deletions src/pages/mentorship/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable prettier/prettier */
import { Typography, Button, Box, Grid, useMediaQuery } from '@mui/material';
import { GetServerSideProps } from 'next';
import React, { useState } from 'react';
Expand Down Expand Up @@ -74,6 +75,7 @@ const MentorshipPage = ({ mentorship, footer }: MentorshipPageProps) => {
buttonText={mentorship.mentorSection.link.label}
></MentorBecomeCard>
<MentorBecomeCard
listTestId="become-mentee-card"
mentorOrMentee="mentee"
topics={mentorship.menteeSection.items}
buttonUrl={mentorship.menteeSection.link.uri}
Expand Down
Loading