Files
Rūdolfs Ošiņš 086afbb5dc Give each e2e test its own reliable peer
The page always talked to the shared palm backend, so tests couldn't set
up peers of their own. Peers now have no passphrase by default, so tests
don't need an ssh-agent and test keys stay out of the developer's agent.
Fixtures wait for replication instead of relying on gossip timing, and a
request cancelled by a reload no longer counts as a page error.
2026-10-01 18:16:29 +02:00

31 lines
893 B
TypeScript

import type { Page } from "@playwright/test";
import { expect, reload } 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 reload(page);
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);
};