diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2023-06-14 13:05:42 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2023-06-28 09:13:18 +0200 |
| commit | f6c2af4c5787f826b479eb0e3d8ab7d539e538ff (patch) | |
| tree | 91c28c3aab4dcd0a7f499979066c05be9871bebf | |
| parent | e5666568cb8cceadfc178c17e3402698b7cd3d36 (diff) | |
| download | mullvadvpn-f6c2af4c5787f826b479eb0e3d8ab7d539e538ff.tar.xz mullvadvpn-f6c2af4c5787f826b479eb0e3d8ab7d539e538ff.zip | |
Update tests
| -rw-r--r-- | gui/test/e2e/mocked/settings.spec.ts | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/gui/test/e2e/mocked/settings.spec.ts b/gui/test/e2e/mocked/settings.spec.ts index e495c68b25..c6022678f5 100644 --- a/gui/test/e2e/mocked/settings.spec.ts +++ b/gui/test/e2e/mocked/settings.spec.ts @@ -9,27 +9,20 @@ let util: MockedTestUtils; test.beforeAll(async () => { ({ page, util } = await startMockedApp()); - await util.waitForNavigation(() => page.click('button[aria-label="Settings"]')); }); test.afterAll(async () => { await page.close(); }); -test('Settings Page', async () => { - const title = page.locator('h1'); - await expect(title).toContainText('Settings'); - - const closeButton = page.locator('button[aria-label="Close"]'); - await expect(closeButton).toBeVisible(); -}); - test('Account button should be displayed correctly', async () => { - const accountButton = page.locator('button:has-text("Account")'); + const accountButton = page.getByLabel('Account settings'); await expect(accountButton).toBeVisible(); +}); - let expiryText = accountButton.locator('span'); - await expect(expiryText).toContainText(/29 days left/i); +test('Headerbar account info should be displayed correctly', async () => { + let expiryText = page.getByText(/^Time left:/); + await expect(expiryText).toContainText(/Time left: 29 days/i); /** * 729 days left @@ -39,8 +32,7 @@ test('Account button should be displayed correctly', async () => { channel: 'account-', response: { expiry: new Date(Date.now() + 730 * 24 * 60 * 60 * 1000 - 1000).toISOString() }, }); - expiryText = accountButton.locator('span'); - await expect(expiryText).toContainText(/729 days left/i); + await expect(expiryText).toContainText(/Time left: 729 days/i); /** * 2 years left @@ -49,8 +41,7 @@ test('Account button should be displayed correctly', async () => { channel: 'account-', response: { expiry: new Date(Date.now() + 731 * 24 * 60 * 60 * 1000).toISOString() }, }); - expiryText = accountButton.locator('span'); - await expect(expiryText).toContainText(/2 years left/i); + await expect(expiryText).toContainText(/Time left: 2 years/i); /** * Expiry 1 day ago should show 'out of time' @@ -59,6 +50,15 @@ test('Account button should be displayed correctly', async () => { channel: 'account-', response: { expiry: new Date(Date.now() - 1 * 24 * 60 * 60 * 1000).toISOString() }, }); - expiryText = accountButton.locator('span'); - await expect(expiryText).toContainText(/out of time/i); + await expect(expiryText).not.toBeVisible(); +}); + +test('Settings Page', async () => { + await util.waitForNavigation(() => page.click('button[aria-label="Settings"]')); + + const title = page.locator('h1'); + await expect(title).toContainText('Settings'); + + const closeButton = page.locator('button[aria-label="Close"]'); + await expect(closeButton).toBeVisible(); }); |
