Skip to content

Commit 27cbb2f

Browse files
[107] code cleanup and further stabilization
1 parent 3f317bd commit 27cbb2f

File tree

5 files changed

+389
-382
lines changed

5 files changed

+389
-382
lines changed

package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/e2e/debate-setup-utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ async function fillAndCheckTextBox(
101101
let actualInputValue = "";
102102
while (actualInputValue != desiredInput) {
103103
await locator.fill(desiredInput);
104+
await page.waitForTimeout(500);
104105
const actualInputValue = await locator.inputValue();
105106
if (actualInputValue == desiredInput) {
106107
return actualInputValue;

tests/e2e/debate-setup.test.ts

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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+
});

tests/e2e/debate-view.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import {
77
manuallyChangeTime,
88
} from "./debate-setup-utils";
99

10+
test.describe.configure({ retries: 3 });
11+
1012
test("configured strings should be visible in debate view", async ({
1113
page,
12-
}) => {
14+
}, testinfo) => {
1315
// GIVEN
1416
const url = "http://localhost:3000/oxford-debate/setup";
1517
const propositionTeam = "Wyścigówki Kubicy";
@@ -39,6 +41,8 @@ test("configured strings should be visible in debate view", async ({
3941
expect(await getTeamName("Opposition", page)).toBe(oppositionTeam);
4042
}
4143
await expect(page.getByText(motion)).toBeVisible();
44+
const screenshot = await page.screenshot({ fullPage: true });
45+
testinfo.attach("debate view", { body: screenshot });
4246
});
4347

4448
test("debate configuration should persist after page changes", async ({

0 commit comments

Comments
 (0)