summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2024-02-06 09:00:48 +0100
committerOskar Nyberg <oskar@mullvad.net>2024-02-09 17:45:22 +0100
commit683fbbced61ce9379b1af0be6da8be5da3a11f25 (patch)
tree6542fa3e5d07942c9ac536f6056e124b694e1b91 /gui
parent8f2c9d889fd16d2c2592afb2135b8e10f0f34833 (diff)
downloadmullvadvpn-683fbbced61ce9379b1af0be6da8be5da3a11f25.tar.xz
mullvadvpn-683fbbced61ce9379b1af0be6da8be5da3a11f25.zip
Prevent race conditions in login test
Diffstat (limited to 'gui')
-rw-r--r--gui/test/e2e/installed/state-dependent/login.spec.ts31
1 files changed, 15 insertions, 16 deletions
diff --git a/gui/test/e2e/installed/state-dependent/login.spec.ts b/gui/test/e2e/installed/state-dependent/login.spec.ts
index 45444715bb..ba72a5b466 100644
--- a/gui/test/e2e/installed/state-dependent/login.spec.ts
+++ b/gui/test/e2e/installed/state-dependent/login.spec.ts
@@ -49,12 +49,12 @@ test('App should create account', async () => {
const title = page.locator('h1')
const subtitle = page.getByTestId('subtitle');
- await page.getByText('Create account').click();
+ expect(await util.waitForNavigation(async () => {
+ await page.getByText('Create account').click();
- await expect(title).toHaveText('Account created');
- await expect(subtitle).toHaveText('Logged in');
-
- expect(await util.waitForNavigation()).toEqual(RoutePath.expired);
+ await expect(title).toHaveText('Account created');
+ await expect(subtitle).toHaveText('Logged in');
+ })).toEqual(RoutePath.expired);
const outOfTimeTitle = page.getByTestId('title');
await expect(outOfTimeTitle).toHaveText('Congrats!');
@@ -80,13 +80,14 @@ test('App should log in', async () => {
await expect(title).toHaveText('Login');
await expect(subtitle).toHaveText('Enter your account number');
- await loginInput.type(process.env.ACCOUNT_NUMBER!);
- await loginInput.press('Enter');
+ await loginInput.fill(process.env.ACCOUNT_NUMBER!);
- await expect(title).toHaveText('Logged in');
- await expect(subtitle).toHaveText('Valid account number');
+ expect(await util.waitForNavigation(async () => {
+ await loginInput.press('Enter');
- expect(await util.waitForNavigation()).toEqual(RoutePath.main);
+ await expect(title).toHaveText('Logged in');
+ await expect(subtitle).toHaveText('Valid account number');
+ })).toEqual(RoutePath.main);
await expectDisconnected(page);
});
@@ -115,13 +116,11 @@ test('App should log in to expired account', async () => {
await expect(title).toHaveText('Login');
await expect(subtitle).toHaveText('Enter your account number');
- await loginInput.type(accountNumber);
- await loginInput.press('Enter');
-
- await expect(title).toHaveText('Logged in');
- await expect(subtitle).toHaveText('Valid account number');
+ await loginInput.fill(accountNumber);
- expect(await util.waitForNavigation()).toEqual(RoutePath.expired);
+ expect(await util.waitForNavigation(async () => {
+ await loginInput.press('Enter');
+ })).toEqual(RoutePath.expired);
const outOfTimeTitle = page.getByTestId('title');
await expect(outOfTimeTitle).toHaveText('Out of time');