MetaMask / metamask-extension

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
https://metamask.io
Other
12.05k stars 4.92k forks source link

Create e2e test for the transaction security provider #17810

Closed bschorchit closed 1 year ago

seaona commented 1 year ago

We should verify that we cover the different cases of Opensea responses:

For that, we should mock the API response for this request:

https://eos9d7dmfj.execute-api.us-east-1.amazonaws.com/metamask/validate

with the different response bodies for each case. I.e.

{
"flagAsDangerous":1,
"reason":"Approval is to an unverified smart contract known for stealing NFTs in the past.",
"reason_header":"This could be a scam"
}

There is a good example of mocking a response API on the phishing-detection.spec.js.

One last recommendation, we should enable the feature transactionSecurityCheckEnabled using fixtures, instead of going to Settings and Enabling the toggle. This way we can skip steps on our tests. This can be done using fixture-builder.js. See examples on other tests, like address-book.js where we add an address using the fixture builder.

cc @bschorchit