Skip to content

Commit

Permalink
fix: flaky tests `Test Snap bip-44 can pop up bip-44 snap and get pri…
Browse files Browse the repository at this point in the history
…vate key result` and others using `clickElementSafe` (#30430)

<!--
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**
Several snap tests are flaky because of the `clickElementSafe` method.
This method is used in several snap tests for clicking the scroll arrow
before confirming.
The problem is that the clickElementSafe has a default timeout of
1second, meaning, if the scroll arrow doesn't appear within 1 second,
the click is skipped and we jump into the next step which is click
Confirm. That timeout of 1 second sometimes is not sufficient, meaning
we then try to click Confirm button, which is disabled because we need
to click the arrow first.



![image](https://github.com/user-attachments/assets/f53f8dc2-7dfd-4e80-a2fe-485c7d0e1424)

![Screenshot from 2025-02-19
14-02-13](https://github.com/user-attachments/assets/c0542e6d-1146-4dd3-a401-d79e800d4579)


[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/30430?quickstart=1)

## **Related issues**

Fixes:

## **Manual testing steps**

1. Check ci works

## **Screenshots/Recordings**



https://github.com/user-attachments/assets/5092d1b0-aa8d-4d11-8590-f63a63077a52



## **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/main/.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/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
seaona authored Feb 19, 2025
1 parent f73fd30 commit 0832bdd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/e2e/webdriver/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ class Driver {
* @param rawLocator - Element locator
* @param timeout - The maximum time in ms to wait for the element
*/
async clickElementSafe(rawLocator, timeout = 1000) {
async clickElementSafe(rawLocator, timeout = 2000) {
try {
const locator = this.buildLocator(rawLocator);
const elements = await this.driver.wait(
Expand Down

0 comments on commit 0832bdd

Please sign in to comment.