summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2023-02-27 10:06:45 +0100
committerOskar Nyberg <oskar@mullvad.net>2023-02-27 10:06:45 +0100
commitf49760525dbd4bfb5e19a0231d1d8b7a41f76ce1 (patch)
tree1be5586f97d23d154a0d245a115af708761174e1
parenta0d5aa28ad71e340bfa002c83285235ec74cea68 (diff)
parentc7a47757e8208ff7b3b809621680aa79abc9f4f3 (diff)
downloadmullvadvpn-f49760525dbd4bfb5e19a0231d1d8b7a41f76ce1.tar.xz
mullvadvpn-f49760525dbd4bfb5e19a0231d1d8b7a41f76ce1.zip
Merge branch 'fix-e2e-tests-failing'
-rw-r--r--gui/src/renderer/components/ExpiredAccountAddTime.tsx3
-rw-r--r--gui/src/renderer/components/KeyboardNavigation.tsx3
-rw-r--r--gui/src/renderer/lib/history.tsx3
-rw-r--r--gui/src/renderer/lib/routeHelpers.ts24
-rw-r--r--gui/src/renderer/lib/routes.ts23
-rw-r--r--gui/standalone-tests.pkg.json1
-rw-r--r--gui/test/e2e/utils.ts13
7 files changed, 32 insertions, 38 deletions
diff --git a/gui/src/renderer/components/ExpiredAccountAddTime.tsx b/gui/src/renderer/components/ExpiredAccountAddTime.tsx
index 57a3856dce..2c593217b8 100644
--- a/gui/src/renderer/components/ExpiredAccountAddTime.tsx
+++ b/gui/src/renderer/components/ExpiredAccountAddTime.tsx
@@ -10,7 +10,8 @@ import { messages } from '../../shared/gettext';
import { useAppContext } from '../context';
import useActions from '../lib/actionsHook';
import { transitions, useHistory } from '../lib/history';
-import { generateRoutePath, RoutePath } from '../lib/routes';
+import { generateRoutePath } from '../lib/routeHelpers';
+import { RoutePath } from '../lib/routes';
import account from '../redux/account/actions';
import { useSelector } from '../redux/store';
import * as AppButton from './AppButton';
diff --git a/gui/src/renderer/components/KeyboardNavigation.tsx b/gui/src/renderer/components/KeyboardNavigation.tsx
index b98f57b4ce..f88b4f31e9 100644
--- a/gui/src/renderer/components/KeyboardNavigation.tsx
+++ b/gui/src/renderer/components/KeyboardNavigation.tsx
@@ -2,7 +2,8 @@ import React, { useCallback, useContext, useEffect, useMemo, useState } from 're
import { useLocation } from 'react-router';
import { useHistory } from '../lib/history';
-import { disableDismissForRoutes, RoutePath } from '../lib/routes';
+import { disableDismissForRoutes } from '../lib/routeHelpers';
+import { RoutePath } from '../lib/routes';
interface IKeyboardNavigationProps {
children: React.ReactElement | Array<React.ReactElement>;
diff --git a/gui/src/renderer/lib/history.tsx b/gui/src/renderer/lib/history.tsx
index 68cbbcf482..159e597cce 100644
--- a/gui/src/renderer/lib/history.tsx
+++ b/gui/src/renderer/lib/history.tsx
@@ -2,7 +2,8 @@ import { Action, History as OriginalHistory, Location, LocationDescriptorObject
import { useHistory as useReactRouterHistory } from 'react-router';
import { IHistoryObject, LocationState } from '../../shared/ipc-types';
-import { GeneratedRoutePath, RoutePath } from './routes';
+import { GeneratedRoutePath } from './routeHelpers';
+import { RoutePath } from './routes';
export interface ITransitionSpecification {
name: string;
diff --git a/gui/src/renderer/lib/routeHelpers.ts b/gui/src/renderer/lib/routeHelpers.ts
new file mode 100644
index 0000000000..50c5867768
--- /dev/null
+++ b/gui/src/renderer/lib/routeHelpers.ts
@@ -0,0 +1,24 @@
+import { generatePath } from 'react-router';
+
+import { RoutePath } from './routes';
+
+export type GeneratedRoutePath = { routePath: string };
+
+export const disableDismissForRoutes = [
+ RoutePath.launch,
+ RoutePath.login,
+ RoutePath.tooManyDevices,
+ RoutePath.deviceRevoked,
+ RoutePath.main,
+ RoutePath.redeemVoucher,
+ RoutePath.voucherSuccess,
+ RoutePath.timeAdded,
+ RoutePath.setupFinished,
+];
+
+export function generateRoutePath(
+ routePath: RoutePath,
+ parameters: Parameters<typeof generatePath>[1],
+): GeneratedRoutePath {
+ return { routePath: generatePath(routePath, parameters) };
+}
diff --git a/gui/src/renderer/lib/routes.ts b/gui/src/renderer/lib/routes.ts
index eaefb26c67..a0248d940e 100644
--- a/gui/src/renderer/lib/routes.ts
+++ b/gui/src/renderer/lib/routes.ts
@@ -1,7 +1,3 @@
-import { generatePath } from 'react-router';
-
-export type GeneratedRoutePath = { routePath: string };
-
export enum RoutePath {
launch = '/',
login = '/login',
@@ -26,22 +22,3 @@ export enum RoutePath {
selectLocation = '/select-location',
filter = '/select-location/filter',
}
-
-export const disableDismissForRoutes = [
- RoutePath.launch,
- RoutePath.login,
- RoutePath.tooManyDevices,
- RoutePath.deviceRevoked,
- RoutePath.main,
- RoutePath.redeemVoucher,
- RoutePath.voucherSuccess,
- RoutePath.timeAdded,
- RoutePath.setupFinished,
-];
-
-export function generateRoutePath(
- routePath: RoutePath,
- parameters: Parameters<typeof generatePath>[1],
-): GeneratedRoutePath {
- return { routePath: generatePath(routePath, parameters) };
-}
diff --git a/gui/standalone-tests.pkg.json b/gui/standalone-tests.pkg.json
index 1b91ca8495..8be6b53d5a 100644
--- a/gui/standalone-tests.pkg.json
+++ b/gui/standalone-tests.pkg.json
@@ -1,6 +1,7 @@
{
"assets": [
"build/src/config.json",
+ "build/src/renderer/lib/routes.js",
"build/test/e2e/utils.js",
"build/test/e2e/shared/*.js",
"build/test/e2e/installed/**/*.js",
diff --git a/gui/test/e2e/utils.ts b/gui/test/e2e/utils.ts
index feec4e8b3c..b0e4f9ec0f 100644
--- a/gui/test/e2e/utils.ts
+++ b/gui/test/e2e/utils.ts
@@ -38,18 +38,7 @@ export const startApp = async (options: LaunchOptions): Promise<StartAppResponse
export const launch = async (options: LaunchOptions): Promise<ElectronApplication> => {
process.env.CI = 'e2e';
- const app = await electron.launch(options);
-
- await app.evaluate(({ webContents }) => {
- return new Promise((resolve) => {
- webContents.getAllWebContents()
- // Select window that isn't devtools
- .find((webContents) => webContents.getURL().startsWith('file://'))!
- .once('did-finish-load', resolve);
- });
- });
-
- return app;
+ return await electron.launch(options);
}
const currentRouteFactory = (app: ElectronApplication) => {