diff options
| -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); +}); |
