-
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 #242 from Maakaf/240-add-testing-for-the-main-page
240 add testing for the main page
- Loading branch information
Showing
7 changed files
with
73 additions
and
7 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
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
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,44 @@ | ||
import { test, expect, Page } from '@playwright/test'; | ||
|
||
const BASE_URL = 'http://localhost:3000/he'; | ||
|
||
async function checkElementVisibility(page: Page, elementTestId: string) { | ||
const element = page.getByTestId(elementTestId); | ||
element.scrollIntoViewIfNeeded(); | ||
const isVisible = await element.isVisible(); | ||
expect(isVisible).toBeTruthy(); | ||
} | ||
test('Check main page elements exist', async ({ page }) => { | ||
await page.goto(BASE_URL); | ||
|
||
async function checkElementVisibility(elementTestId: string) { | ||
const element = page.getByTestId(elementTestId); | ||
element.scrollIntoViewIfNeeded(); | ||
const isVisible = await element.isVisible(); | ||
expect(isVisible).toBeTruthy(); | ||
} | ||
|
||
await checkElementVisibility('homePage-title'); | ||
await checkElementVisibility('homePage-discordLink'); | ||
|
||
await checkElementVisibility('linusTorvaldsQuote'); | ||
|
||
await checkElementVisibility('beOurFirendsTitle'); | ||
await checkElementVisibility('beOurFirendsItemContainer'); | ||
await checkElementVisibility('beOurFirendsItem0'); | ||
await checkElementVisibility('beOurFirendsItem1'); | ||
await checkElementVisibility('beOurFirendsItem2'); | ||
await checkElementVisibility('beOurFirendsItem3'); | ||
await checkElementVisibility('beOurFirendsItem4'); | ||
await checkElementVisibility('beOurFirendsItem5'); | ||
|
||
await checkElementVisibility('pathsTitle'); | ||
await checkElementVisibility('pathsTitleContainer'); | ||
|
||
await checkElementVisibility('pathsTitleItem0'); | ||
await checkElementVisibility('pathsTitleItem1'); | ||
await checkElementVisibility('pathsTitleItem2'); | ||
|
||
await checkElementVisibility('whatNowTitle'); | ||
await checkElementVisibility('whatNowButton'); | ||
}); |