Skip to content

Commit

Permalink
[SPRINT] Polish result & OK24 (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
av-mads authored Jan 18, 2024
2 parents 9f3ab5e + 21e3cc1 commit c23119c
Show file tree
Hide file tree
Showing 25 changed files with 216 additions and 221 deletions.
4 changes: 2 additions & 2 deletions client/e2e/locales.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test("changing locale", async ({ page, isMobile }) => {
const url = route.request().url();

// Intercept DBB latest config calls
if (url.indexOf("us3/configuration/latest_config") > 0) {
if (url.indexOf("board_slug/configuration/latest_config") > 0) {
return route.fulfill({
status: 200,
contentType: "application/json",
Expand All @@ -27,7 +27,7 @@ test("changing locale", async ({ page, isMobile }) => {
return route.continue();
});

await page.goto("/en/us3");
await page.goto("/en/organisation_slug/election_slug");

if (isMobile) {
await page.locator(".Header__Hamburger_Btn").click();
Expand Down
14 changes: 7 additions & 7 deletions client/e2e/logs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test("downloading logs", async ({ page, isMobile }) => {
const url = route.request().url();

// Intercept DBB latest config calls
if (url.indexOf("us3/configuration/latest_config") > 0) {
if (url.indexOf("board_slug/configuration/latest_config") > 0) {
return route.fulfill({
status: 200,
contentType: "application/json",
Expand All @@ -21,7 +21,7 @@ test("downloading logs", async ({ page, isMobile }) => {
}

// Intercept download request
if (url.indexOf("us3/download_log") > 0) {
if (url.indexOf("board_slug/download_log") > 0) {
return route.fulfill({
status: 200,
contentType: "application/octet-stream",
Expand All @@ -41,7 +41,7 @@ test("downloading logs", async ({ page, isMobile }) => {
return route.continue();
});

await page.goto("/en/us3");
await page.goto("/en/organisation_slug/election_slug");
if (isMobile) {
await page.locator(".Header__Hamburger_Btn").click();
}
Expand All @@ -65,7 +65,7 @@ test("traversing board items", async ({ page, isMobile }) => {
const url = route.request().url();

// Intercept DBB latest config calls
if (url.indexOf("us3/configuration/latest_config") > 0) {
if (url.indexOf("board_slug/configuration/latest_config") > 0) {
return route.fulfill({
status: 200,
contentType: "application/json",
Expand All @@ -74,7 +74,7 @@ test("traversing board items", async ({ page, isMobile }) => {
}

// Intercept page 1 of the board
if (url.indexOf("us3/board?page=1") > 0) {
if (url.indexOf("board_slug/board?page=1") > 0) {
return route.fulfill({
status: 200,
contentType: "application/octet-stream",
Expand All @@ -83,7 +83,7 @@ test("traversing board items", async ({ page, isMobile }) => {
}

// Intercept page 2 of the board
if (url.indexOf("us3/board?page=2") > 0) {
if (url.indexOf("board_slug/board?page=2") > 0) {
return route.fulfill({
status: 200,
contentType: "application/octet-stream",
Expand All @@ -103,7 +103,7 @@ test("traversing board items", async ({ page, isMobile }) => {
return route.continue();
});

await page.goto("/en/us3");
await page.goto("/en/organisation_slug/election_slug");
if (isMobile) {
await page.locator(".Header__Hamburger_Btn").click();
}
Expand Down
13 changes: 8 additions & 5 deletions client/e2e/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export const boardItemsPage2 = {
export const status = {
election: {
id: 2,
slug: "93b0d474",
slug: "election_slug",
organisation_slug: "organisation_slug",
title: {
en: "Funny Election",
es: "Elección divertida",
Expand All @@ -92,11 +93,13 @@ export const status = {
trustMode: "verifiable",
enabledLocales: ["en", "da", "de", "es"],
readyForVoting: true,
boardSlug: "voting_93b0d474",
boardUrl: "http://dbb:3003/voting_93b0d474",
boardSlug: "board_slug",
boardUrl: "http://dbb:3003/board_slug",
dbasUrl: "http://localhost:3010",
electionClientUrl: "http://localhost:9080/#/e/voting/93b0d474",
statisticsClientUrl: "http://localhost:5173/voting/93b0d474",
electionClientUrl:
"http://localhost:9080/e/organisation_slug/election_slug",
statisticsClientUrl:
"http://localhost:5173/organisation_slug/election_slug",
hide_dbas: false,
hideBenaloh: false,
},
Expand Down
12 changes: 6 additions & 6 deletions client/e2e/trackBallot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test("tracking a ballot", async ({ page }) => {
const url = route.request().url();

// Intercept DBB latest config calls
if (url.indexOf("us3/configuration/latest_config") > 0) {
if (url.indexOf("board_slug/configuration/latest_config") > 0) {
return route.fulfill({
status: 200,
contentType: "application/json",
Expand All @@ -16,7 +16,7 @@ test("tracking a ballot", async ({ page }) => {
}

// Intercept DBB ballot status calls
if (url.indexOf("us3/ballot_status") > 0) {
if (url.indexOf("board_slug/ballot_status") > 0) {
return route.fulfill({
status: 200,
contentType: "application/json",
Expand All @@ -36,7 +36,7 @@ test("tracking a ballot", async ({ page }) => {
return route.continue();
});

await page.goto("/en/us3/track");
await page.goto("/en/organisation_slug/election_slug/track");
await expect(page.locator("h3")).toHaveText("Ballot Tracker");
await page.getByPlaceholder("Tracking code").fill("5ksv8Ee");
await page.getByRole("button", { name: "Track my ballot" }).click();
Expand All @@ -51,7 +51,7 @@ test("tracking a non-existing ballot shows an error", async ({ page }) => {
const url = route.request().url();

// Intercept DBB latest config calls
if (url.indexOf("us3/configuration/latest_config") > 0) {
if (url.indexOf("board_slug/configuration/latest_config") > 0) {
return route.fulfill({
status: 200,
contentType: "application/json",
Expand All @@ -60,7 +60,7 @@ test("tracking a non-existing ballot shows an error", async ({ page }) => {
}

// Intercept DBB ballot status calls
if (url.indexOf("us3/ballot_status") > 0) {
if (url.indexOf("board_slug/ballot_status") > 0) {
return route.fulfill({
status: 404,
contentType: "application/json",
Expand All @@ -80,7 +80,7 @@ test("tracking a non-existing ballot shows an error", async ({ page }) => {
return route.continue();
});

await page.goto("/en/us3/track");
await page.goto("/en/organisation_slug/election_slug/track");
await expect(page.locator("h3")).toHaveText("Ballot Tracker");
await page.getByPlaceholder("Tracking code").fill("abcdef");
await page.getByRole("button", { name: "Track my ballot" }).click();
Expand Down
12 changes: 7 additions & 5 deletions client/e2e/verifyBallot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test("verifying a ballot", async ({ page }) => {
const url = route.request().url();

// Intercept DBB latest config calls
if (url.indexOf("us3/configuration/latest_config") > 0) {
if (url.indexOf("board_slug/configuration/latest_config") > 0) {
return route.fulfill({
status: 200,
contentType: "application/json",
Expand All @@ -27,7 +27,7 @@ test("verifying a ballot", async ({ page }) => {
return route.continue();
});

await page.goto("/en/us3/verify");
await page.goto("/en/organisation_slug/election_slug/verify");
await expect(page.locator("h3")).toHaveText("Ballot Tester");
await page.getByPlaceholder("Testing code").fill("5ksv8Ee");
await page.getByRole("button", { name: "Start the Test" }).click();
Expand All @@ -39,7 +39,7 @@ test("verifying with an invalid verification code", async ({ page }) => {
const url = route.request().url();

// Intercept DBB latest config calls
if (url.indexOf("us3/configuration/latest_config") > 0) {
if (url.indexOf("board_slug/configuration/latest_config") > 0) {
return route.fulfill({
status: 200,
contentType: "application/json",
Expand All @@ -48,7 +48,9 @@ test("verifying with an invalid verification code", async ({ page }) => {
}

// Intercept DBB verification lookup call
if (url.indexOf("us3/verification/vote_track") > 0) {
if (
url.indexOf("organisation_slug/election_slug/verification/vote_track") > 0
) {
return route.fulfill({
status: 404,
contentType: "application/json",
Expand All @@ -68,7 +70,7 @@ test("verifying with an invalid verification code", async ({ page }) => {
return route.continue();
});

await page.goto("/en/us3/verify");
await page.goto("/en/organisation_slug/election_slug/verify");
await expect(page.locator("h3")).toHaveText("Ballot Tester");
await page.getByPlaceholder("Testing code").fill("invalid-code");
await page.getByRole("button", { name: "Start the Test" }).click();
Expand Down
2 changes: 1 addition & 1 deletion client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/>
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DBAS</title>
<title>Election Verification Site</title>

<!-- Start Google fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
Expand Down
Loading

0 comments on commit c23119c

Please sign in to comment.