Files
radicle-explorer/tests/support/router.ts
T
Rūdolfs OšiņšandSebastian Martinez 9cb9332e88 Replace Cypress with Playwright
Playwright is more flexible and has better developer experience than Cypress.
We add end to end tests covering:

  - project source browsing
    - tree view
    - commit list view
    - commit view
  - routing
    - hash based
    - history API based
  - clipboard copy paste functionality
  - seed view
  - project search
  - landing page view
  - settings

Co-authored-by: Sebastian Martinez <me@sebastinez.dev>
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2022-12-01 15:54:56 +01:00

22 lines
675 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 expect(page).toHaveURL(beforeURL);
await page.goForward();
await expect(page).toHaveURL(currentURL);
};