-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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: blockaid update version and reenable specs #28121
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. |
}) | ||
.forGet( | ||
'https://static.cx.metamask.io/api/v1/confirmations/ppom/ppom_version.json', | ||
) |
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.
to cause a warning, it doesn't work anymore the debug_traceCall 500, but we can use this failed request instead
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.
the updated txt
files are obtained by running the update-mock-cdn
script. The data is encoded in brotli, taken from making a real request to the prod endpoints, to get the latest data
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.
Thanks @seaona for documenting this information.
@@ -1,3 +1,4 @@ | |||
{ | |||
"Etag": "W/\"ece7f5f533b8978063633ea5b1f8a0fc\"" | |||
"Content-Type": "text/plain", |
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.
with this addition, we are now able to see the mocked response in the network tab (see attached video in the description)
@@ -161,14 +157,17 @@ async function mockInfura(mockServer) { | |||
} | |||
|
|||
describe('PPOM Blockaid Alert - Malicious ERC20 Transfer @no-mmi', function () { | |||
// eslint-disable-next-line mocha/no-skipped-tests | |||
it.skip('should show banner alert', 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.
not skipping the test anymore as it's now fixed
Builds ready [94bad92]
Page Load Metrics (2113 ± 46 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
@@ -181,10 +180,10 @@ describe('PPOM Blockaid Alert - Malicious ERC20 Transfer @no-mmi', function () { | |||
async ({ driver }) => { | |||
const expectedTitle = 'This is a deceptive request'; | |||
const expectedDescription = | |||
'If you approve this request, you might lose your assets.'; |
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.
the malicious descriptions have slightly changed so we need to modify them in the specs
assert( | ||
bannerAlertText.includes(expectedDescription), | ||
`Unexpected banner alert description. Expected: ${expectedDescription} \nExpected reason: transfer_farming\n`, | ||
); |
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.
we already find the element by its text, so no need to assert after
@@ -90,14 +86,17 @@ async function mockInfura(mockServer) { | |||
} | |||
|
|||
describe('PPOM Blockaid Alert - Set Trade farming order @no-mmi', function () { | |||
// eslint-disable-next-line mocha/no-skipped-tests | |||
it.skip('should show banner alert', 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.
not skipping the test anymore as it's now fixed
|
||
await unlockWallet(driver); | ||
await openDapp(driver); | ||
await driver.openNewPage('http://localhost:8080'); |
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.
we need to go to localhost and not 127.0.0.1 otherwise the interactions won't be flagged by ppom (see issue)
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.
LGTM
}, | ||
); | ||
}); | ||
|
||
// eslint-disable-next-line mocha/no-skipped-tests | ||
it.skip('should show "Request may not be safe" if the PPOM request fails to check transaction', 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.
not skipping the test anymore as it's now fixed
LGTM ! |
Description
This PR does the following:
update-mock-cdn
script, so it adds"Content-Type": "text/plain"
into the response headersRelated issues
Fixes:
Manual testing steps
Screenshots/Recordings
Example of malicious signature working on e2e environment
malicious-e2e-working.mp4
Encoded mock data before/after content type
encoded-data-mcked.mp4
Pre-merge author checklist
Pre-merge reviewer checklist