summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2023-03-24 11:31:28 +0100
committerOskar Nyberg <oskar@mullvad.net>2023-03-27 10:18:28 +0200
commit745c617d708d21c96b7fa61a219a3ded2c219643 (patch)
tree4215870590f6d8109a742a903d331e3324b782ba
parent7900bee0590832c0dfdb922b4b71510ead8813e5 (diff)
downloadmullvadvpn-745c617d708d21c96b7fa61a219a3ded2c219643.tar.xz
mullvadvpn-745c617d708d21c96b7fa61a219a3ded2c219643.zip
Add logout test
-rw-r--r--gui/src/renderer/components/ExpiredAccountErrorView.tsx8
-rw-r--r--gui/test/e2e/installed/state-dependent/login.spec.ts27
2 files changed, 32 insertions, 3 deletions
diff --git a/gui/src/renderer/components/ExpiredAccountErrorView.tsx b/gui/src/renderer/components/ExpiredAccountErrorView.tsx
index 8cfcdb1d46..d5af378cca 100644
--- a/gui/src/renderer/components/ExpiredAccountErrorView.tsx
+++ b/gui/src/renderer/components/ExpiredAccountErrorView.tsx
@@ -107,7 +107,9 @@ function WelcomeView() {
return (
<>
- <StyledTitle>{messages.pgettext('connect-view', 'Congrats!')}</StyledTitle>
+ <StyledTitle data-testid="title">
+ {messages.pgettext('connect-view', 'Congrats!')}
+ </StyledTitle>
<StyledAccountTokenMessage>
{messages.pgettext('connect-view', 'Here’s your account number. Save it!')}
<StyledAccountTokenContainer>
@@ -136,7 +138,9 @@ function Content() {
<StyledStatusIcon>
<ImageView source="icon-fail" height={60} width={60} />
</StyledStatusIcon>
- <StyledTitle>{messages.pgettext('connect-view', 'Out of time')}</StyledTitle>
+ <StyledTitle data-testid="title">
+ {messages.pgettext('connect-view', 'Out of time')}
+ </StyledTitle>
<StyledMessage>
{sprintf('%(introduction)s %(recoveryMessage)s', {
introduction: messages.pgettext(
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 {