-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
279 test for viewing projects (#323)
* test(frontend): 🧪 Write test for project page Check if project page has title and subtitle. Add testids to elements in project page and individual project page. Check if individual project page has title and paragraph. * test(frontend): 🧪 Added failing mobile project test * test(frontend): ✅ Fixed mobile project test and added hamburger to close navbar * fix(frontend): 💄 change tests for mobile to handle new navbar functionality * fix(frontend): 🐛 run the tests on server instead of localhost * refactor(frontend): ♻️ run prettier * refactor(frontend): ♻️ run prettier --------- Co-authored-by: Jakob Grøtan Gregusson <jakobgg@stud.ntnu.no> Co-authored-by: Jakobgg1243 <Jakob.gregusson@gmail.com> Co-authored-by: Mats Nyfløt <mnyflot@gmail.com>
- Loading branch information
4 people
authored and
GitHub
committed
Apr 21, 2024
1 parent
0e7fe53
commit 00ce42c
Showing
3 changed files
with
76 additions
and
0 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { test, expect } from "@playwright/test"; | ||
|
|
||
| //BASE_URL: http://web.hypso.ies.ntnu.no:3000/ | ||
|
|
||
| test.describe("All Project Page Test", () => { | ||
| test("CheckHeadingAndSubtitleIsVisible", async ({ page }) => { | ||
| await page.goto("/"); | ||
| await page.getByRole("button", { name: "Projects" }).click(); | ||
| await expect(page).toHaveURL("/projects"); | ||
| await expect(page.getByTestId("pageHeader")).toBeVisible(); | ||
| await expect(page.getByTestId("pageSubtitle")).toBeVisible(); | ||
| }); | ||
| test("CheckIfCardIsClickable", async ({ page }) => { | ||
| await page.goto("/"); | ||
| await page.getByRole("button", { name: "Projects" }).click(); | ||
| await expect(page).toHaveURL("/projects"); | ||
| await expect(page.getByTestId("projectCard").first()).toBeVisible(); | ||
| await page.getByTestId("projectCard").first().click(); | ||
| //Checks if the URL matches /projects/anySlug | ||
| await expect(page).toHaveURL(/\/projects\/.+$/); | ||
| }); | ||
| }); | ||
|
|
||
| test.describe("Individual Project Page Test", () => { | ||
| test("TestHeadingAndParagraphIsVisible", async ({ page }) => { | ||
| await page.goto("/"); | ||
| await page.getByRole("button", { name: "Projects" }).click(); | ||
| await page.getByTestId("projectCard").first().click(); | ||
| await expect(page).toHaveURL(/\/projects\/.+$/); | ||
| await expect(page.getByRole("heading").first()).toBeVisible(); | ||
| await expect(page.getByTestId("blockParagraph").first()).toBeVisible(); | ||
| }); | ||
| }); |
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,42 @@ | ||
| import { test, expect } from "@playwright/test"; | ||
|
|
||
| //BASE_URL: http://web.hypso.ies.ntnu.no:3000/ | ||
|
|
||
| test.describe("All Project Page Test", () => { | ||
| test.use({ | ||
| viewport: { width: 390, height: 844 }, | ||
| }); | ||
| test("CheckHeadingAndSubtitleIsVisible", async ({ page }) => { | ||
| await page.goto("/"); | ||
| await page.getByRole("navigation").getByRole("button").click(); | ||
| await page.getByRole("button", { name: "Projects" }).click(); | ||
| await expect(page).toHaveURL("/projects"); | ||
| await expect(page.getByTestId("pageHeader")).toBeVisible(); | ||
| await expect(page.getByTestId("pageSubtitle")).toBeVisible(); | ||
| }); | ||
| test("CheckIfCardIsClickable", async ({ page }) => { | ||
| await page.goto("/"); | ||
| await page.getByRole("navigation").getByRole("button").click(); | ||
| await page.getByRole("button", { name: "Projects" }).click(); | ||
| await expect(page).toHaveURL("/projects"); | ||
| await expect(page.getByTestId("projectCard").first()).toBeVisible(); | ||
| await page.getByTestId("projectCard").first().click(); | ||
| //Checks if the URL matches /projects/anySlug | ||
| await expect(page).toHaveURL(/\/projects\/.+$/); | ||
| }); | ||
| }); | ||
|
|
||
| test.describe("Individual Project Page Test", () => { | ||
| test.use({ | ||
| viewport: { width: 390, height: 844 }, | ||
| }); | ||
| test("TestHeadingAndParagraphIsVisible", async ({ page }) => { | ||
| await page.goto("/"); | ||
| await page.getByRole("navigation").getByRole("button").click(); | ||
| await page.getByRole("button", { name: "Projects" }).click(); | ||
| await page.getByTestId("projectCard").first().click(); | ||
| await expect(page).toHaveURL(/\/projects\/.+$/); | ||
| await expect(page.getByRole("heading").first()).toBeVisible(); | ||
| await expect(page.getByTestId("blockParagraph").first()).toBeVisible(); | ||
| }); | ||
| }); |