diff --git a/package.json b/package.json index d7d44ef..a04a146 100644 --- a/package.json +++ b/package.json @@ -67,5 +67,6 @@ "engines": { "node": ">=20", "pnpm": ">=9" - } + }, + "packageManager": "pnpm@9.15.4+sha512.b2dc20e2fc72b3e18848459b37359a32064663e5627a51e4c74b2c29dd8e8e0491483c3abb40789cfd578bf362fb6ba8261b05f0387d76792ed6e23ea3b1b6a0" } diff --git a/playwright-tests/pages/mentorship.page.ts b/playwright-tests/pages/mentorship.page.ts index c6b707f..f23093b 100644 --- a/playwright-tests/pages/mentorship.page.ts +++ b/playwright-tests/pages/mentorship.page.ts @@ -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; @@ -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', diff --git a/playwright-tests/tests/becomeAMentee.page.spec.ts b/playwright-tests/tests/becomeAMentee.page.spec.ts new file mode 100644 index 0000000..71d32bc --- /dev/null +++ b/playwright-tests/tests/becomeAMentee.page.spec.ts @@ -0,0 +1,28 @@ +import { expect } from '@playwright/test'; +import { test } from '@utils/fixtures'; +import { HomePage } from '@pages/home.page'; +import { MentorshipPage } from '@pages/mentorship.page'; + +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/); +}); diff --git a/src/components/MentorBecomeCard.tsx b/src/components/MentorBecomeCard.tsx index 6e3fb2e..c47ff51 100644 --- a/src/components/MentorBecomeCard.tsx +++ b/src/components/MentorBecomeCard.tsx @@ -10,6 +10,7 @@ interface MentorBecomeCardProps { topics: string[]; buttonText: string; buttonUrl: string; + listTestId?: string; } export const MentorBecomeCard = ({ @@ -17,6 +18,7 @@ export const MentorBecomeCard = ({ topics, buttonText, buttonUrl, + listTestId, }: MentorBecomeCardProps) => { const isMobile = useMediaQuery(theme.breakpoints.down('md')); return ( @@ -48,7 +50,7 @@ export const MentorBecomeCard = ({ You should become a {mentorOrMentee} if you: -