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

feat: migrate protect intrinsics test to e2e #26197

Merged
merged 7 commits into from
Aug 20, 2024

Conversation

itsyoboieltr
Copy link
Contributor

@itsyoboieltr itsyoboieltr commented Jul 29, 2024

Description

Open in GitHub Codespaces

After migrating the global unit tests from Mocha to Jest, the protect-intrinsics test started to fail. It seems that the jest environment is not compatible with the lockdown protect-intrinsics intends to test. Furthermore, as this test is testing the lockdown of the browser environment, it would probably make more sense to test it in a browser.

For this reason, this PR migrates the protect-intrinsics test to run as part of the e2e test suite, as the browser would be a better test environment, closer to production.

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2907

Manual testing steps

  1. Run test:e2e:global and see the tests pass

Screenshots/Recordings

Not applicable

Pre-merge author checklist

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.

@itsyoboieltr itsyoboieltr self-assigned this Jul 29, 2024
@itsyoboieltr itsyoboieltr requested a review from a team as a code owner July 29, 2024 17:43
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.

@metamaskbot metamaskbot added the team-extension-platform Extension Platform team label Jul 29, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [bab6b41]
Page Load Metrics (321 ± 301 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint613851056732
domContentLoaded998282110
load402033321626301
domInteractive998282110
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link

codecov bot commented Jul 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.96%. Comparing base (d3541a3) to head (5d7c780).
Report is 3 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #26197   +/-   ##
========================================
  Coverage    69.96%   69.96%           
========================================
  Files         1405     1405           
  Lines        48996    48996           
  Branches     13697    13697           
========================================
  Hits         34280    34280           
  Misses       14716    14716           

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

@metamaskbot
Copy link
Collaborator

Builds ready [d46a9c3]
Page Load Metrics (305 ± 280 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint641651022412
domContentLoaded85022126
load381887305583280
domInteractive85022126
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@@ -0,0 +1,17 @@
import { test, expect } from '@playwright/test';
Copy link
Contributor

Choose a reason for hiding this comment

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

hi there 👋 I have a couple of questions regarding this e2e implementation:

  • is there any reason why we are using playwright?
  • we have a lockdown e2e spec here. I'm wondering what's the difference with this one, as it looks like it's already achieving the same goal? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi!

  • No reason from my side. Is there any reason we should not be using playwright? I just used it, because I created this PR based on an example that @Gudahtt gave me: https://github.com/MetaMask/browser-passworder/blob/main/test/index.spec.ts, and I saw some other tests also using playwright.
  • That test indeed looks pretty similar, I did not know such a test already existed. Maybe @Gudahtt has a better understanding of the differences? I guess in this case we can reduce the PR to just deleting the unit test.

@metamaskbot
Copy link
Collaborator

Builds ready [b5dea0d]
Page Load Metrics (81 ± 24 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint642901126029
domContentLoaded9184334019
load42244815024
domInteractive9184334019
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@itsyoboieltr itsyoboieltr requested review from seaona, DDDDDanica, Gudahtt, danjm and a team August 2, 2024 13:58
@hjetpoluru hjetpoluru self-requested a review August 2, 2024 17:06
hjetpoluru
hjetpoluru previously approved these changes Aug 2, 2024
Copy link
Contributor

@hjetpoluru hjetpoluru left a comment

Choose a reason for hiding this comment

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

LGTM!! Interesting approach thanks @itsyoboieltr.

@hjetpoluru
Copy link
Contributor

@itsyoboieltr, you may have to put the test results in the gitignore.

Copy link

@metamaskbot
Copy link
Collaborator

Builds ready [5d7c780]
Page Load Metrics (85 ± 12 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint821731142613
domContentLoaded41139812713
load48139852412
domInteractive107631147
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link
Contributor

@hjetpoluru hjetpoluru left a comment

Choose a reason for hiding this comment

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

LGTM

@itsyoboieltr itsyoboieltr merged commit da1ebc4 into develop Aug 20, 2024
78 checks passed
@itsyoboieltr itsyoboieltr deleted the migrate-protect-intrinsics-test-to-e2e branch August 20, 2024 14:21
@github-actions github-actions bot locked and limited conversation to collaborators Aug 20, 2024
@metamaskbot metamaskbot added the release-12.5.0 Issue or pull request that will be included in release 12.5.0 label Aug 20, 2024
@gauthierpetetin gauthierpetetin added release-12.4.0 Issue or pull request that will be included in release 12.4.0 and removed release-12.5.0 Issue or pull request that will be included in release 12.5.0 labels Sep 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.4.0 Issue or pull request that will be included in release 12.4.0 team-extension-platform Extension Platform team
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants