-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #237 from Maakaf/236-add-first-e2e-test-newbies-page
236 add first e2e test newbies page
- Loading branch information
Showing
8 changed files
with
99 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export default function RootLayout({ | ||
children, | ||
params: { locale }, | ||
}: { | ||
children: React.ReactNode; | ||
params: { locale: string }; | ||
}) { | ||
return ( | ||
<html lang={locale} dir="rtl"> | ||
<body>{children}</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
const BASE_URL = 'http://localhost:3000/he'; | ||
|
||
test.describe('Test Newbies page', () => { | ||
test('should navigate to the Newbies page', async ({ page }) => { | ||
await page.goto(BASE_URL); | ||
await page.click('text="קהילה"'); | ||
await page.click('[data-testid="Newbies"]'); | ||
|
||
await page.waitForNavigation(); | ||
|
||
const pageTitle = await page.title(); | ||
expect(pageTitle).toContain('Newbies'); | ||
}); | ||
|
||
test('should render NEWBIES', async ({ page }) => { | ||
await page.goto(`${BASE_URL}/newbies`); | ||
expect(await page.textContent('h1')).toContain('NEWBIES'); | ||
}); | ||
|
||
test('External links contain correct URLs', async ({ page }) => { | ||
await page.goto(`${BASE_URL}/newbies`); | ||
|
||
const linksData = [ | ||
{ | ||
name: 'Maakaf_Logo', | ||
link: 'https://github.com/UrielOfir/os-practice', | ||
}, | ||
{ | ||
name: 'Discord_Logo', | ||
link: 'https://discord.com/invite/a2VyCjRk2M', | ||
}, | ||
{ | ||
name: 'WhatsApp_Logo', | ||
link: 'https://chat.whatsapp.com/E5a59DtSaHNBwnczxVW1FY', | ||
}, | ||
]; | ||
|
||
for (const linkData of linksData) { | ||
const linkSelector = `[data-testid="NewbiesExternalLink-${linkData.name}"]`; | ||
const linkExists = await page.waitForSelector(linkSelector); | ||
expect(linkExists).toBeTruthy(); | ||
|
||
const linkElement = await page.$(linkSelector); | ||
const linkURL = await linkElement?.getAttribute('href'); | ||
expect(linkURL).toBe(linkData.link); | ||
} | ||
}); | ||
|
||
test('FAQ items are clickable and expandable', async ({ page }) => { | ||
await page.goto(`${BASE_URL}/newbies`); | ||
await page.waitForSelector('[data-testid="faq-section"]'); | ||
|
||
const faqItems = await page.$$('[data-testid^="faq-item-"]'); | ||
|
||
for (let i = 0; i < faqItems.length; i++) { | ||
const faqItem = faqItems[i]; | ||
|
||
const trigger = await faqItem.$('[data-testid^="faq-trigger-"]'); | ||
await trigger?.click(); | ||
|
||
await page.waitForSelector( | ||
'[data-testid^="faq-content-"][aria-expanded="true"]' | ||
); | ||
|
||
const content = await faqItem.$('[data-testid^="faq-content-"]'); | ||
expect(content).not.toBeNull(); | ||
|
||
await trigger?.click(); | ||
|
||
await page.waitForSelector( | ||
'[data-testid^="faq-content-"][aria-expanded="false"]' | ||
); | ||
} | ||
}); | ||
}); |