diff options
| author | Hank <hank@mullvad.net> | 2022-10-12 11:46:56 +0200 |
|---|---|---|
| committer | Hank <hank@mullvad.net> | 2022-10-17 07:49:47 +0200 |
| commit | b698c87dff68fc5156547c981f7917b2df8f45c0 (patch) | |
| tree | bcea7c3211895e99e5d64f43956b8ede228e9874 /gui | |
| parent | 1be192541a8154849267feabb44fc80c6366958e (diff) | |
| download | mullvadvpn-b698c87dff68fc5156547c981f7917b2df8f45c0.tar.xz mullvadvpn-b698c87dff68fc5156547c981f7917b2df8f45c0.zip | |
Add e2e test for ExpiredAccountErrorView
Diffstat (limited to 'gui')
| -rw-r--r-- | gui/test/e2e/mocked/expired-account-error-view.spec.ts | 33 |
1 files changed, 33 insertions, 0 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 new file mode 100644 index 0000000000..fa258994c7 --- /dev/null +++ b/gui/test/e2e/mocked/expired-account-error-view.spec.ts @@ -0,0 +1,33 @@ +import { Page } from 'playwright'; +import { SendMockIpcResponse, startAppWithMocking } from './mocked-utils'; +import { expect, test } from '@playwright/test'; +import { IAccountData } from '../../../src/shared/daemon-rpc-types'; +import { getBackgroundColor } from '../utils'; +import { colors } from '../../../src/config.json'; + +let page: Page; +let sendMockIpcResponse: SendMockIpcResponse; + +test.beforeAll(async () => { + ({ page, sendMockIpcResponse } = await startAppWithMocking()); +}); + +test.afterAll(async () => { + await page.close(); +}); + +test('App should show Expired Account Error View', async () => { + await sendMockIpcResponse<IAccountData>({ + channel: 'account-', + response: { expiry: new Date(Date.now() - 10 * 24 * 60 * 60 * 1000).toISOString() }, + }); + + await expect(page.locator('text=Out of time')).toBeVisible(); + const buyMoreButton = page.locator('button:has-text("Buy more credit")'); + await expect(buyMoreButton).toBeVisible(); + expect(await getBackgroundColor(buyMoreButton)).toBe(colors.green); + + const redeemVoucherButton = page.locator('button:has-text("Redeem voucher")'); + await expect(redeemVoucherButton).toBeVisible(); + expect(await getBackgroundColor(redeemVoucherButton)).toBe(colors.green); +}); |
