Skip to content

22542 add e2e test for update network#22762

Merged
hjetpoluru merged 28 commits intodevelopfrom
22542-add-e2e-test-for-update-network
Feb 14, 2024
Merged

22542 add e2e test for update network#22762
hjetpoluru merged 28 commits intodevelopfrom
22542-add-e2e-test-for-update-network

Conversation

@hjetpoluru
Copy link
Copy Markdown
Contributor

@hjetpoluru hjetpoluru commented Feb 1, 2024

Description

This PR adds test coverage for update network which is critical flow in the extension.

Related issues

Fixes:

Manual testing steps

Run the tests locally
yarn
yarn start:test
yarn test:e2e:single test/e2e/tests/network/update-network.spec.ts --browser=chrome --debug --leave-running
yarn test:e2e:single test/e2e/tests/network/update-network.spec.ts --browser=firefox --debug --leave-running

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • 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.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

@hjetpoluru hjetpoluru added team-extension-platform Extension Platform team e2e-test End to end test for the MetaMask extension labels Feb 1, 2024
@hjetpoluru hjetpoluru self-assigned this Feb 1, 2024
@hjetpoluru hjetpoluru requested a review from a team as a code owner February 1, 2024 02:43
@hjetpoluru hjetpoluru linked an issue Feb 1, 2024 that may be closed by this pull request
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2024

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.

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Feb 1, 2024
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3844eac) 68.47% compared to head (babc8df) 68.47%.
Report is 3 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #22762   +/-   ##
========================================
  Coverage    68.47%   68.47%           
========================================
  Files         1088     1088           
  Lines        42956    42956           
  Branches     11436    11436           
========================================
  Hits         29410    29410           
  Misses       13546    13546           

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

@HowardBraham
Copy link
Copy Markdown
Contributor

  1. Let's centralize those selectors, you're repeating some of the same ones in 3 places already. Create /test/e2e/helpers/selectors.ts and import from there.
  2. This is an optional challenge, but it would be nice to write new tests in TypeScript. We're supposed to be writing all new things in TypeScript, but few people are following it. I wrote some samples of TS E2E in the /test/e2e/accounts folder.

@hjetpoluru
Copy link
Copy Markdown
Contributor Author

@HowardBraham ,Thank you for your keen observation regarding centralizing the object selectors. I absolutely agree that there is duplication in that regard. Mariona is currently working on implementing the Page Object Model, which will be a significant framework change, and we will address this issue as part of that process.

I did explore TypeScript briefly, using your accounts as a reference, but I encountered some challenges. I plan to allocate some time today to give it another try. I agree with your recommendation that we should transition to writing our code in TypeScript.

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [698d395]
Page Load Metrics (871 ± 41 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint921891322512
domContentLoaded126928168
load69910538718641
domInteractive126928168
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [dee828c]
Page Load Metrics (817 ± 19 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint102150119157
domContentLoaded10451894
load7569008174019
domInteractive10451894
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@HowardBraham
Copy link
Copy Markdown
Contributor

I was thinking about what Mark Stacey said today with our very large CircleCI usage. In that context, it makes sense to combine and form larger tests. I tried, and this could be condensed into a single test that takes 55 seconds to run. This is true because nothing has to be "reset" in between tests.

How do other people feel about this?

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [57034e2]
Page Load Metrics (896 ± 97 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint861651242110
domContentLoaded94820105
load755168889620397
domInteractive94720105
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@chloeYue
Copy link
Copy Markdown
Contributor

chloeYue commented Feb 6, 2024

I was thinking about what Mark Stacey said today with our very large CircleCI usage. In that context, it makes sense to combine and form larger tests. I tried, and this could be condensed into a single test that takes 55 seconds to run. This is true because nothing has to be "reset" in between tests.

How do other people feel about this?

Hi @HowardBraham , Yes, I always agree with the idea of smart coupling for e2e test, It reduces execution time, it's more "end-to-end" to test a user flow, it's closer to real user's behaviour, as real user don't have a clean setup each time. Additionally, as you mentioned, it saves money on CircleCI. We do acknowledge the downside that if one step fails, the whole test will fail, making it slightly more challenging to debug. However, overall, the advantages outweigh the disadvantages, making it reasonable to combine certain our e2e tests.

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [ec2d41b]
Page Load Metrics (930 ± 33 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1051731362010
domContentLoaded106628178
load80710869306933
domInteractive106628178
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link
Copy Markdown
Contributor

@danjm danjm left a comment

Choose a reason for hiding this comment

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

Nice work. I'm glad we are validating the error case as well. I have made a couple of suggestions

@hjetpoluru hjetpoluru requested a review from danjm February 7, 2024 19:38
…tId' and added them in development code"

This reverts commit 955b056.
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [6a70b6f]
Page Load Metrics (739 ± 14 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint831229194
domContentLoaded9261542
load6908127392814
domInteractive9261542
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [2079e33]
Page Load Metrics (765 ± 24 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint7912597136
domContentLoaded9241742
load6978707655024
domInteractive9241742
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 153 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

davidmurdoch
davidmurdoch previously approved these changes Feb 9, 2024
HowardBraham
HowardBraham previously approved these changes Feb 9, 2024
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [8e45c04]
Page Load Metrics (919 ± 32 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1052831833818
domContentLoaded967292311
load81110339196632
domInteractive967292311
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 153 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@hjetpoluru hjetpoluru dismissed stale reviews from HowardBraham and davidmurdoch via 3e4b7a8 February 12, 2024 02:29
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [3e4b7a8]
Page Load Metrics (1096 ± 66 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1182862024521
domContentLoaded8110483115
load8561317109613766
domInteractive8110483115
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 153 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [babc8df]
Page Load Metrics (970 ± 41 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1153091754220
domContentLoaded998383014
load82311089708641
domInteractive998383014
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 153 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@hjetpoluru hjetpoluru merged commit c22fc9a into develop Feb 14, 2024
@hjetpoluru hjetpoluru deleted the 22542-add-e2e-test-for-update-network branch February 14, 2024 14:12
@github-actions github-actions bot locked and limited conversation to collaborators Feb 14, 2024
@metamaskbot metamaskbot added the release-11.12.0 Issue or pull request that will be included in release 11.12.0 label Feb 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

e2e-test End to end test for the MetaMask extension INVALID-PR-TEMPLATE PR's body doesn't match template release-11.12.0 Issue or pull request that will be included in release 11.12.0 team-extension-platform Extension Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add e2e test for update network

7 participants