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

Flaky Test: Multiple tests failing with ElementClickInterceptedError on dapp interaction #24597

Closed
9 tasks
chloeYue opened this issue May 20, 2024 · 2 comments · Fixed by #24607
Closed
9 tasks

Comments

@chloeYue
Copy link
Contributor

chloeYue commented May 20, 2024

What is this about?

Related tests:

  • Permissions Page should redirect users to connections page when users click on connected permission
  • Connections page should disconnect when click on Disconnect button in connections page

Failure:
https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/81118/workflows/04fa31d6-ea90-4e1d-9161-0e61fb05b85e/jobs/2873298/tests
https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/81133/workflows/0b962d69-e9d4-4c3e-9ca0-cfa829b667e2/jobs/2874111/tests

Error message
Screenshot 2024-05-20 at 09 45 55

Screenshot 2024-05-20 at 11 18 20

Screenshot
Screenshot 2024-05-20 at 09 46 06

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

@chloeYue chloeYue changed the title Flaky Test: "Permissions Page should redirect users to connections page when users click on connected permission" Flaky Test: Multiple tests failing with ElementClickInterceptedError on dapp interaction May 20, 2024
@seaona
Copy link
Contributor

seaona commented May 20, 2024

I had this PR for fixing one of these instances, and updated the PR for fixing the 3 of them

#24580

@seaona seaona self-assigned this May 20, 2024
seaona added a commit that referenced this issue May 20, 2024
#24607)

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

This PR fixes the following flaky tests:

- Permissions Page should redirect users to connections page when users
click on connected permission
- Connections page should disconnect when click on Disconnect button in
connections page

After this PR is merged, for fixing this tests we use the same approach,
utilizing the new method for waiting for the notification to disappear
after accepting it

```
async clickElementAndWaitToDisappear(rawLocator) {
    const element = await this.findClickableElement(rawLocator);
    await element.click();
    await element.waitForElementState('hidden');
  }
```

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

## **Related issues**

Fixes: #24597

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**
Artifacts from ci


![image](https://github.com/MetaMask/metamask-extension/assets/54408225/e0bdfeab-8fec-4201-b447-e65dd552ebc7)


<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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-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.
seaona added a commit that referenced this issue May 20, 2024
…d `Connections Page...` due to overlaying popup (#24580)

## **Description**
This is a PR for fixing the flaky tests:
- Dapp viewed Event @no-mmi is sent when reconnect to a dapp that has
been connected before
- Permissions Page should redirect users to connections page when users
click on connected permission
- Connections page should disconnect when click on Disconnect button in
connections page

The problem seems to be that we are trying to click an element, but
there is the previous notifcation element on top and has not disappeared
yet at the moment we want to perform the click operation.

We can see this in the artifacts of the failure, where the blue
notification popup is still there, despite having already clicked 'Got
it'.
This is also confirmed by the error message in the logs:

```
[driver] Called 'clickElement' with arguments [{"text":"Got it","tag":"button"}]
[driver] Called 'clickElement' with arguments [{"text":"127.0.0.1:8080","tag":"p"}]
Failure on testcase: 'Dapp viewed Event @no-mmi is sent when reconnect to a dapp that has been connected before', for more information see the artifacts tab in CI
ElementClickInterceptedError: Element <p class="mm-box mm-text mm-text--body-md mm-text--elllipsis mm-text--text-align-left mm-box--color-text-default">
 is not clickable at point (444,92) because another element <h4 class="mm-box mm-text mm-text--heading-sm mm-text--text-align-center mm-box--width-full mm-box--color-info-inverse"> obscures it
```

The solution here is to wait for the element to disappear. Since this
seems a case that can happen more often, a new driver function has been
introduced, which basically clicks an element and waits until it
disappears. This can be suitable for when accepting notifications/popup
that whenever we accept them, those should disappear before we proceed
with the next action.

```
  async clickElementAndWaitToDisappear(rawLocator) {
    const element = await this.findClickableElement(rawLocator);
    await element.click();
    await element.waitForElementState('hidden');
  }
 ```

## **Related issues**

Fixes: #24575 and #24597

## **Manual testing steps**

1. locally: run the test locally several times ` yarn test:e2e:single test/e2e/tests/metrics/dapp-viewed.spec.js --browser=chrome --leave-running=true`
2. ci: Check ci and see is not failing

## **Screenshots/Recordings**
Artifacts and logs from ci that helped in the investigation:

![image](https://github.com/MetaMask/metamask-extension/assets/54408225/a63bea82-1a8b-49bc-8037-c389a36579fe)

![Screenshot from 2024-05-17 11-27-45](https://github.com/MetaMask/metamask-extension/assets/54408225/5fdef2d3-8049-445b-a795-a1d7a6f16959)


## **Pre-merge author checklist**

- [X] I’ve followed [MetaMask 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
- [ ] 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-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.

---------

Co-authored-by: legobeat <[email protected]>
@seaona
Copy link
Contributor

seaona commented May 20, 2024

Fixed by #24580

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants