-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: E2E to reveal SRP on error boundary screen (#12805)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** To catch any regressions in the crash screen’s reveal SRP flow, we should add an end-to-end (e2e) test. Since revealing the Secret Recovery Phrase is the user’s last chance to view and securely save it, this test will check that each step in the flow works smoothly: from entering your password to viewing your SRP. ``` Scenario: A user can reveal their SRP while on the crash screen Given I encounter the crash screen When I tap linked text to reveal my SRP And I enter an invalid password Then I should see the appropriate error When I enter the correct password Then I can see my SRP ``` ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
- Loading branch information
Showing
7 changed files
with
137 additions
and
4 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
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
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
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,21 @@ | ||
import Matchers from '../../utils/Matchers'; | ||
import Gestures from '../../utils/Gestures'; | ||
import { ErrorBoundarySelectorsText } from '../../selectors/ErrorBoundary/ErrorBoundaryView.selectors'; | ||
|
||
class ErrorBoundaryView { | ||
get title() { | ||
return Matchers.getElementByText(ErrorBoundarySelectorsText.TITLE); | ||
} | ||
|
||
get srpLinkText() { | ||
return Matchers.getElementByText( | ||
ErrorBoundarySelectorsText.SAVE_YOUR_SRP_TEXT, | ||
); | ||
} | ||
|
||
async tapSRPLinkText() { | ||
await Gestures.waitAndTap(this.srpLinkText); | ||
} | ||
} | ||
|
||
export default new ErrorBoundaryView(); |
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
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,9 @@ | ||
import enContent from '../../../locales/languages/en.json'; | ||
|
||
export const ErrorBoundarySelectorsIDs = { | ||
CONTAINER: 'error-boundary-container-id', | ||
}; | ||
export const ErrorBoundarySelectorsText = { | ||
SAVE_YOUR_SRP_TEXT: enContent.error_screen.save_seedphrase_2, | ||
TITLE: enContent.error_screen.title, | ||
}; |
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,56 @@ | ||
'use strict'; | ||
import Browser from '../../pages/Browser/BrowserView'; | ||
import TabBarComponent from '../../pages/wallet/TabBarComponent'; | ||
import { loginToApp } from '../../viewHelper'; | ||
import TestDApp from '../../pages/Browser/TestDApp'; | ||
import FixtureBuilder from '../../fixtures/fixture-builder'; | ||
import { | ||
withFixtures, | ||
defaultGanacheOptions, | ||
} from '../../fixtures/fixture-helper'; | ||
import { SmokeAccounts } from '../../tags'; | ||
import TestHelpers from '../../helpers'; | ||
import Assertions from '../../utils/Assertions'; | ||
import RevealSecretRecoveryPhrase from '../../pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase'; | ||
import ErrorBoundaryView from '../../pages/ErrorBoundaryView/ErrorBoundaryView'; | ||
const PASSWORD = '123123123'; | ||
|
||
describe(SmokeAccounts('Error Boundary Screen'), () => { | ||
beforeAll(async () => { | ||
jest.setTimeout(2500000); | ||
await TestHelpers.reverseServerPort(); | ||
}); | ||
|
||
it('should trigger error boundary screen to reveal SRP', async () => { | ||
await withFixtures( | ||
{ | ||
dapp: true, | ||
fixture: new FixtureBuilder() | ||
.withGanacheNetwork() | ||
.withPermissionControllerConnectedToTestDapp() | ||
.build(), | ||
restartDevice: true, | ||
ganacheOptions: defaultGanacheOptions, | ||
}, | ||
async () => { | ||
await loginToApp(); | ||
|
||
await TabBarComponent.tapBrowser(); | ||
await Browser.navigateToTestDApp(); | ||
|
||
await TestDApp.tapInvalidSigButton(); | ||
await Assertions.checkIfVisible(ErrorBoundaryView.title); | ||
await ErrorBoundaryView.tapSRPLinkText(); | ||
|
||
await RevealSecretRecoveryPhrase.enterPasswordToRevealSecretCredential( | ||
PASSWORD, | ||
); | ||
// If the following step fails, ensure you are using a test build with tap and hold to reveal animation disabled | ||
await RevealSecretRecoveryPhrase.tapToReveal(); | ||
await Assertions.checkIfVisible(RevealSecretRecoveryPhrase.container); | ||
|
||
await Assertions.checkIfTextIsDisplayed(defaultGanacheOptions.mnemonic); | ||
}, | ||
); | ||
}); | ||
}); |