Skip to content

Commit

Permalink
test: improve logInWithBalanceValidation function in e2e test (#25139)
Browse files Browse the repository at this point in the history
## **Description**
Remove the delay in function `logInWithBalanceValidation` to avoid
slowing down tests, especially considering its potential extensive
usage.

## **Related issues**

Fixes:

## **Manual testing steps**
E2E tests should all pass.

## **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**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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
chloeYue authored Jun 11, 2024
1 parent 1af66fb commit 9f6803e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions test/e2e/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ const TEST_SEED_PHRASE_TWO =
const locateAccountBalanceDOM = async (driver, ganacheServer) => {
const balance = await ganacheServer.getBalance();

await driver.findElement({
await driver.waitForSelector({
css: '[data-testid="eth-overview__primary-currency"]',
text: `${balance} ETH`,
});
Expand Down Expand Up @@ -906,9 +906,8 @@ async function unlockWallet(

const logInWithBalanceValidation = async (driver, ganacheServer) => {
await unlockWallet(driver);
await locateAccountBalanceDOM(driver, ganacheServer);
// Wait for balance to load
await driver.delay(500);
await locateAccountBalanceDOM(driver, ganacheServer);
};

function roundToXDecimalPlaces(number, decimalPlaces) {
Expand Down

0 comments on commit 9f6803e

Please sign in to comment.