Login:Tests: add mock requests for static data

This commit is contained in:
Darya Umrikhina 2024-08-27 12:45:32 +04:00
parent 28c29eeb1f
commit e4772bf8a5

View File

@ -1,6 +1,27 @@
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 }) => {
await page.route("*/**/api/2.0/settings/wizard/complete", async (route) => {
@ -23,7 +44,7 @@ test("render wizard", async ({ page }) => {
.getByTestId("text-input")
.fill("qwerty123");
await page.getByTestId("checkbox").click();
await page.getByTestId("button").click();
await page.getByTestId("button").click();
await expect(page).toHaveURL(/.*\//);
});