mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-24 22:30:35 +08:00
Co-authored-by: Thomas Scholtes <geigerzaehler@axiom.fm> Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
30 lines
885 B
TypeScript
30 lines
885 B
TypeScript
import type { Page } from "@playwright/test";
|
|
import { expect } from "@tests/support/fixtures.js";
|
|
|
|
// Reloads the current page and verifies that the URL stays correct
|
|
export const expectUrlPersistsReload = async (page: Page) => {
|
|
const url = page.url();
|
|
await page.reload();
|
|
await expect(page).toHaveURL(url);
|
|
};
|
|
|
|
// Navigates back, checks the URL and navigates forward back to the initial page
|
|
export const expectBackAndForwardNavigationWorks = async (
|
|
beforeURL: string,
|
|
page: Page,
|
|
) => {
|
|
const currentURL = page.url();
|
|
|
|
await page.goBack();
|
|
await page
|
|
.getByRole("progressbar", { name: "Page loading" })
|
|
.waitFor({ state: "hidden" });
|
|
await expect(page).toHaveURL(beforeURL);
|
|
await page.goForward();
|
|
|
|
await page
|
|
.getByRole("progressbar", { name: "Page loading" })
|
|
.waitFor({ state: "hidden" });
|
|
await expect(page).toHaveURL(currentURL);
|
|
};
|