36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { test, expect } from "@playwright/test";
|
|
import { loginAs } from "./helpers/login";
|
|
|
|
test.describe("Quiz System", () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await loginAs(page, "joey");
|
|
});
|
|
|
|
test("dashboard shows start labeling button", async ({ page }) => {
|
|
await expect(page.getByText("Start Labeling Session")).toBeVisible();
|
|
});
|
|
|
|
test("clicking start session navigates to quiz", async ({ page }) => {
|
|
await page.getByText("Start Labeling Session").click();
|
|
await page.waitForURL("/quiz");
|
|
});
|
|
|
|
test("quiz page shows start quiz button", async ({ page }) => {
|
|
await page.goto("/quiz");
|
|
await expect(
|
|
page.getByRole("button", { name: /start quiz/i }),
|
|
).toBeVisible();
|
|
});
|
|
|
|
test("quiz shows 8 questions and allows answering", async ({ page }) => {
|
|
await page.goto("/quiz");
|
|
await page.getByRole("button", { name: /start quiz/i }).click();
|
|
|
|
// Should show question 1 of 8
|
|
await expect(page.getByText(/question 1 of 8/i)).toBeVisible();
|
|
|
|
// Should show paragraph text and radio options
|
|
await expect(page.locator('[data-slot="radio-group"]')).toBeVisible();
|
|
});
|
|
});
|