feat: migrate protect intrinsics test to e2e#26197
Conversation
|
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. |
Builds ready [bab6b41]
Page Load Metrics (321 ± 301 ms)
Bundle size diffs
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
Builds ready [d46a9c3]
Page Load Metrics (305 ± 280 ms)
Bundle size diffs
|
| @@ -0,0 +1,17 @@ | |||
| import { test, expect } from '@playwright/test'; | |||
There was a problem hiding this comment.
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? 🤔
There was a problem hiding this comment.
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.
Builds ready [b5dea0d]
Page Load Metrics (81 ± 24 ms)
Bundle size diffs
|
hjetpoluru
left a comment
There was a problem hiding this comment.
LGTM!! Interesting approach thanks @itsyoboieltr.
|
@itsyoboieltr, you may have to put the test results in the gitignore. |
|
Builds ready [5d7c780]
Page Load Metrics (85 ± 12 ms)
Bundle size diffs
|



Description
After migrating the global unit tests from Mocha to Jest, the
protect-intrinsicstest started to fail. It seems that the jest environment is not compatible with the lockdownprotect-intrinsicsintends 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
test:e2e:globaland see the tests passScreenshots/Recordings
Not applicable
Pre-merge author checklist
Pre-merge reviewer checklist