From 59eb6d3cf430c6737f14d567f7e5df6cc1ea6f82 Mon Sep 17 00:00:00 2001 From: Carine Dengler Date: Tue, 12 Dec 2023 18:03:16 +0100 Subject: [PATCH 1/6] test: add evoting API mock --- web/frontend/tests/mocks.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/web/frontend/tests/mocks.ts b/web/frontend/tests/mocks.ts index 675f48a72..21a45d21d 100644 --- a/web/frontend/tests/mocks.ts +++ b/web/frontend/tests/mocks.ts @@ -50,3 +50,25 @@ export async function mockProxy(page: any) { }); }); } + +export async function mockEvoting(page: any, numberForms: number) { + await page.route(`${process.env.DELA_PROXY_URL}/evoting/forms`, async (route) => { + if route.request().method() === 'OPTIONS' { + await route.fulfill({ + status: 200, + headers: { + 'Access-Control-Allow-Headers': '*', + 'Access-Control-Allow-Origin': '*', + } + }); + } + else { + await page.routeFromHAR( + `./tests/hars/forms/${numberForms}.har`, + { + url: `${process.env.DELA_PROXY_URL}/evoting/forms`, + update: UPDATE + }); + } + }); +} From 055c2f3aa561459d0d51405133adf98223c92e8a Mon Sep 17 00:00:00 2001 From: Carine Dengler Date: Wed, 13 Dec 2023 10:35:25 +0100 Subject: [PATCH 2/6] test: add /form/index route tests for navbar/footer --- web/frontend/src/layout/NavBar.tsx | 2 +- web/frontend/tests/formIndex.spec.ts | 23 +++++++++++++++++++++++ web/frontend/tests/shared.ts | 8 ++++++-- 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 web/frontend/tests/formIndex.spec.ts diff --git a/web/frontend/src/layout/NavBar.tsx b/web/frontend/src/layout/NavBar.tsx index fc2721824..0ced61ff2 100644 --- a/web/frontend/src/layout/NavBar.tsx +++ b/web/frontend/src/layout/NavBar.tsx @@ -240,7 +240,7 @@ const NavBar: FC = () => { }; return ( -