Files
radicle-explorer/tests/e2e/search.spec.ts
T
Sebastian Martinez 2498ef7c9e Fix some router issues
- Clicking on the project in various places goes now to `../<rid>`
  instead of `../<rid>/tree/<commit>`
- Project URL on seed allows trailing slash, eg. `../<rid>/`
- Navigating to a project URL with a `remotes/<nodeId>` suffix works now
  correctly w or w/o trailing slash

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-07 12:53:17 +01:00

33 lines
934 B
TypeScript

import {
test,
expect,
rid,
projectFixtureUrl,
} from "@tests/support/fixtures.js";
test("navigate to existing project", async ({ page }) => {
await page.goto("/");
const searchInput = page.getByPlaceholder("Search a name…");
await searchInput.click();
await searchInput.fill(`${rid}`);
await searchInput.press("Enter");
await expect(page).toHaveURL(projectFixtureUrl);
await expect(searchInput).not.toHaveValue(`${rid}`);
});
test("navigate to a project that does not exist", async ({ page }) => {
await page.goto("/");
const searchInput = page.getByPlaceholder("Search a name…");
await searchInput.click();
const nonExistantId = "rad:zAAAAAAAAAAAAAAAAAAAAAAAAAAA";
await searchInput.fill(nonExistantId);
await searchInput.press("Enter");
await page.waitForSelector(".search-bar.shaking");
await expect(page).toHaveURL("/");
await expect(searchInput).toHaveValue(nonExistantId);
});