From 721afa4aa4679875243f3a4b5159030566b621f5 Mon Sep 17 00:00:00 2001 From: Michal Zielenkiewicz Date: Wed, 6 Nov 2024 12:57:08 +0100 Subject: [PATCH] Override API in e2e tests to allow quick backend switch --- .changelog/2089.internal.md | 1 + playwright/utils/mockApi.ts | 1 + .../Footer/__tests__/index.test.tsx | 6 ----- .../AccountPage/__tests__/index.test.tsx | 2 +- src/types/env.d.ts | 26 +++++++++++++------ src/vendors/backend.ts | 5 +++- 6 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 .changelog/2089.internal.md diff --git a/.changelog/2089.internal.md b/.changelog/2089.internal.md new file mode 100644 index 0000000000..fc7c6ba7eb --- /dev/null +++ b/.changelog/2089.internal.md @@ -0,0 +1 @@ +Override API in e2e tests to allow quick backend switch diff --git a/playwright/utils/mockApi.ts b/playwright/utils/mockApi.ts index a2f8e3f210..a5be1a9690 100644 --- a/playwright/utils/mockApi.ts +++ b/playwright/utils/mockApi.ts @@ -9,6 +9,7 @@ import type { } from '../../src/vendors/oasisscan/index' export async function mockApi(context: BrowserContext | Page, balance: number) { + await context.addInitScript(() => ((window as any).REACT_APP_BACKEND = 'oasisscan')) await context.route('**/chain/account/info/*', route => { route.fulfill({ body: JSON.stringify({ diff --git a/src/app/components/Footer/__tests__/index.test.tsx b/src/app/components/Footer/__tests__/index.test.tsx index ce7bafb176..8f93fe9be3 100644 --- a/src/app/components/Footer/__tests__/index.test.tsx +++ b/src/app/components/Footer/__tests__/index.test.tsx @@ -60,12 +60,6 @@ describe('