diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2024-02-01 16:48:11 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2024-02-09 17:45:21 +0100 |
| commit | 9873a37ef0c2feab38bd0d34558916758a8a60dc (patch) | |
| tree | 46355d1ff1ccdda7e8fa0e66c1095e76387b3b17 | |
| parent | 433547101d2c4e26c5224381a72330bce1ce51fb (diff) | |
| download | mullvadvpn-9873a37ef0c2feab38bd0d34558916758a8a60dc.tar.xz mullvadvpn-9873a37ef0c2feab38bd0d34558916758a8a60dc.zip | |
Add test that makes sure the app switches to the out of time view
| -rw-r--r-- | gui/test/e2e/mocked/expired-account-error-view.spec.ts | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gui/test/e2e/mocked/expired-account-error-view.spec.ts b/gui/test/e2e/mocked/expired-account-error-view.spec.ts index 0d6bacd747..5c906a134b 100644 --- a/gui/test/e2e/mocked/expired-account-error-view.spec.ts +++ b/gui/test/e2e/mocked/expired-account-error-view.spec.ts @@ -4,15 +4,16 @@ import { expect, test } from '@playwright/test'; import { IAccountData } from '../../../src/shared/daemon-rpc-types'; import { getBackgroundColor } from '../utils'; import { colors } from '../../../src/config.json'; +import { RoutePath } from '../../../src/renderer/lib/routes'; let page: Page; let util: MockedTestUtils; -test.beforeAll(async () => { +test.beforeEach(async () => { ({ page, util } = await startMockedApp()); }); -test.afterAll(async () => { +test.afterEach(async () => { await page.close(); }); @@ -31,3 +32,15 @@ test('App should show Expired Account Error View', async () => { await expect(redeemVoucherButton).toBeVisible(); expect(await getBackgroundColor(redeemVoucherButton)).toBe(colors.green); }); + +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); +}); |
