Merged in feature/add-login-test-2 (pull request #3261)

e2e tests for my pages

* feature/add-e2e-tests-for-mypages

* remove unneccesary awaits


Approved-by: Linus Flood
This commit is contained in:
Joakim Jäderberg
2025-12-03 07:59:11 +00:00
parent 7acfde7b49
commit 22d00bb363
12 changed files with 244 additions and 174 deletions
@@ -0,0 +1,22 @@
import { expect, test } from "@playwright/test"
import { getProfileButton, performLogin } from "../loginUtil"
import { testData } from "../testdata"
test("can navigate to my benefits page", async ({ page }) => {
await performLogin({
page,
username: testData.basicUser.membershipId,
password: testData.basicUser.password,
})
const profileButton = await getProfileButton(page)
profileButton.click()
const myStaysLink = page.getByRole("link", { name: /my benefits/i })
await myStaysLink.click()
const currentPerksAndBenefits = page.getByRole("heading", {
name: /current perks and benefits/i,
})
await expect(currentPerksAndBenefits).toBeVisible()
})
@@ -0,0 +1,20 @@
import { expect, test } from "@playwright/test"
import { getProfileButton, performLogin } from "../loginUtil"
import { testData } from "../testdata"
test("can navigate to my points page", async ({ page }) => {
await performLogin({
page,
username: testData.basicUser.membershipId,
password: testData.basicUser.password,
})
const profileButton = await getProfileButton(page)
profileButton.click()
const myPointsLink = page.getByRole("link", { name: /my points/i })
await myPointsLink.click()
const pointsToSpend = page.getByRole("heading", { name: /points to spend/i })
await expect(pointsToSpend).toBeVisible()
})
@@ -0,0 +1,22 @@
import { expect, test } from "@playwright/test"
import { getProfileButton, performLogin } from "../loginUtil"
import { testData } from "../testdata"
test("can navigate to my stays page", async ({ page }) => {
await performLogin({
page,
username: testData.basicUser.membershipId,
password: testData.basicUser.password,
})
const profileButton = await getProfileButton(page)
profileButton.click()
const myStaysLink = page.getByRole("link", { name: /my stays/i })
await myStaysLink.click()
const upcomingStays = page.getByRole("heading", {
name: /^upcoming stays$/i,
})
await expect(upcomingStays).toBeVisible()
})
@@ -0,0 +1,23 @@
import { expect, test } from "@playwright/test"
import { getProfileButton, performLogin } from "../loginUtil"
import { testData } from "../testdata"
test("can navigate to overview page", async ({ page }) => {
await performLogin({
page,
username: testData.basicUser.membershipId,
password: testData.basicUser.password,
})
const profileButton = await getProfileButton(page)
profileButton.click()
const overviewLink = page.getByRole("link", { name: /overview/i })
await overviewLink.click()
const scandicLevel = page.getByText(/level \d+/i)
await expect(scandicLevel).toBeVisible()
const membershipId = page.getByText(testData.basicUser.membershipId)
await expect(membershipId).toBeVisible()
})