|
| 1 | +import { test, expect } from "@playwright/test"; |
| 2 | +import { |
| 3 | + getConfiguredMotion, |
| 4 | + getConfiguredSoundPack, |
| 5 | + getConfiguredTeamName, |
| 6 | + getTimeAsSeenByUser, |
| 7 | +} from "./debate-setup-utils"; |
| 8 | +test.describe("default debate setup", () => { |
| 9 | + test("time inputs: minutes", async ({ page }) => { |
| 10 | + // GIVEN |
| 11 | + const url = "http://localhost:3000/oxford-debate/setup"; |
| 12 | + await page.goto(url); |
| 13 | + await page.waitForURL(url); |
| 14 | + |
| 15 | + // WHEN |
| 16 | + const minutes = await getTimeAsSeenByUser("Speech", 5, "minute", page); |
| 17 | + const protectedTime = await getTimeAsSeenByUser( |
| 18 | + "Protected", |
| 19 | + 0, |
| 20 | + "minute", |
| 21 | + page |
| 22 | + ); |
| 23 | + const adVocem = await getTimeAsSeenByUser("Ad vocem", 1, "minute", page); |
| 24 | + |
| 25 | + // THEN |
| 26 | + expect(minutes).toBe("5 minutes"); |
| 27 | + expect(protectedTime).toBe("0 minutes"); |
| 28 | + expect(adVocem).toBe("1 minute"); |
| 29 | + }); |
| 30 | + |
| 31 | + test("time inputs: seconds", async ({ page }) => { |
| 32 | + // GIVEN |
| 33 | + const url = "http://localhost:3000/oxford-debate/setup"; |
| 34 | + await page.goto(url); |
| 35 | + await page.waitForURL(url); |
| 36 | + |
| 37 | + // WHEN |
| 38 | + const minutes = await getTimeAsSeenByUser("Speech", 0, "second", page); |
| 39 | + const protectedTime = await getTimeAsSeenByUser( |
| 40 | + "Protected", |
| 41 | + 30, |
| 42 | + "second", |
| 43 | + page |
| 44 | + ); |
| 45 | + const adVocem = await getTimeAsSeenByUser("Ad vocem", 0, "second", page); |
| 46 | + |
| 47 | + // THEN |
| 48 | + expect(minutes).toBe("0 seconds"); |
| 49 | + expect(protectedTime).toBe("30 seconds"); |
| 50 | + expect(adVocem).toBe("0 seconds"); |
| 51 | + }); |
| 52 | + |
| 53 | + test("team names", async ({ page }) => { |
| 54 | + // GIVEN |
| 55 | + const url = "http://localhost:3000/oxford-debate/setup"; |
| 56 | + await page.goto(url); |
| 57 | + await page.waitForURL(url); |
| 58 | + |
| 59 | + // WHEN |
| 60 | + const proposition = await getConfiguredTeamName("Proposition", page, true); |
| 61 | + const opposition = await getConfiguredTeamName("Opposition", page, true); |
| 62 | + |
| 63 | + // THEN |
| 64 | + expect(proposition).toBe(""); |
| 65 | + expect(opposition).toBe(""); |
| 66 | + }); |
| 67 | + |
| 68 | + test("motion", async ({ page }) => { |
| 69 | + // GIVEN |
| 70 | + const url = "http://localhost:3000/oxford-debate/setup"; |
| 71 | + await page.goto(url); |
| 72 | + await page.waitForURL(url); |
| 73 | + |
| 74 | + // WHEN |
| 75 | + const motion = await getConfiguredMotion(page, true); |
| 76 | + |
| 77 | + // THEN |
| 78 | + expect(motion).toBe(""); |
| 79 | + }); |
| 80 | + |
| 81 | + test("sound pack", async ({ page }) => { |
| 82 | + // GIVEN |
| 83 | + const url = "http://localhost:3000/oxford-debate/setup"; |
| 84 | + const defaultSoundPackName = "Default"; |
| 85 | + await page.goto(url); |
| 86 | + await page.waitForURL(url); |
| 87 | + |
| 88 | + // WHEN |
| 89 | + const actualSoundPackName = await getConfiguredSoundPack( |
| 90 | + defaultSoundPackName, |
| 91 | + page |
| 92 | + ); |
| 93 | + |
| 94 | + // THEN |
| 95 | + expect(actualSoundPackName).toBe(defaultSoundPackName); |
| 96 | + }); |
| 97 | +}); |
0 commit comments