diff options
| author | Tobias Järvelöv <tobias.jarvelov@mullvad.net> | 2025-10-15 15:24:27 +0200 |
|---|---|---|
| committer | Tobias Järvelöv <tobias.jarvelov@mullvad.net> | 2025-10-20 14:12:48 +0200 |
| commit | b17ce88d97b1ed7353da05bd9155013059c19c31 (patch) | |
| tree | 3d6c0809b702b3169cdf30d2527e5404fff65a78 /desktop | |
| parent | f594762360906b08eafaa8534a5d942cf19652ef (diff) | |
| download | mullvadvpn-b17ce88d97b1ed7353da05bd9155013059c19c31.tar.xz mullvadvpn-b17ce88d97b1ed7353da05bd9155013059c19c31.zip | |
Break up tests which affect others into separate test.describe blocks
Diffstat (limited to 'desktop')
| -rw-r--r-- | desktop/packages/mullvad-vpn/test/e2e/mocked/notifications.spec.ts | 69 |
1 files changed, 43 insertions, 26 deletions
diff --git a/desktop/packages/mullvad-vpn/test/e2e/mocked/notifications.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/mocked/notifications.spec.ts index 7a4a1a6788..1aeb027891 100644 --- a/desktop/packages/mullvad-vpn/test/e2e/mocked/notifications.spec.ts +++ b/desktop/packages/mullvad-vpn/test/e2e/mocked/notifications.spec.ts @@ -4,54 +4,71 @@ import { Page } from 'playwright'; import { getDefaultSettings } from '../../../src/main/default-settings'; import { colorTokens } from '../../../src/renderer/lib/foundations'; import { Constraint, ErrorStateCause, TunnelState } from '../../../src/shared/daemon-rpc-types'; -import { RoutePath } from '../../../src/shared/routes'; +import { RoutesObjectModel } from '../route-object-models'; import { getBackgroundColor } from '../utils'; import { MockedTestUtils, startMockedApp } from './mocked-utils'; let page: Page; let util: MockedTestUtils; +let routes: RoutesObjectModel; -test.beforeAll(async () => { +const startup = async () => { ({ page, util } = await startMockedApp()); - await util.expectRoute(RoutePath.main); -}); + routes = new RoutesObjectModel(page, util); -test.afterAll(async () => { - await util?.closePage(); -}); + await routes.main.waitForRoute(); +}; /** * Expires soon */ -test('App should notify user about account expiring soon', async () => { - await util.ipc.account[''].notify({ - expiry: new Date(Date.now() + 2 * 24 * 60 * 60 * 1000).toISOString(), +test.describe('Expiration notifications', () => { + test.beforeAll(async () => { + await startup(); + }); + + test.afterAll(async () => { + await util?.closePage(); }); - const title = page.getByTestId('notificationTitle'); - await expect(title).toContainText(/account credit expires soon/i); + test('App should notify user about account expiring soon', async () => { + await util.ipc.account[''].notify({ + expiry: new Date(Date.now() + 2 * 24 * 60 * 60 * 1000).toISOString(), + }); - let subTitle = page.getByTestId('notificationSubTitle'); - await expect(subTitle).toContainText(/1 day left\. buy more credit\./i); + const title = page.getByTestId('notificationTitle'); + await expect(title).toContainText(/account credit expires soon/i); - const indicator = page.getByTestId('notificationIndicator'); - const indicatorColor = await getBackgroundColor(indicator); - expect(indicatorColor).toBe(colorTokens.yellow); + let subTitle = page.getByTestId('notificationSubTitle'); + await expect(subTitle).toContainText(/1 day left\. buy more credit\./i); - await util.ipc.account[''].notify({ - expiry: new Date(Date.now() + 3 * 24 * 60 * 60 * 1000).toISOString(), - }); - subTitle = page.getByTestId('notificationSubTitle'); - await expect(subTitle).toContainText(/2 days left\. buy more credit\./i); + const indicator = page.getByTestId('notificationIndicator'); + const indicatorColor = await getBackgroundColor(indicator); + expect(indicatorColor).toBe(colorTokens.yellow); - await util.ipc.account[''].notify({ - expiry: new Date(Date.now() + 1 * 24 * 60 * 60 * 1000).toISOString(), + await util.ipc.account[''].notify({ + expiry: new Date(Date.now() + 3 * 24 * 60 * 60 * 1000).toISOString(), + }); + subTitle = page.getByTestId('notificationSubTitle'); + await expect(subTitle).toContainText(/2 days left\. buy more credit\./i); + + await util.ipc.account[''].notify({ + expiry: new Date(Date.now() + 1 * 24 * 60 * 60 * 1000).toISOString(), + }); + subTitle = page.getByTestId('notificationSubTitle'); + await expect(subTitle).toContainText(/less than a day left\. buy more credit\./i); }); - subTitle = page.getByTestId('notificationSubTitle'); - await expect(subTitle).toContainText(/less than a day left\. buy more credit\./i); }); test.describe('Unsupported wireguard port', () => { + test.beforeAll(async () => { + await startup(); + }); + + test.afterAll(async () => { + await util?.closePage(); + }); + const portRanges: [number, number][] = [ [1, 50], [51, 100], |
