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: "ENS domain resolves to a correct address" #24652

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

flaky test: "ENS domain resolves to a correct address" #24652

chloeYue opened this issue May 20, 2024 · 0 comments · Fixed by #25248
Assignees
Labels
flaky tests release-12.1.0 Issue or pull request that will be included in release 12.1.0 team-extension-platform

Comments

@chloeYue
Copy link
Contributor

What is this about?

Failure:

https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/80831/workflows/15761449-ac91-4883-8f2e-7dabfdd8a638/jobs/2858053/tests

Error message

Screenshot 2024-05-20 at 17 58 52

Screenshot
Screenshot 2024-05-20 at 17 58 58

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: [MMI] - "ENS domain resolves to a correct address" flaky test: "ENS domain resolves to a correct address" May 22, 2024
@seaona seaona self-assigned this Jun 12, 2024
seaona added a commit that referenced this issue Jun 13, 2024
<!--
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 flaky test `ENS domain resolves to a correct address`

The error is: 
```

[driver] Called 'clickElement' with arguments [".address-list-item"]
[driver] Called 'findElement' with arguments [{"css":".ens-input__selected-input__title","text":"test.eth"}]
Failure on testcase: 'ENS domain resolves to a correct address', for more information see the artifacts tab in CI

TimeoutError: Waiting for element to be located By(xpath, .//*[contains(concat(' ', normalize-space(./@Class), ' '), ' ens-input__selected-input__title ')][(contains(string(.), 'test.eth') or contains(string(.), 'test.eth'))])`

```

The problem is that we are clicking the address-list-item button, and
nothing happens afterwards. Then we try to find the next element but is
not there.
If we look into the address-list-item button element we can see how it
has nested elements inside, which will render the address and the ENS
domain.
Clicking on a "container" element with other elements inside might not
work as we expect, since the inside elements might not be fully updated
before clicking with unknown effects (in this case, the ENS and address
resolution) .

To fix this, we are doing 2 things:
- waiting for both the ENS and the address to be fully rendered (before
we were just waiting for the ENS domain to be loaded)
- clicking on a more specific element inside the container -> we now
click into the inner element for the domain ENS



See Box as the container button, and nested elements with address and
ENS domain.

![Screenshot from 2024-06-12
10-49-23](https://github.com/MetaMask/metamask-extension/assets/54408225/bef54bcf-9f67-46f3-9155-b877fb9c844f)


- ci failure example:
https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/86997/workflows/200911a8-50a6-42f2-b56a-b6f7afc8fc1e/jobs/3178850/artifacts

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

## **Related issues**

Fixes: #24652

## **Manual testing steps**

1. Check ci
2. Run test multiple times locally with different builds `yarn
test:e2e:single test/e2e/tests/transaction/ens.spec.js --browser=chrome
--leave-running --retryUntilFailure --retries=10`

## **Screenshots/Recordings**
Ci failure screenshot: notice how, after clicking the ENS address
button, we don't see the asset below, this means that the click didn't
have any effect.



![image](https://github.com/MetaMask/metamask-extension/assets/54408225/c62f66e5-a194-4d70-917b-5677cdb13f87)


Expected: after clicking the EN address button, we should see the asset
below


![Screenshot from 2024-06-12
10-04-33](https://github.com/MetaMask/metamask-extension/assets/54408225/9478f881-edeb-4a32-9e95-ce715526e72b)



## **Pre-merge author checklist**

- [ ] 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).
- [ ] 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.
- [ ]
@metamaskbot metamaskbot added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Jun 13, 2024
hjetpoluru pushed a commit that referenced this issue Jun 26, 2024
<!--
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.
-->

This PR fixes the flaky test `ENS domain resolves to a correct address`

The error is:
```

[driver] Called 'clickElement' with arguments [".address-list-item"]
[driver] Called 'findElement' with arguments [{"css":".ens-input__selected-input__title","text":"test.eth"}]
Failure on testcase: 'ENS domain resolves to a correct address', for more information see the artifacts tab in CI

TimeoutError: Waiting for element to be located By(xpath, .//*[contains(concat(' ', normalize-space(./@Class), ' '), ' ens-input__selected-input__title ')][(contains(string(.), 'test.eth') or contains(string(.), 'test.eth'))])`

```

The problem is that we are clicking the address-list-item button, and
nothing happens afterwards. Then we try to find the next element but is
not there.
If we look into the address-list-item button element we can see how it
has nested elements inside, which will render the address and the ENS
domain.
Clicking on a "container" element with other elements inside might not
work as we expect, since the inside elements might not be fully updated
before clicking with unknown effects (in this case, the ENS and address
resolution) .

To fix this, we are doing 2 things:
- waiting for both the ENS and the address to be fully rendered (before
we were just waiting for the ENS domain to be loaded)
- clicking on a more specific element inside the container -> we now
click into the inner element for the domain ENS

See Box as the container button, and nested elements with address and
ENS domain.

![Screenshot from 2024-06-12
10-49-23](https://github.com/MetaMask/metamask-extension/assets/54408225/bef54bcf-9f67-46f3-9155-b877fb9c844f)

- ci failure example:
https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/86997/workflows/200911a8-50a6-42f2-b56a-b6f7afc8fc1e/jobs/3178850/artifacts

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

Fixes: #24652

1. Check ci
2. Run test multiple times locally with different builds `yarn
test:e2e:single test/e2e/tests/transaction/ens.spec.js --browser=chrome
--leave-running --retryUntilFailure --retries=10`

Ci failure screenshot: notice how, after clicking the ENS address
button, we don't see the asset below, this means that the click didn't
have any effect.

![image](https://github.com/MetaMask/metamask-extension/assets/54408225/c62f66e5-a194-4d70-917b-5677cdb13f87)

Expected: after clicking the EN address button, we should see the asset
below

![Screenshot from 2024-06-12
10-04-33](https://github.com/MetaMask/metamask-extension/assets/54408225/9478f881-edeb-4a32-9e95-ce715526e72b)

- [ ] 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).
- [ ] 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.

- [ ] 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.
- [ ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flaky tests release-12.1.0 Issue or pull request that will be included in release 12.1.0 team-extension-platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants