Files
radicle-explorer/tests/e2e/search.spec.ts
T
2023-04-20 08:36:16 +02:00

34 lines
985 B
TypeScript

import { searchPlaceholder } from "@app/lib/shared";
import {
test,
expect,
rid,
projectFixtureUrl,
} from "@tests/support/fixtures.js";
test("navigate to existing project", async ({ page }) => {
await page.goto("/");
const searchInput = page.getByPlaceholder(searchPlaceholder);
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(searchPlaceholder);
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);
});