Skip to content

Commit

Permalink
Add more tests for the manager view
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Nov 20, 2023
1 parent c5d1103 commit 62e541c
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 10 deletions.
42 changes: 37 additions & 5 deletions tests/anonymous/manager/app.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,43 @@

import { test, expect } from "@playwright/test";

test("basic manager rendering", async ({ page }) => {
await page.goto("/app");
test.describe("manager tests", () => {
test("rendering", async ({ page }) => {
await page.goto("/app");

const url = new URL(page.url());
expect(url.pathname).toBe("/app");
const url = new URL(page.url());
expect(url.pathname).toBe("/app");

await expect(page).toHaveTitle("DocumentCloud");
await expect(page).toHaveTitle("DocumentCloud");

// anonymous message header
await expect(
page.getByRole("heading", {
name: "Welcome to DocumentCloud, an open document archive from MuckRock!",
}),
).toBeVisible();

// close the overlay
await page.getByRole("button").nth(3).click();

// can we see documents?
await expect(page.locator(".outer > div").first()).toBeVisible();
});

test("menus", async ({ page }) => {
await page.goto("/app");

// help
await page.getByText("Help ▼").click();
await expect(page.getByRole("button", { name: "FAQ" })).toBeVisible();

// close the menu
await page.locator(".shim").click();

// language
await page.getByText("Language ▼").click();
await expect(page.getByRole("button", { name: "English ✓" })).toBeVisible();

await page.locator(".shim").click();
});
});
8 changes: 8 additions & 0 deletions tests/anonymous/pages/home.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ test("basic homepage test", async ({ page }) => {
await page.goto("/home");

await expect(page).toHaveTitle("Home | DocumentCloud");

// go to the app
await page.getByRole("banner").getByRole("link").first().click();

// and back
await page.getByRole("link", { name: "Home" }).click();

await expect(page).toHaveTitle("Home | DocumentCloud");
});
6 changes: 1 addition & 5 deletions tests/anonymous/viewer/document.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ test.describe("document tests", () => {
.selectOption("text");

// check that text view loaded
/*
await expect(page.locator(".text").first()).toHaveText(
text.pages[0].contents,
);
*/
await expect(page.locator(".text").first()).toBeVisible();

// switch to thumbnail view, click the first image
await page.getByRole("combobox").selectOption("thumbnail");
Expand Down

0 comments on commit 62e541c

Please sign in to comment.