Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: "BTC Account - Overview has portfolio button enabled for BTC accounts" flaky test #27018

Closed
9 tasks
seaona opened this issue Sep 10, 2024 · 0 comments · Fixed by #27017
Closed
9 tasks
Assignees
Labels
area-qa Relating to QA work (Quality Assurance) flaky tests release-12.5.0 Issue or pull request that will be included in release 12.5.0 Sev2-normal Normal severity; minor loss of service or inconvenience. team-extension-platform Extension Platform team type-bug Something isn't working

Comments

@seaona
Copy link
Contributor

seaona commented Sep 10, 2024

What is this about?

https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/99451/workflows/44749f3c-1cf7-4f02-978c-d37e876f3725/jobs/3701996/tests

Scenario

No response

Design

No response

Technical Details

No response

Threat Modeling Framework

No response

Acceptance Criteria

No response

Stakeholder review needed before the work gets merged

  • Engineering (needed in most cases)
  • Design
  • Product
  • QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
  • Security
  • Legal
  • Marketing
  • Management (please specify)
  • Other (please specify)

References

No response

@seaona seaona added type-bug Something isn't working Sev2-normal Normal severity; minor loss of service or inconvenience. team-extension-platform Extension Platform team flaky tests area-qa Relating to QA work (Quality Assurance) labels Sep 10, 2024
@seaona seaona self-assigned this Sep 10, 2024
@github-project-automation github-project-automation bot moved this to To be fixed in Bugs by severity Sep 10, 2024
seaona added a commit that referenced this issue Sep 10, 2024
…for BTC accounts` (#27017)

<!--
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**
The way the last 2 assertions are constructed are an anti-pattern, that
give place to a race condition, where we wait for the selector to
appear, but we don't wait for it to be enabled, so it can happen that
when we do the assertion, the button is not yet enabled.

```
const buySellButton = await driver.waitForSelector(
  '[data-testid="coin-overview-buy"]',
);
assert.equal(await buySellButton.isEnabled(), true);

const portfolioButton = await driver.waitForSelector(
  '[data-testid="coin-overview-receive"]',
);
assert.equal(await portfolioButton.isEnabled(), true);
```
![Screenshot from 2024-09-10
11-48-09](https://github.com/user-attachments/assets/70672d6c-5f05-47ea-aaf9-5561131ebf25)


To fix this, we need to directly wait for the element to be enabled
(`findClickableElement`).


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

## **Related issues**

Fixes: #27018

## **Manual testing steps**

1. Check ci

## **Screenshots/Recordings**
See how the element Buy is present and it's already enabled but when the
assertion took place, the button was still disabled.


![image](https://github.com/user-attachments/assets/5c97c1a6-2fcf-4697-bdec-6e3dadb9cf24)


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

- [ ] 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.
@github-project-automation github-project-automation bot moved this from To be fixed to Fixed in Bugs by severity Sep 10, 2024
@metamaskbot metamaskbot added the release-12.6.0 Issue or pull request that will be included in release 12.6.0 label Sep 10, 2024
@gauthierpetetin gauthierpetetin added release-12.5.0 Issue or pull request that will be included in release 12.5.0 and removed release-12.6.0 Issue or pull request that will be included in release 12.6.0 labels Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-qa Relating to QA work (Quality Assurance) flaky tests release-12.5.0 Issue or pull request that will be included in release 12.5.0 Sev2-normal Normal severity; minor loss of service or inconvenience. team-extension-platform Extension Platform team type-bug Something isn't working
Projects
Archived in project
3 participants