diff options
3 files changed, 70 insertions, 15 deletions
diff --git a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/tunnel-state.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/tunnel-state.spec.ts index dfd7228fc9..f8e9136e38 100644 --- a/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/tunnel-state.spec.ts +++ b/desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/tunnel-state.spec.ts @@ -16,6 +16,8 @@ const exec = promisify(execAsync); // IN_IP: In ip of the relay passed in `HOSTNAME` // CONNECTION_CHECK_URL: Url to the connection check +const { HOSTNAME, IN_IP, CONNECTION_CHECK_URL } = process.env; + let page: Page; let util: TestUtils; let routes: RoutesObjectModel; @@ -85,18 +87,71 @@ test.describe('Tunnel state and settings', () => { await exec('mullvad obfuscation set mode auto'); }); - test('App should show correct WireGuard transport protocol', async () => { - const inData = page.getByTestId('in-ip'); + test.describe('Wireguard UDP-over-TCP', () => { + async function gotoWireguardSettings() { + await routes.main.gotoSettings(); + await routes.settings.gotoVpnSettings(); + await routes.vpnSettings.gotoWireguardSettings(); + } - await exec('mullvad obfuscation set mode udp2tcp'); - await expectConnected(page); - await page.getByTestId('connection-panel-chevron').click(); - await expect(inData).toContainText(new RegExp('TCP')); + async function gotoUdpOverTcpSettings() { + await gotoWireguardSettings(); + await routes.wireguardSettings.gotoUdpOverTcpSettings(); + } - await exec('mullvad obfuscation set mode off'); - await expectConnected(page); - await page.getByTestId('connection-panel-chevron').click(); - await expect(inData).toContainText(new RegExp('UDP$')); + test.beforeAll(async () => { + await exec('mullvad connect --wait'); + }); + + test.afterAll(async () => { + await routes.wireguardSettings.gotoRoot(); + }); + + test('App should show UDP', async () => { + await expectConnected(page); + await routes.main.expandConnectionPanel(); + const inValue = await routes.main.getInIpText(); + expect(inValue).toMatch(new RegExp('UDP$')); + }); + + test('App should enable UDP-over-TCP', async () => { + await gotoWireguardSettings(); + + const udpOverTcpOption = routes.wireguardSettings.getUdpOverTcpOption(); + await expect(udpOverTcpOption).toHaveAttribute('aria-selected', 'false'); + + await routes.wireguardSettings.selectUdpOverTcp(); + await expect(udpOverTcpOption).toHaveAttribute('aria-selected', 'true'); + + await routes.wireguardSettings.gotoRoot(); + + await expectConnected(page); + + await routes.main.expandConnectionPanel(); + + const inValue = await routes.main.getInIpText(); + expect(inValue).toMatch(new RegExp(`${escapeRegExp(IN_IP!)}:(80|5001) TCP`)); + }); + + for (const port of [80, 5001]) { + test(`App should show port ${port}`, async () => { + await gotoUdpOverTcpSettings(); + await routes.udpOverTcpSettings.selectPort(port); + await routes.udpOverTcpSettings.gotoRoot(); + await routes.main.expandConnectionPanel(); + + const inValue = await routes.main.getInIpText(); + expect(inValue).toMatch(`${IN_IP}:${port} TCP`); + }); + } + + test('App should set obfuscation to automatic', async () => { + await gotoWireguardSettings(); + await routes.wireguardSettings.selectAutomaticObfuscation(); + + const automaticOption = routes.wireguardSettings.getAutomaticObfuscationOption(); + await expect(automaticOption).toHaveAttribute('aria-selected', 'true'); + }); }); test('App should connect with Shadowsocks', async () => { diff --git a/desktop/packages/mullvad-vpn/test/e2e/route-object-models/main/main-route-object-model.ts b/desktop/packages/mullvad-vpn/test/e2e/route-object-models/main/main-route-object-model.ts index 261815db34..ec73d591a4 100644 --- a/desktop/packages/mullvad-vpn/test/e2e/route-object-models/main/main-route-object-model.ts +++ b/desktop/packages/mullvad-vpn/test/e2e/route-object-models/main/main-route-object-model.ts @@ -33,11 +33,11 @@ export class MainRouteObjectModel { await this.selectors.connectionPanelChevronButton().click(); } - getInValue() { - return this.selectors.inValueLabel(); + getInIp() { + return this.selectors.inIpLabel(); } - async getInValueText() { - return this.getInValue().innerText(); + getInIpText() { + return this.getInIp().innerText(); } } diff --git a/desktop/packages/mullvad-vpn/test/e2e/route-object-models/main/selectors.ts b/desktop/packages/mullvad-vpn/test/e2e/route-object-models/main/selectors.ts index e809d891ba..0e3cbaaa3b 100644 --- a/desktop/packages/mullvad-vpn/test/e2e/route-object-models/main/selectors.ts +++ b/desktop/packages/mullvad-vpn/test/e2e/route-object-models/main/selectors.ts @@ -4,5 +4,5 @@ export const createSelectors = (page: Page) => ({ settingsButton: () => page.locator('button[aria-label="Settings"]'), selectLocationButton: () => page.getByLabel('Select location'), connectionPanelChevronButton: () => page.getByTestId('connection-panel-chevron'), - inValueLabel: () => page.getByTestId('in-ip'), + inIpLabel: () => page.getByTestId('in-ip'), }); |
