Login:Tests: add mock requests for static data
This commit is contained in:
parent
28c29eeb1f
commit
e4772bf8a5
@ -1,6 +1,27 @@
|
|||||||
import { expect, test } from "@playwright/test";
|
import { expect, test } from "@playwright/test";
|
||||||
|
|
||||||
import BackgroundPatternReactSvgUrl from "PUBLIC_DIR/images/background.pattern.react.svg?url";
|
test.beforeEach(async ({ page }) => {
|
||||||
|
await page.route("*/**/logo.ashx**", async (route) => {
|
||||||
|
await route.fulfill({
|
||||||
|
contentType: "image/svg+xml",
|
||||||
|
path: `../../public/images/logo/loginpage.svg`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
await page.route(
|
||||||
|
"*/**/login/_next/public/images/**/*",
|
||||||
|
async (route, request) => {
|
||||||
|
const imagePath = request
|
||||||
|
.url()
|
||||||
|
.split("/login/_next/public/images/")
|
||||||
|
.at(-1)!
|
||||||
|
.split("?")[0];
|
||||||
|
await route.fulfill({
|
||||||
|
contentType: "image/*",
|
||||||
|
path: `../../public/images/${imagePath}`,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("render wizard", async ({ page }) => {
|
test("render wizard", async ({ page }) => {
|
||||||
await page.route("*/**/api/2.0/settings/wizard/complete", async (route) => {
|
await page.route("*/**/api/2.0/settings/wizard/complete", async (route) => {
|
||||||
@ -23,7 +44,7 @@ test("render wizard", async ({ page }) => {
|
|||||||
.getByTestId("text-input")
|
.getByTestId("text-input")
|
||||||
.fill("qwerty123");
|
.fill("qwerty123");
|
||||||
await page.getByTestId("checkbox").click();
|
await page.getByTestId("checkbox").click();
|
||||||
await page.getByTestId("button").click();
|
|
||||||
|
|
||||||
|
await page.getByTestId("button").click();
|
||||||
await expect(page).toHaveURL(/.*\//);
|
await expect(page).toHaveURL(/.*\//);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user