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: flaky test Settings Redirects to ENS domains when user inputs ENS into address bar #24898

Merged
merged 11 commits into from
Jun 21, 2024

Conversation

seaona
Copy link
Contributor

@seaona seaona commented May 30, 2024

Description

This PR fixes some flakiness of the test Settings Redirects to ENS domains when user inputs ENS into address bar. After looking into the code I've identified a source of flakiness, as well as a problem that prevents to upload the artifacts (screenshot) if the test fail.

  • The test was not using any mock: this is a source of flakiness, and it's now fixed by adding the necessary mocks to the ENS contracts and Infura calls (we need to set Mainnet, since this feature is only available on Mainnet)
  • The test was not using fixtures: this per se is not a problem, but the issue here is that we are not triggering the verboseReportOnFailure(title,error) on error, making it harder to debug, as no artifacts are uploaded for this test, if it fails. Now we are going to be able to see the screenshot if the test ever fails again

Circle ci job: https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/83569/workflows/0883aa51-cd94-4066-9f96-77d1375e5e9b/jobs/2994904/tests

Failure log: TimeoutError: Wait timed out after 213ms

Extra note: @davidmurdoch is also working on mitigating the rest of the flakiness by waiting for the metamask to be fully initialized before proceeding with the test. This work will be done in a separate PR.

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

See no artifact file was uploaded:

https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/83569/workflows/0883aa51-cd94-4066-9f96-77d1375e5e9b/jobs/2994904/artifacts

Screenshot from 2024-05-30 13-43-01

Screenshot from 2024-05-30 13-43-04

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • 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 format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). 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.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@seaona seaona marked this pull request as ready for review May 30, 2024 11:51
@seaona seaona requested a review from a team as a code owner May 30, 2024 11:51
return currentUrl === ENS_DESTINATION_URL;
}, tinyDelayMs);

await driver.quit();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to start or stop the driver manually, as now it's done within the fixtures

@@ -10,25 +155,36 @@ describe('Settings', function () {
it('Redirects to ENS domains when user inputs ENS into address bar', async function () {
// Using proxy port that doesn't resolve so that the browser can error out properly
// on the ".eth" hostname. The proxy does too much interference with 8000.
const { driver } = await buildWebDriver({ proxyUrl: '127.0.0.1:8001' });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to preserve the proxy number, we now pass this as an option in fixtures, and forward it to the chrome/firefox drivers as an option

DDDDDanica
DDDDDanica previously approved these changes May 30, 2024
Copy link

codecov bot commented May 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.92%. Comparing base (a16d1be) to head (0c255ca).
Report is 29 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #24898   +/-   ##
========================================
  Coverage    64.92%   64.92%           
========================================
  Files         1385     1385           
  Lines        54875    54875           
  Branches     14409    14409           
========================================
  Hits         35625    35625           
  Misses       19250    19250           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hjetpoluru
Copy link
Contributor

hjetpoluru commented May 30, 2024

@seaona, I am getting this error when I ran locally against firefox and its not consistent.

<testsuites name="Mocha Tests" time="9.584" tests="2" failures="2">
 <testsuite name="Root Suite" timestamp="2024-05-30T20:21:30" tests="0" time="0.000" failures="0">
 </testsuite>
 <testsuite name="Settings" timestamp="2024-05-30T20:21:30" tests="2" file="/Users/harikajetpoluru/repo/metamask-extension/test/e2e/tests/settings/ipfs-ens-resolution.spec.js" time="9.583" failures="2">
   <testcase name="Settings Redirects to ENS domains when user inputs ENS into address bar" time="9.179" classname="Redirects to ENS domains when user inputs ENS into address bar">
     <failure message="Wait timed out after 212ms" type="TimeoutError"><![CDATA[TimeoutError: Wait timed out after 212ms
   at /Users/harikajetpoluru/repo/metamask-extension/node_modules/selenium-webdriver/lib/webdriver.js:929:17
   at processTicksAndRejections (node:internal/process/task_queues:95:5)]]></failure>
   </testcase>
   <testcase name="Settings Does not fetch ENS data for ENS Domain when ENS and IPFS switched off" time="0.342" classname="Does not fetch ENS data for ENS Domain when ENS and IPFS switched off">
     <failure message="listen EADDRINUSE: address already in use 127.0.0.1:8545." type="Error"><![CDATA[Error: listen EADDRINUSE: address already in use 127.0.0.1:8545.
   at /Users/harikajetpoluru/repo/metamask-extension/node_modules/ganache/dist/node/webpack:/Ganache/core/lib/src/server.js:193:33
   at async Promise.allSettled (index 1)
   at Ganache.start (test/e2e/seeder/ganache.ts:19:9)
   at withFixtures (test/e2e/helpers.js:29:55)
   at Context.<anonymous> (test/e2e/tests/settings/ipfs-ens-resolution.spec.js:174:9)]]></failure>
   </testcase>
 </testsuite>
</testsuites>

@metamaskbot
Copy link
Collaborator

Builds ready [5da3ac2]
Page Load Metrics (837 ± 559 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint702021073818
domContentLoaded96219157
load5628518371164559
domInteractive96219157
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@seaona
Copy link
Contributor Author

seaona commented May 31, 2024

@seaona, I am getting this error when I ran locally against firefox and its not consistent.

hey @hjetpoluru 👋 thank you for reporting this 🙇‍♀️ I'll trigger a couple of more ci runs to double-check it does not fail and report back here 🙏

@metamaskbot
Copy link
Collaborator

Builds ready [852ccdf]
Page Load Metrics (214 ± 216 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint7415299199
domContentLoaded97817157
load471583214449216
domInteractive97817157

legobeat
legobeat previously approved these changes May 31, 2024
@hjetpoluru
Copy link
Contributor

@seaona , Good part is that - the issue is partially fixed - we are now able to obtain the failure details in the artifacts. However, the downside is that it's still flaky.https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/84316/workflows/2cea2ca2-c1d0-4e82-96dc-a51859d177dc/jobs/3033481/artifacts

@seaona seaona marked this pull request as draft June 3, 2024 08:27
@seaona
Copy link
Contributor Author

seaona commented Jun 3, 2024

yeah @hjetpoluru I move this to draft to investigate further the flakiness observed in ci, now that we have screenshots available with the current fix 👍 thank you!!

HowardBraham added a commit that referenced this pull request Jun 14, 2024
HowardBraham added a commit that referenced this pull request Jun 14, 2024
HowardBraham added a commit that referenced this pull request Jun 15, 2024
HowardBraham added a commit that referenced this pull request Jun 15, 2024
HowardBraham added a commit that referenced this pull request Jun 15, 2024
HowardBraham added a commit that referenced this pull request Jun 15, 2024
HowardBraham
HowardBraham previously approved these changes Jun 17, 2024
@seaona seaona marked this pull request as ready for review June 18, 2024 08:56
@metamaskbot
Copy link
Collaborator

Builds ready [2fe41ee]
Page Load Metrics (42 ± 2 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6213475167
domContentLoaded811910
load38534242
domInteractive811910
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@HowardBraham HowardBraham dismissed their stale review June 20, 2024 21:12

Needs a little more work

@seaona
Copy link
Contributor Author

seaona commented Jun 21, 2024

Needs a little more work

The redirect flakiness has now been mitigated using @HowardBraham 's suggestion with the use of a greater max value.
The PR is now ready for review

@metamaskbot
Copy link
Collaborator

Builds ready [0c255ca]
Page Load Metrics (132 ± 164 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6612284147
domContentLoaded8331252
load401624132343164
domInteractive8331252
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@HowardBraham HowardBraham merged commit 3552a39 into develop Jun 21, 2024
74 checks passed
@HowardBraham HowardBraham deleted the flaky-ens-redirect branch June 21, 2024 21:00
@github-actions github-actions bot locked and limited conversation to collaborators Jun 21, 2024
@metamaskbot metamaskbot added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Jun 21, 2024
@seaona seaona self-assigned this Jul 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
flaky tests release-12.1.0 Issue or pull request that will be included in release 12.1.0 team-extension-platform
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

8 participants