-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add Stake e2e automation (#13180)
<!-- 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** These are the Stake flows this PR will automate: - Stake - Unstake - Stake more - Claim - Making sure staking balance, banners, and actions are hidden for ETH assets that aren't on mainnet or holesky To run them locally follow these steps: - Build the app locally and make sure you set the following ENV variables: `export MM_MULTICHAIN_V1_ENABLED="true"` `export MM_CHAIN_PERMISSIONS="true"` `export MM_PERMISSIONS_SETTINGS_V1_ENABLED="false"` `export PORTFOLIO_VIEW="true"` `export MM_SECURITY_ALERTS_API_ENABLED="true"` `export MM_NETWORK_UI_REDESIGN_ENABLED= "false"` and run `yarn test:e2e:android:debug:build` - Run the following command ` yarn test:e2e:android:debug:run e2e/specs/stake/stake-action-smoke.spec.js` ## **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
23 changed files
with
519 additions
and
50 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
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,15 @@ | ||
import Gestures from '../../utils/Gestures.js'; | ||
import Matchers from '../../utils/Matchers.js'; | ||
import { StakeConfirmViewSelectors } from '../../selectors/Stake/StakeConfirmView.selectors.js'; | ||
|
||
class StakeConfirmationView { | ||
get confirmButton() { | ||
return Matchers.getElementByText(StakeConfirmViewSelectors.CONFIRM); | ||
} | ||
|
||
async tapConfirmButton() { | ||
await Gestures.waitAndTap(this.confirmButton); | ||
} | ||
} | ||
|
||
export default new StakeConfirmationView(); |
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,45 @@ | ||
import { StakeViewSelectors } from '../../selectors/Stake/StakeView.selectors.js'; | ||
|
||
import Matchers from '../../utils/Matchers'; | ||
import Gestures from '../../utils/Gestures'; | ||
|
||
class StakeView { | ||
get stakeContainer() { | ||
return Matchers.getElementByText(StakeViewSelectors.STAKE_CONTAINER); | ||
} | ||
|
||
get unstakeContainer() { | ||
return Matchers.getElementByText(StakeViewSelectors.UNSTAKE_CONTAINER); | ||
} | ||
|
||
get reviewButton() { | ||
return Matchers.getElementByText(StakeViewSelectors.REVIEW_BUTTON); | ||
} | ||
|
||
get continueButton() { | ||
return Matchers.getElementByText(StakeViewSelectors.CONTINUE); | ||
} | ||
|
||
async selectAmount(amount) { | ||
const amountButton = await Matchers.getElementByText(amount); | ||
await Gestures.waitAndTap(amountButton); | ||
} | ||
|
||
async enterAmount(amount) { | ||
for (let idx = 0; idx < amount.length; idx++) { | ||
const element = Matchers.getElementByText(amount[idx]); | ||
await Gestures.waitAndTap(element); | ||
} | ||
} | ||
|
||
async tapReview() { | ||
await Gestures.waitAndTap(this.reviewButton); | ||
} | ||
|
||
async tapContinue() { | ||
await Gestures.waitAndTap(this.continueButton); | ||
} | ||
|
||
} | ||
|
||
export default new StakeView(); |
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
Oops, something went wrong.