Skip to content

Commit

Permalink
end to end test for forgot password flow
Browse files Browse the repository at this point in the history
  • Loading branch information
owencraston committed Jul 16, 2024
1 parent 7b3450a commit 465a197
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions test/e2e/accounts/forgot-password.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { Suite } from 'mocha';
import {
unlockWallet,
withFixtures,
locateAccountBalanceDOM,
findAnotherAccountFromAccountList,
TEST_SEED_PHRASE_TWO,
} from '../helpers';
import FixtureBuilder from '../fixture-builder';
import { Driver } from '../webdriver/driver';

const newPassword = 'this is the best password ever'

describe('Forgot password', function (this: Suite) {
it('Reset password then log in with new password', async function () {
await withFixtures(
{
fixtures: new FixtureBuilder().build(),
title: this.test?.fullTitle(),
},
async ({ driver }: { driver: Driver }) => {
await unlockWallet(driver);

// Lock Wallet
await driver.waitForSelector(
'[data-testid="account-options-menu-button"]',
);
await driver.clickElement(
'[data-testid="account-options-menu-button"]',
);
await driver.clickElement({
text: 'Lock MetaMask',
tag: 'div',
});

// Go to reset password page
await driver.waitForSelector(
'.unlock-page__link',
);
await driver.clickElement({
text: 'Forgot password?',
tag: 'a',
});

// Reset password with a new password
await driver.pasteIntoField(
'[data-testid="import-srp__srp-word-0"]',
TEST_SEED_PHRASE_TWO,
);

await driver.fill('#password', newPassword);
await driver.fill('#confirm-password', newPassword);
await driver.press('#confirm-password', driver.Key.ENTER);

// Lock wallet again
await driver.waitForSelector(
'[data-testid="account-options-menu-button"]',
);
await driver.clickElement(
'[data-testid="account-options-menu-button"]',
);
await driver.clickElement({
text: 'Lock MetaMask',
tag: 'div',
});

// log in with new password
await driver.fill('#password', newPassword);
await driver.press('#password', driver.Key.ENTER);
},
);
});
});

0 comments on commit 465a197

Please sign in to comment.