-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
end to end test for forgot password flow
- Loading branch information
1 parent
7b3450a
commit 465a197
Showing
1 changed file
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}, | ||
); | ||
}); | ||
}); |