diff options
| author | Oskar <oskar@mullvad.net> | 2025-09-29 08:19:49 +0200 |
|---|---|---|
| committer | Oskar <oskar@mullvad.net> | 2025-09-29 14:47:24 +0200 |
| commit | b55c580a0888641c17c7db12e89853b2650cde45 (patch) | |
| tree | 64f8a6c363eed30920f480514af57da693ddf33d | |
| parent | ce719e40e993fb39119736f75f8aee305d503c62 (diff) | |
| download | mullvadvpn-b55c580a0888641c17c7db12e89853b2650cde45.tar.xz mullvadvpn-b55c580a0888641c17c7db12e89853b2650cde45.zip | |
Wrap mocked/tunnel-state.spec.ts in test.describe
| -rw-r--r-- | desktop/packages/mullvad-vpn/test/e2e/mocked/tunnel-state.spec.ts | 138 |
1 files changed, 70 insertions, 68 deletions
diff --git a/desktop/packages/mullvad-vpn/test/e2e/mocked/tunnel-state.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/mocked/tunnel-state.spec.ts index b2c4fb86ef..bca0eee1c5 100644 --- a/desktop/packages/mullvad-vpn/test/e2e/mocked/tunnel-state.spec.ts +++ b/desktop/packages/mullvad-vpn/test/e2e/mocked/tunnel-state.spec.ts @@ -26,86 +26,88 @@ let page: Page; let util: MockedTestUtils; let routes: RoutesObjectModel; -test.beforeAll(async () => { - ({ page, util } = await startMockedApp()); - routes = new RoutesObjectModel(page, util); - await routes.main.waitForRoute(); -}); - -test.afterAll(async () => { - await page.close(); -}); - -/** - * Disconnected state - */ -test('App should show disconnected tunnel state', async () => { - await util.ipc.tunnel[''].notify({ state: 'disconnected', lockedDown: false }); - await expectDisconnected(page); -}); +test.describe('Connection states', () => { + test.beforeAll(async () => { + ({ page, util } = await startMockedApp()); + routes = new RoutesObjectModel(page, util); + await routes.main.waitForRoute(); + }); -/** - * Connecting state - */ -test('App should show connecting tunnel state', async () => { - await util.ipc.tunnel[''].notify({ state: 'connecting', featureIndicators: undefined }); - await expectConnecting(page); -}); + test.afterAll(async () => { + await page.close(); + }); -/** - * Disconnecting state - */ -test('App should show disconnecting tunnel state', async () => { - await util.ipc.tunnel[''].notify({ state: 'disconnecting', details: 'nothing' }); - await expectDisconnecting(page); -}); + /** + * Disconnected state + */ + test('App should show disconnected tunnel state', async () => { + await util.ipc.tunnel[''].notify({ state: 'disconnected', lockedDown: false }); + await expectDisconnected(page); + }); -/** - * Error state - */ -test('App should show error tunnel state', async () => { - await util.ipc.tunnel[''].notify({ - state: 'error', - details: { cause: ErrorStateCause.isOffline }, + /** + * Connecting state + */ + test('App should show connecting tunnel state', async () => { + await util.ipc.tunnel[''].notify({ state: 'connecting', featureIndicators: undefined }); + await expectConnecting(page); }); - await expectError(page); -}); -/** - * Connected state - */ -test.describe('Connected state', () => { - test.beforeEach(async () => { - const location: ILocation = { ...mockLocation, mullvadExitIp: true }; + /** + * Disconnecting state + */ + test('App should show disconnecting tunnel state', async () => { + await util.ipc.tunnel[''].notify({ state: 'disconnecting', details: 'nothing' }); + await expectDisconnecting(page); + }); - const endpoint: ITunnelEndpoint = { - address: 'wg10:80', - protocol: 'tcp', - quantumResistant: false, - tunnelType: 'wireguard', - daita: false, - }; + /** + * Error state + */ + test('App should show error tunnel state', async () => { await util.ipc.tunnel[''].notify({ - state: 'connected', - details: { endpoint, location }, - featureIndicators: undefined, + state: 'error', + details: { cause: ErrorStateCause.isOffline }, }); + await expectError(page); }); - test.afterEach(async () => { - await util.ipc.tunnel[''].notify({ state: 'disconnecting', details: 'nothing' }); - }); + /** + * Connected state + */ + test.describe('Connected state', () => { + test.beforeEach(async () => { + const location: ILocation = { ...mockLocation, mullvadExitIp: true }; - test('App should show connected tunnel state', async () => { - await expectConnected(page); - }); + const endpoint: ITunnelEndpoint = { + address: 'wg10:80', + protocol: 'tcp', + quantumResistant: false, + tunnelType: 'wireguard', + daita: false, + }; + await util.ipc.tunnel[''].notify({ + state: 'connected', + details: { endpoint, location }, + featureIndicators: undefined, + }); + }); - test('App should show both IPv4 and IPv6 out address', async () => { - await routes.main.expandConnectionPanel(); + test.afterEach(async () => { + await util.ipc.tunnel[''].notify({ state: 'disconnecting', details: 'nothing' }); + }); + + test('App should show connected tunnel state', async () => { + await expectConnected(page); + }); - const outIps = routes.main.getOutIps(); - await expect(outIps).toHaveCount(2); - await expect(outIps.first()).toHaveText(mockLocation.ipv4!); - await expect(outIps.last()).toHaveText(mockLocation.ipv6!); + test('App should show both IPv4 and IPv6 out address', async () => { + await routes.main.expandConnectionPanel(); + + const outIps = routes.main.getOutIps(); + await expect(outIps).toHaveCount(2); + await expect(outIps.first()).toHaveText(mockLocation.ipv4!); + await expect(outIps.last()).toHaveText(mockLocation.ipv6!); + }); }); }); |
