Skip to content

Commit

Permalink
Init corpus spec
Browse files Browse the repository at this point in the history
  • Loading branch information
arildm committed Mar 5, 2025
1 parent c18088a commit de8705d
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions test/e2e/init-corpus.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { test, expect } from "@playwright/test"
import { describe } from "node:test"

describe("init corpus selection", () => {
test("none selected", async ({ page }) => {
await page.goto("/#?lang=eng&corpus=")
await expect(page.locator("corpus-chooser")).toContainText("23 of")
})

test("few selected", async ({ page }) => {
await page.goto("/#?lang=eng&corpus=attasidor,da")
await expect(page.locator("corpus-chooser")).toContainText("2 of")
})

test("some nonexisting", async ({ page }) => {
await page.goto("/#?lang=eng&corpus=attasidor,da,abc")
await expect(page.getByRole("dialog")).toContainText("Some selected corpora are not available")
await page.getByRole("button").click()
await expect(page.locator("corpus-chooser")).toContainText("2 of")
})

test("all nonexisting", async ({ page }) => {
await page.goto("/#?lang=eng&corpus=abc,def")
await expect(page.getByRole("dialog")).toContainText("Some selected corpora are not available")
await page.getByRole("button").click()
await expect(page.locator("corpus-chooser")).toContainText("23 of")
})

test("some protected", async ({ page }) => {
await page.goto("/#?lang=eng&corpus=attasidor,da,asu")
await expect(page.getByRole("dialog")).toContainText("Login needed")
await page.getByRole("button").click()
// Dismiss login prompt
await page.locator(".close-x").click()
await expect(page.locator("corpus-chooser")).toContainText("2 of")
})

test("all protected", async ({ page }) => {
await page.goto("/#?lang=eng&corpus=asu")
await expect(page.getByRole("dialog")).toContainText("Login needed")
await page.getByRole("button").click()
// Dismiss login prompt
await page.locator(".close-x").click()
await expect(page.locator("corpus-chooser")).toContainText("23 of")
})
})

0 comments on commit de8705d

Please sign in to comment.