summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/api-access-methods.spec.ts22
-rw-r--r--desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/custom-bridge.spec.ts63
-rw-r--r--desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/device-revoked.spec.ts7
-rw-r--r--desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/login.spec.ts61
-rw-r--r--desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/macos-split-tunneling.spec.ts8
-rw-r--r--desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/obfuscation.spec.ts38
-rw-r--r--desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/settings-import.spec.ts54
-rw-r--r--desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/settings.spec.ts7
-rw-r--r--desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/too-many-devices.spec.ts17
-rw-r--r--desktop/packages/mullvad-vpn/test/e2e/mocked/expired-account-error-view.spec.ts13
-rw-r--r--desktop/packages/mullvad-vpn/test/e2e/mocked/select-location.spec.ts4
-rw-r--r--desktop/packages/mullvad-vpn/test/e2e/mocked/settings.spec.ts4
12 files changed, 139 insertions, 159 deletions
diff --git a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/api-access-methods.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/api-access-methods.spec.ts
index a447b5975e..a18d1248ef 100644
--- a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/api-access-methods.spec.ts
+++ b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/api-access-methods.spec.ts
@@ -32,8 +32,10 @@ test.afterAll(async () => {
});
async function navigateToAccessMethods() {
- await util.waitForNavigation(() => page.click('button[aria-label="Settings"]'));
- await util.waitForNavigation(() => page.getByText('API access').click());
+ await page.click('button[aria-label="Settings"]');
+ await util.waitForRoute(RoutePath.settings);
+ await page.getByText('API access').click();
+ await util.waitForRoute(RoutePath.apiAccessMethods);
const title = page.locator('h1');
await expect(title).toHaveText('API access');
@@ -55,7 +57,8 @@ test('App should display access methods', async () => {
});
test('App should add invalid access method', async () => {
- await util.waitForNavigation(() => page.locator('button:has-text("Add")').click());
+ await page.locator('button:has-text("Add")').click();
+ await util.waitForNextRoute();
const title = page.locator('h1');
await expect(title).toHaveText('Add method');
@@ -79,9 +82,8 @@ test('App should add invalid access method', async () => {
await expect(page.getByText('Testing method...')).toBeVisible();
await expect(page.getByText('API unreachable, add anyway?')).toBeVisible();
- expect(
- await util.waitForNavigation(() => page.locator('button:has-text("Save")').click()),
- ).toEqual(RoutePath.apiAccessMethods);
+ await page.locator('button:has-text("Save")').click();
+ await util.waitForRoute(RoutePath.apiAccessMethods);
const accessMethods = page.getByTestId('access-method');
// Direct, Bridges, Encrypted DNS Proxy & the non-functioning access method.
@@ -109,7 +111,8 @@ test('App should use invalid method', async () => {
test('App should edit access method', async () => {
const customMethod = page.getByTestId('access-method').last();
await customMethod.locator('button').last().click();
- await util.waitForNavigation(() => customMethod.getByText('Edit').click());
+ await customMethod.getByText('Edit').click();
+ await util.waitForNextRoute();
const title = page.locator('h1');
await expect(title).toHaveText('Edit method');
@@ -133,9 +136,8 @@ test('App should edit access method', async () => {
.getByRole('option', { name: process.env.SHADOWSOCKS_SERVER_CIPHER!, exact: true })
.click();
- expect(await util.waitForNavigation(() => saveButton.click())).toEqual(
- RoutePath.apiAccessMethods,
- );
+ await page.locator('button:has-text("Save")').last().click();
+ await util.waitForRoute(RoutePath.apiAccessMethods);
const accessMethods = page.getByTestId('access-method');
// Direct, Bridges, Encrypted DNS Proxy & the custom access method.
diff --git a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/custom-bridge.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/custom-bridge.spec.ts
index 1181148286..3c9d6f9f53 100644
--- a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/custom-bridge.spec.ts
+++ b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/custom-bridge.spec.ts
@@ -25,46 +25,46 @@ test.afterAll(async () => {
});
test('App should enable bridge mode', async () => {
- await util.waitForNavigation(() => page.click('button[aria-label="Settings"]'));
- expect(await util.waitForNavigation(() => page.getByText('VPN settings').click())).toBe(
- RoutePath.vpnSettings,
- );
+ await page.click('button[aria-label="Settings"]');
+ await util.waitForRoute(RoutePath.settings);
- await page.getByRole('option', { name: 'OpenVPN' }).click();
+ await page.getByText('VPN settings').click();
+ await util.waitForRoute(RoutePath.vpnSettings);
- expect(await util.waitForNavigation(() => page.getByText('OpenVPN settings').click())).toBe(
- RoutePath.openVpnSettings,
- );
+ await page.getByRole('option', { name: 'OpenVPN' }).click();
+ await page.getByText('OpenVPN settings').click();
+ await util.waitForRoute(RoutePath.openVpnSettings);
const bridgeModeOnButton = page.getByTestId('bridge-mode-on');
await bridgeModeOnButton.click();
await expect(bridgeModeOnButton).toHaveAttribute('aria-selected', 'true');
- await util.waitForNavigation(() => page.click('button[aria-label="Back"]'));
- await util.waitForNavigation(() => page.click('button[aria-label="Back"]'));
- expect(await util.waitForNavigation(() => page.click('button[aria-label="Close"]'))).toBe(
- RoutePath.main,
- );
+ await page.click('button[aria-label="Back"]');
+ await util.waitForRoute(RoutePath.vpnSettings);
+
+ await page.click('button[aria-label="Back"]');
+ await util.waitForRoute(RoutePath.settings);
+
+ await page.click('button[aria-label="Close"]');
+ await util.waitForRoute(RoutePath.main);
});
test('App display disabled custom bridge', async () => {
- expect(
- await util.waitForNavigation(() => page.click('button[aria-label^="Select location"]')),
- ).toBe(RoutePath.selectLocation);
+ await page.click('button[aria-label^="Select location"]');
+ await util.waitForRoute(RoutePath.selectLocation);
const title = page.locator('h1');
await expect(title).toHaveText('Select location');
await page.getByText(/^Entry$/).click();
- const customBridgeButton = page.getByText('Custom bridge');
+ const customBridgeButton = page.locator('button:has-text("Custom bridge")');
await expect(customBridgeButton).toBeDisabled();
});
test('App should add new custom bridge', async () => {
- expect(
- await util.waitForNavigation(() => page.click('button[aria-label="Add new custom bridge"]')),
- ).toBe(RoutePath.editCustomBridge);
+ await page.click('button[aria-label="Add new custom bridge"]');
+ await util.waitForRoute(RoutePath.editCustomBridge);
const title = page.locator('h1');
await expect(title).toHaveText('Add custom bridge');
@@ -87,9 +87,10 @@ test('App should add new custom bridge', async () => {
.getByRole('option', { name: process.env.SHADOWSOCKS_SERVER_CIPHER!, exact: true })
.click();
- expect(await util.waitForNavigation(() => addButton.click())).toEqual(RoutePath.selectLocation);
+ await addButton.click();
+ await util.waitForRoute(RoutePath.selectLocation);
- const customBridgeButton = page.getByText('Custom bridge');
+ const customBridgeButton = page.locator('button:has-text("Custom bridge")');
await expect(customBridgeButton).toBeEnabled();
await expect(page.locator('button[aria-label="Edit custom bridge"]')).toBeVisible();
@@ -114,9 +115,8 @@ test('App should edit custom bridge', async () => {
await automaticButton.click();
await page.getByText(/^Entry$/).click();
- expect(
- await util.waitForNavigation(() => page.click('button[aria-label="Edit custom bridge"]')),
- ).toBe(RoutePath.editCustomBridge);
+ await page.click('button[aria-label="Edit custom bridge"]');
+ await util.waitForRoute(RoutePath.editCustomBridge);
const title = page.locator('h1');
await expect(title).toHaveText('Edit custom bridge');
@@ -129,7 +129,8 @@ test('App should edit custom bridge', async () => {
await inputs.nth(1).fill(process.env.SHADOWSOCKS_SERVER_PORT!);
await expect(saveButton).toBeEnabled();
- expect(await util.waitForNavigation(() => saveButton.click())).toEqual(RoutePath.selectLocation);
+ await saveButton.click();
+ await util.waitForRoute(RoutePath.selectLocation);
const customBridgeButton = page.locator('button:has-text("Custom bridge")');
await expect(customBridgeButton).toBeEnabled();
@@ -137,9 +138,8 @@ test('App should edit custom bridge', async () => {
});
test('App should delete custom bridge', async () => {
- expect(
- await util.waitForNavigation(() => page.click('button[aria-label="Edit custom bridge"]')),
- ).toBe(RoutePath.editCustomBridge);
+ await page.click('button[aria-label="Edit custom bridge"]');
+ await util.waitForRoute(RoutePath.editCustomBridge);
const deleteButton = page.locator('button:has-text("Delete")');
await expect(deleteButton).toBeVisible();
@@ -149,9 +149,8 @@ test('App should delete custom bridge', async () => {
await expect(page.getByText('Delete custom bridge?')).toBeVisible();
const confirmButton = page.getByTestId('delete-confirm');
- expect(await util.waitForNavigation(() => confirmButton.click())).toEqual(
- RoutePath.selectLocation,
- );
+ await confirmButton.click();
+ await util.waitForRoute(RoutePath.selectLocation);
const customBridgeButton = page.locator('button:has-text("Custom bridge")');
await expect(customBridgeButton).toBeDisabled();
diff --git a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/device-revoked.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/device-revoked.spec.ts
index 2b9f8d0c58..c74b578a59 100644
--- a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/device-revoked.spec.ts
+++ b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/device-revoked.spec.ts
@@ -19,11 +19,10 @@ test.afterAll(async () => {
});
test('App should fail to login', async () => {
- expect(await util.currentRoute()).toEqual(RoutePath.deviceRevoked);
+ await util.waitForRoute(RoutePath.deviceRevoked);
await expect(page.getByTestId('title')).toHaveText('Device is inactive');
- expect(await util.waitForNavigation(() => page.getByText('Go to login').click())).toEqual(
- RoutePath.login,
- );
+ await page.getByText('Go to login').click();
+ await util.waitForRoute(RoutePath.login);
});
diff --git a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/login.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/login.spec.ts
index ad49c88edd..bd6dbcbb2e 100644
--- a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/login.spec.ts
+++ b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/login.spec.ts
@@ -25,7 +25,7 @@ test.afterAll(async () => {
});
test('App should fail to login', async () => {
- expect(await util.currentRoute()).toEqual(RoutePath.login);
+ await util.waitForRoute(RoutePath.login);
const title = page.locator('h1');
const subtitle = page.getByTestId('subtitle');
@@ -44,19 +44,17 @@ test('App should fail to login', async () => {
});
test('App should create account', async () => {
- expect(await util.currentRoute()).toEqual(RoutePath.login);
+ await util.waitForRoute(RoutePath.login);
+
+ await page.getByText('Create account').click();
const title = page.locator('h1');
const subtitle = page.getByTestId('subtitle');
- expect(
- await util.waitForNavigation(async () => {
- await page.getByText('Create account').click();
+ await expect(title).toHaveText('Account created');
+ await expect(subtitle).toHaveText('Logged in');
- await expect(title).toHaveText('Account created');
- await expect(subtitle).toHaveText('Logged in');
- }),
- ).toEqual(RoutePath.expired);
+ await util.waitForRoute(RoutePath.expired);
const outOfTimeTitle = page.getByTestId('title');
await expect(outOfTimeTitle).toHaveText('Congrats!');
@@ -67,15 +65,12 @@ test('App should create account', async () => {
});
test('App should become logged out', async () => {
- expect(
- await util.waitForNavigation(() => {
- exec('mullvad account logout');
- }),
- ).toEqual(RoutePath.login);
+ exec('mullvad account logout');
+ await util.waitForRoute(RoutePath.login);
});
test('App should log in', async () => {
- expect(await util.currentRoute()).toEqual(RoutePath.login);
+ await util.waitForRoute(RoutePath.login);
const title = page.locator('h1');
const subtitle = page.getByTestId('subtitle');
@@ -85,30 +80,23 @@ test('App should log in', async () => {
await expect(subtitle).toHaveText('Enter your account number');
await loginInput.fill(process.env.ACCOUNT_NUMBER!);
+ await loginInput.press('Enter');
+
+ await expect(title).toHaveText('Logged in');
+ await expect(subtitle).toHaveText('Valid account number');
- expect(
- await util.waitForNavigation(async () => {
- await loginInput.press('Enter');
+ await util.waitForRoute(RoutePath.main);
- await expect(title).toHaveText('Logged in');
- await expect(subtitle).toHaveText('Valid account number');
- }),
- ).toEqual(RoutePath.main);
await expectDisconnected(page);
});
test('App should log out', async () => {
- expect(
- await util.waitForNavigation(() => {
- void page.getByTestId('account-button').click();
- }),
- ).toEqual(RoutePath.account);
+ await page.getByTestId('account-button').click();
- expect(
- await util.waitForNavigation(() => {
- void page.getByText('Log out').click();
- }),
- ).toEqual(RoutePath.login);
+ await util.waitForRoute(RoutePath.account);
+
+ await page.getByText('Log out').click();
+ await util.waitForRoute(RoutePath.login);
const title = page.locator('h1');
const subtitle = page.getByTestId('subtitle');
@@ -117,7 +105,7 @@ test('App should log out', async () => {
});
test('App should log in to expired account', async () => {
- expect(await util.currentRoute()).toEqual(RoutePath.login);
+ await util.waitForRoute(RoutePath.login);
const title = page.locator('h1');
const subtitle = page.getByTestId('subtitle');
@@ -128,11 +116,8 @@ test('App should log in to expired account', async () => {
await loginInput.fill(accountNumber);
- expect(
- await util.waitForNavigation(async () => {
- await loginInput.press('Enter');
- }),
- ).toEqual(RoutePath.expired);
+ await loginInput.press('Enter');
+ await util.waitForRoute(RoutePath.expired);
const outOfTimeTitle = page.getByTestId('title');
await expect(outOfTimeTitle).toHaveText('Out of time');
diff --git a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/macos-split-tunneling.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/macos-split-tunneling.spec.ts
index 6d49173bcd..f521692af2 100644
--- a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/macos-split-tunneling.spec.ts
+++ b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/macos-split-tunneling.spec.ts
@@ -21,11 +21,11 @@ test.afterAll(async () => {
});
async function navigateToSplitTunneling() {
- await util.waitForNavigation(() => page.click('button[aria-label="Settings"]'));
+ await page.click('button[aria-label="Settings"]');
+ await util.waitForRoute(RoutePath.settings);
- expect(await util.waitForNavigation(() => page.getByText('Split tunneling').click())).toEqual(
- RoutePath.splitTunneling,
- );
+ await page.getByText('Split tunneling').click();
+ await util.waitForRoute(RoutePath.splitTunneling);
const title = page.locator('h1');
await expect(title).toHaveText('Split tunneling');
diff --git a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/obfuscation.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/obfuscation.spec.ts
index a4077ffe3d..c7d48d8966 100644
--- a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/obfuscation.spec.ts
+++ b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/obfuscation.spec.ts
@@ -25,14 +25,14 @@ test.afterAll(async () => {
});
test('App should have automatic obfuscation', async () => {
- await util.waitForNavigation(() => page.click('button[aria-label="Settings"]'));
- expect(await util.waitForNavigation(() => page.getByText('VPN settings').click())).toBe(
- RoutePath.vpnSettings,
- );
+ await page.click('button[aria-label="Settings"]');
+ await util.waitForRoute(RoutePath.settings);
- expect(await util.waitForNavigation(() => page.getByText('WireGuard settings').click())).toBe(
- RoutePath.wireguardSettings,
- );
+ await page.getByText('VPN settings').click();
+ await util.waitForRoute(RoutePath.vpnSettings);
+
+ await page.getByText('WireGuard settings').click();
+ await util.waitForRoute(RoutePath.wireguardSettings);
const automatic = page.getByTestId('automatic-obfuscation');
await expect(automatic).toHaveCSS('background-color', colors['--color-green']);
@@ -44,9 +44,8 @@ test('App should have automatic obfuscation', async () => {
});
test('App should set obfuscation to shadowsocks with custom port', async () => {
- expect(
- await util.waitForNavigation(() => page.click('button[aria-label="Shadowsocks settings"]')),
- ).toBe(RoutePath.shadowsocks);
+ await page.click('button[aria-label="Shadowsocks settings"]');
+ await util.waitForRoute(RoutePath.shadowsocks);
const automatic = page.locator('button', { hasText: 'Automatic' });
await expect(automatic).toHaveCSS('background-color', colors['--color-green']);
@@ -59,7 +58,8 @@ test('App should set obfuscation to shadowsocks with custom port', async () => {
const customItem = page.locator('div[role="option"]', { hasText: 'Custom' });
await expect(customItem).toHaveCSS('background-color', colors['--color-green']);
- await util.waitForNavigation(() => page.click('button[aria-label="Back"]'));
+ await page.click('button[aria-label="Back"]');
+ await util.waitForRoute(RoutePath.wireguardSettings);
const shadowsocksItem = page.locator('button', { hasText: 'Shadowsocks' });
await shadowsocksItem.click();
@@ -71,20 +71,19 @@ test('App should set obfuscation to shadowsocks with custom port', async () => {
});
test('App should still have shadowsocks custom port', async () => {
- expect(
- await util.waitForNavigation(() => page.click('button[aria-label="Shadowsocks settings"]')),
- ).toBe(RoutePath.shadowsocks);
+ await page.click('button[aria-label="Shadowsocks settings"]');
+ await util.waitForRoute(RoutePath.shadowsocks);
const customItem = page.locator('div[role="option"]', { hasText: 'Custom' });
await expect(customItem).toHaveCSS('background-color', colors['--color-green']);
- await util.waitForNavigation(() => page.click('button[aria-label="Back"]'));
+ await page.click('button[aria-label="Back"]');
+ await util.waitForRoute(RoutePath.wireguardSettings);
});
test('App should set obfuscation to UDP-over-TCP with port', async () => {
- expect(
- await util.waitForNavigation(() => page.click('button[aria-label="UDP-over-TCP settings"]')),
- ).toBe(RoutePath.udpOverTcp);
+ await page.click('button[aria-label="UDP-over-TCP settings"]');
+ await util.waitForRoute(RoutePath.udpOverTcp);
const automatic = page.locator('button', { hasText: 'Automatic' });
await expect(automatic).toHaveCSS('background-color', colors['--color-green']);
@@ -94,7 +93,8 @@ test('App should set obfuscation to UDP-over-TCP with port', async () => {
await expect(portButton).toHaveCSS('background-color', colors['--color-green']);
- await util.waitForNavigation(() => page.click('button[aria-label="Back"]'));
+ await page.click('button[aria-label="Back"]');
+ await util.waitForRoute(RoutePath.wireguardSettings);
const udpOverTcpItem = page.locator('button', { hasText: 'UDP-over-TCP' });
await udpOverTcpItem.click();
diff --git a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/settings-import.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/settings-import.spec.ts
index d9a8859f76..a321849606 100644
--- a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/settings-import.spec.ts
+++ b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/settings-import.spec.ts
@@ -31,12 +31,14 @@ test.afterAll(async () => {
});
async function navigateToSettingsImport() {
- await util.waitForNavigation(() => page.click('button[aria-label="Settings"]'));
- await util.waitForNavigation(() => page.getByText('VPN settings').click());
+ await page.click('button[aria-label="Settings"]');
+ await util.waitForRoute(RoutePath.settings);
- expect(await util.waitForNavigation(() => page.getByText('Server IP override').click())).toEqual(
- RoutePath.settingsImport,
- );
+ await page.getByText('VPN settings').click();
+ await util.waitForRoute(RoutePath.vpnSettings);
+
+ await page.getByText('Server IP override').click();
+ await util.waitForRoute(RoutePath.settingsImport);
const title = page.locator('h1');
await expect(title).toHaveText('Server IP override');
@@ -49,14 +51,12 @@ test('App should display no overrides', async () => {
});
test('App should fail to import text', async () => {
- expect(await util.waitForNavigation(() => page.getByText('Import via text').click())).toEqual(
- RoutePath.settingsTextImport,
- );
+ await page.getByText('Import via text').click();
+ await util.waitForRoute(RoutePath.settingsTextImport);
await page.locator('textarea').fill(INVALID_JSON);
- expect(await util.waitForNavigation(() => page.click('button[aria-label="Save"]'))).toEqual(
- RoutePath.settingsImport,
- );
+ await page.click('button[aria-label="Save"]');
+ await util.waitForRoute(RoutePath.settingsImport);
await expect(page.getByTestId('status-title')).toHaveText('NO OVERRIDES IMPORTED');
await expect(page.getByTestId('status-subtitle')).toBeVisible();
@@ -65,16 +65,15 @@ test('App should fail to import text', async () => {
});
test('App should succeed to import text', async () => {
- expect(await util.waitForNavigation(() => page.getByText('Import via text').click())).toEqual(
- RoutePath.settingsTextImport,
- );
+ await page.getByText('Import via text').click();
+ await util.waitForRoute(RoutePath.settingsTextImport);
const textarea = page.locator('textarea');
await expect(textarea).toHaveValue(INVALID_JSON);
await textarea.fill(VALID_JSON);
- expect(await util.waitForNavigation(() => page.click('button[aria-label="Save"]'))).toEqual(
- RoutePath.settingsImport,
- );
+
+ await page.click('button[aria-label="Save"]');
+ await util.waitForRoute(RoutePath.settingsImport);
await expect(page.getByTestId('status-title')).toHaveText('IMPORT SUCCESSFUL');
await expect(page.getByTestId('status-subtitle')).toBeVisible();
@@ -83,24 +82,21 @@ test('App should succeed to import text', async () => {
await expect(page.getByTestId('status-title')).toHaveText('OVERRIDES ACTIVE');
- expect(await util.waitForNavigation(() => page.getByText('Import via text').click())).toEqual(
- RoutePath.settingsTextImport,
- );
+ await page.getByText('Import via text').click();
+ await util.waitForRoute(RoutePath.settingsTextImport);
await expect(textarea).toHaveValue('');
- expect(await util.waitForNavigation(() => page.click('button[aria-label="Close"]'))).toEqual(
- RoutePath.settingsImport,
- );
+ await page.click('button[aria-label="Close"]');
+ await util.waitForRoute(RoutePath.settingsImport);
});
test('App should show active overrides', async () => {
- expect(await util.waitForNavigation(() => page.click('button[aria-label="Back"]'))).toEqual(
- RoutePath.vpnSettings,
- );
- expect(await util.waitForNavigation(() => page.getByText('Server IP override').click())).toEqual(
- RoutePath.settingsImport,
- );
+ await page.click('button[aria-label="Back"]');
+ await util.waitForRoute(RoutePath.vpnSettings);
+
+ await page.getByText('Server IP override').click();
+ await util.waitForRoute(RoutePath.settingsImport);
await expect(page.getByTestId('status-title')).toHaveText('OVERRIDES ACTIVE');
await expect(page.getByText('Clear all overrides')).toBeEnabled();
diff --git a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/settings.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/settings.spec.ts
index 343d0fc430..732ab75ea7 100644
--- a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/settings.spec.ts
+++ b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/settings.spec.ts
@@ -3,6 +3,7 @@ import { execSync } from 'child_process';
import os from 'os';
import path from 'path';
+import { RoutePath } from '../../../../src/renderer/lib/routes';
import { fileExists, TestUtils } from '../../utils';
import { startInstalledApp } from '../installed-utils';
@@ -28,8 +29,10 @@ test.afterAll(async () => {
test.describe('VPN Settings', () => {
test('Auto-connect setting', async () => {
// Navigate to the VPN settings view
- await util.waitForNavigation(() => page.click('button[aria-label="Settings"]'));
- await util.waitForNavigation(() => page.click('text=VPN settings'));
+ await page.click('button[aria-label="Settings"]');
+ await util.waitForRoute(RoutePath.settings);
+ await page.click('text=VPN settings');
+ await util.waitForRoute(RoutePath.vpnSettings);
// Find the auto-connect toggle
const autoConnectToggle = page.getByText('Auto-connect').locator('..').getByRole('checkbox');
diff --git a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/too-many-devices.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/too-many-devices.spec.ts
index 8ff8675b67..71dd3cfb8b 100644
--- a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/too-many-devices.spec.ts
+++ b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/too-many-devices.spec.ts
@@ -15,6 +15,7 @@ let util: TestUtils;
test.beforeAll(async () => {
({ page, util } = await startInstalledApp());
+ await util.waitForRoute(RoutePath.login);
});
test.afterAll(async () => {
@@ -22,14 +23,11 @@ test.afterAll(async () => {
});
test('App should show too many devices', async () => {
- expect(await util.currentRoute()).toEqual(RoutePath.login);
-
const loginInput = getInput(page);
await loginInput.fill(process.env.ACCOUNT_NUMBER!);
- expect(await util.waitForNavigation(() => loginInput.press('Enter'))).toEqual(
- RoutePath.tooManyDevices,
- );
+ await loginInput.press('Enter');
+ await util.waitForRoute(RoutePath.tooManyDevices);
const loginButton = page.getByText('Continue with login');
@@ -44,12 +42,9 @@ test('App should show too many devices', async () => {
await expect(loginButton).toBeEnabled();
// Trigger transition: too-many-devices -> login -> main
- expect(await util.waitForNavigation(() => loginButton.click())).toEqual(RoutePath.login);
-
- // Note: `util.waitForNavigation` won't return the navigation event when
- // transitioning from login -> main, so we need to observe the state of the
- // app after the entire transition chain has finished.
- await util.waitForNoTransition();
+ await loginButton.click();
+ await util.waitForRoute(RoutePath.login);
+ await util.waitForRoute(RoutePath.main);
await expect(page.getByTestId(RoutePath.main)).toBeVisible();
});
diff --git a/desktop/packages/mullvad-vpn/test/e2e/mocked/expired-account-error-view.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/mocked/expired-account-error-view.spec.ts
index cee7ebee38..521da77d26 100644
--- a/desktop/packages/mullvad-vpn/test/e2e/mocked/expired-account-error-view.spec.ts
+++ b/desktop/packages/mullvad-vpn/test/e2e/mocked/expired-account-error-view.spec.ts
@@ -38,12 +38,9 @@ test('App should show out of time view after running out of time', async () => {
const expiryDate = new Date();
expiryDate.setSeconds(expiryDate.getSeconds() + 2);
- expect(
- await util.waitForNavigation(async () => {
- await util.sendMockIpcResponse<IAccountData>({
- channel: 'account-',
- response: { expiry: expiryDate.toISOString() },
- });
- }),
- ).toEqual(RoutePath.expired);
+ await util.sendMockIpcResponse<IAccountData>({
+ channel: 'account-',
+ response: { expiry: expiryDate.toISOString() },
+ });
+ await util.waitForRoute(RoutePath.expired);
});
diff --git a/desktop/packages/mullvad-vpn/test/e2e/mocked/select-location.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/mocked/select-location.spec.ts
index e8e5e61155..42067c9145 100644
--- a/desktop/packages/mullvad-vpn/test/e2e/mocked/select-location.spec.ts
+++ b/desktop/packages/mullvad-vpn/test/e2e/mocked/select-location.spec.ts
@@ -3,6 +3,7 @@ import { Page } from 'playwright';
import { getDefaultSettings } from '../../../src/main/default-settings';
import { colors } from '../../../src/renderer/lib/foundations';
+import { RoutePath } from '../../../src/renderer/lib/routes';
import {
IRelayList,
IRelayListWithEndpointData,
@@ -63,7 +64,8 @@ let util: MockedTestUtils;
test.beforeAll(async () => {
({ page, util } = await startMockedApp());
await setMultihop();
- await util.waitForNavigation(() => page.getByLabel('Select location').click());
+ await page.getByLabel('Select location').click();
+ await util.waitForRoute(RoutePath.selectLocation);
});
test.afterAll(async () => {
diff --git a/desktop/packages/mullvad-vpn/test/e2e/mocked/settings.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/mocked/settings.spec.ts
index 52dbc72402..4922674c9b 100644
--- a/desktop/packages/mullvad-vpn/test/e2e/mocked/settings.spec.ts
+++ b/desktop/packages/mullvad-vpn/test/e2e/mocked/settings.spec.ts
@@ -1,6 +1,7 @@
import { expect, test } from '@playwright/test';
import { Page } from 'playwright';
+import { RoutePath } from '../../../src/renderer/lib/routes';
import { IAccountData } from '../../../src/shared/daemon-rpc-types';
import { MockedTestUtils, startMockedApp } from './mocked-utils';
@@ -54,7 +55,8 @@ test('Headerbar account info should be displayed correctly', async () => {
});
test('Settings Page', async () => {
- await util.waitForNavigation(() => page.click('button[aria-label="Settings"]'));
+ await page.click('button[aria-label="Settings"]');
+ await util.waitForRoute(RoutePath.settings);
const title = page.locator('h1');
await expect(title).toContainText('Settings');