Skip to content

Commit 3f317bd

Browse files
[107] stabilize remaining tests
1 parent 988056a commit 3f317bd

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

tests/e2e/debate-setup-utils.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,23 @@ async function fillAndCheckTextBox(
110110
}
111111
}
112112

113+
async function getConfiguredSoundPack(expectedValue: string, page: Page) {
114+
let soundPack = null;
115+
const soundPackElement = page.getByText(expectedValue);
116+
soundPack = await soundPackElement.textContent();
117+
while (soundPack != expectedValue) {
118+
await page.waitForTimeout(RETRY_TIMEOUT); // This is necessary, as URL params are usually parsed with a slight delay
119+
soundPack = await soundPackElement.inputValue();
120+
}
121+
return soundPack;
122+
}
123+
113124
export {
114125
getMotion as getConfiguredMotion,
115126
getTeamName as getConfiguredTeamName,
116127
getTimeAsSeenByUser,
117128
manuallyChangeTime,
118129
getBooleanButtonValue,
119130
fillAndCheckTextBox,
131+
getConfiguredSoundPack,
120132
};

tests/e2e/url-params-parsing.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
fillAndCheckTextBox,
44
getBooleanButtonValue,
55
getConfiguredMotion,
6+
getConfiguredSoundPack,
67
getConfiguredTeamName,
78
getTimeAsSeenByUser,
89
manuallyChangeTime,
@@ -326,6 +327,7 @@ test("url params: copy motion to clipboard", async ({
326327
const propositionTeam = "Wyścigówki Kubicy";
327328
const oppositionTeam = "Gorsze Wyścigówki Kubicy";
328329
const motion = "Należy żałować.";
330+
const soundPackName = "ZTM Poznań";
329331

330332
// WHEN
331333
await page.goto(url);
@@ -344,7 +346,7 @@ test("url params: copy motion to clipboard", async ({
344346
await manuallyChangeTime("Protected", "second", "decrease", page);
345347
await page.getByRole("button", { name: "Beep on speech end" }).click();
346348
await page.getByRole("button", { name: "Default" }).click();
347-
await page.getByText("ZTM Poznań").click();
349+
await page.getByText(soundPackName).click();
348350
await page.getByRole("button", { name: "Copy debate" }).click();
349351
page.getByText("Debate link copied to clipboard");
350352

@@ -381,7 +383,7 @@ test("url params: copy motion to clipboard", async ({
381383
expect(await getBooleanButtonValue("Beep on speech end", false, page)).toBe(
382384
false
383385
);
384-
expect(page.getByText("ZTM Poznań")).toBeVisible();
386+
expect(await getConfiguredSoundPack(soundPackName, page));
385387
});
386388

387389
test("url params: soundPacks", async ({ page }) => {
@@ -396,5 +398,5 @@ test("url params: soundPacks", async ({ page }) => {
396398
await page.waitForURL(url);
397399

398400
// THEN
399-
expect(page.getByText(soundPackName)).toBeVisible();
401+
expect(await getConfiguredSoundPack(soundPackName, page)).toBe(soundPackName);
400402
});

0 commit comments

Comments
 (0)