mirror of
https://seed.radicle.dev/rad:z4D5UCArafTzTQpDZNQRuqswh3ury.git
synced 2026-11-10 05:40:38 +08:00
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.
31 lines
893 B
TypeScript
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);
|
|
};
|