-
Notifications
You must be signed in to change notification settings - Fork 5k
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
test: add coverage for Security Alerts API fallback (PPOM local) #28565
base: main
Are you sure you want to change the base?
test: add coverage for Security Alerts API fallback (PPOM local) #28565
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 [d70034a]
Page Load Metrics (1754 ± 48 ms)
Bundle size diffs
|
@@ -48,7 +50,7 @@ async function mockInfuraWithMaliciousResponses(mockServer) { | |||
|
|||
describe('PPOM Blockaid Alert - Multiple Networks Support @no-mmi', function () { | |||
// eslint-disable-next-line mocha/no-skipped-tests | |||
it.skip('should show banner alert after switchinig to another supported network', async function () { | |||
it.skip('should show banner alert after switching to another supported network', async function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe reenable this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done here.
Builds ready [06c5c9c]
Page Load Metrics (1854 ± 93 ms)
Bundle size diffs
|
Builds ready [5d6baf0]
Page Load Metrics (2506 ± 133 ms)
Bundle size diffs
|
ff4de5b
to
5c57a03
Compare
Builds ready [5c57a03]
Page Load Metrics (1537 ± 50 ms)
Bundle size diffs
|
Builds ready [2698c02]
Page Load Metrics (1815 ± 91 ms)
Bundle size diffs
|
Builds ready [5f18b49]
Page Load Metrics (2176 ± 105 ms)
Bundle size diffs
|
|
||
async ({ driver }) => { | ||
await unlockWallet(driver); | ||
await openDapp(driver); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're adding new E2E tests, should we be using page object models or creating new ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I've changed the new tests to use the page object model approach.
await mockRequest(mockServer, maliciousTradeAlert); | ||
} | ||
|
||
describe('Security Alerts API - Set Trade farming order @no-mmi', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As many of these files have a single test in, would it be simpler to keep them in a single file to reduce the boilerplate overhead?
The duplication and final line count should be minimal if we rely on page object models to abstract the interactions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've aggregated the new tests to reduce the number of files and boilerplate.
Builds ready [4db2f73]
Page Load Metrics (1622 ± 58 ms)
Bundle size diffs
|
45eb8c3
to
4aaaa8b
Compare
Builds ready [368489a]
Page Load Metrics (1841 ± 83 ms)
|
], | ||
}) | ||
.thenJson(201, response); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be possible to create a common function to avoid code repetition with method mockRequest
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, added here.
|
||
async function mockRequest(server, response) { | ||
await server | ||
.forPost(`${SECURITY_ALERTS_PROD_API_BASE_URL}/validate/0x1`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we already have these tests implemented for security alerts api also.
Builds ready [49b8d41]
Page Load Metrics (1713 ± 134 ms)
Bundle size diffs
|
Builds ready [e9b1657]
Page Load Metrics (1832 ± 130 ms)
Bundle size diffs
|
Builds ready [53ce817]
Page Load Metrics (1817 ± 70 ms)
Bundle size diffs
|
Description
This PR enhances test coverage for the Security Alerts API by reusing the existing PPOM end-to-end (E2E) tests to validate the fallback mechanism. It also introduces a new equivalent E2E test in a dedicated folder to cover the API.
Key Changes
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/3656
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist