diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2023-03-24 11:31:28 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2023-03-27 10:18:28 +0200 |
| commit | 745c617d708d21c96b7fa61a219a3ded2c219643 (patch) | |
| tree | 4215870590f6d8109a742a903d331e3324b782ba /gui/test | |
| parent | 7900bee0590832c0dfdb922b4b71510ead8813e5 (diff) | |
| download | mullvadvpn-745c617d708d21c96b7fa61a219a3ded2c219643.tar.xz mullvadvpn-745c617d708d21c96b7fa61a219a3ded2c219643.zip | |
Add logout test
Diffstat (limited to 'gui/test')
| -rw-r--r-- | gui/test/e2e/installed/state-dependent/login.spec.ts | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/gui/test/e2e/installed/state-dependent/login.spec.ts b/gui/test/e2e/installed/state-dependent/login.spec.ts index 21568a6130..4cb83f8f27 100644 --- a/gui/test/e2e/installed/state-dependent/login.spec.ts +++ b/gui/test/e2e/installed/state-dependent/login.spec.ts @@ -57,12 +57,15 @@ test('App should create account', async () => { expect(await util.waitForNavigation()).toEqual(RoutePath.main); + const outOfTimeTitle = page.getByTestId('title'); + await expect(outOfTimeTitle).toHaveText('Congrats!'); + const inputValue = await page.getByTestId('account-number').textContent(); expect(inputValue).toHaveLength(19); accountNumber = inputValue!.replaceAll(' ', ''); }); -test('App should log out', async () => { +test('App should become logged out', async () => { expect(await util.waitForNavigation(() => { exec('mullvad account logout'); })).toEqual(RoutePath.login); @@ -87,6 +90,28 @@ test('App should log in', async () => { await expect(subtitle).toHaveText('Valid account number'); expect(await util.waitForNavigation()).toEqual(RoutePath.main); + + const outOfTimeTitle = page.getByTestId('title'); + await expect(outOfTimeTitle).toHaveText('Out of time'); +}); + +test('App should log out', async () => { + expect(await util.waitForNavigation(() => { + void page.getByLabel('Settings').click(); + })).toEqual(RoutePath.settings); + + expect(await util.waitForNavigation(() => { + void page.getByText('Account').click(); + })).toEqual(RoutePath.accountSettings); + + expect(await util.waitForNavigation(() => { + void page.getByText('Log out').click(); + })).toEqual(RoutePath.login); + + const title = page.locator('h1') + const subtitle = page.getByTestId('subtitle'); + await expect(title).toHaveText('Login'); + await expect(subtitle).toHaveText('Enter your account number'); }); function getInput(page: Page): Locator { |
