test: add spec signs message with verifyingContract field missing#31630
test: add spec signs message with verifyingContract field missing#31630DDDDDanica merged 9 commits intomainfrom
signs message with verifyingContract field missing#31630Conversation
|
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. |
| await openDapp( | ||
| driver, | ||
| null, | ||
| `${DAPP_URL}/request?method=eth_signTypedData_v4¶ms=["${DEFAULT_FIXTURE_ACCOUNT}",{"types":{"EIP712Domain":[{"name":"name","type":"string"},{"name":"chainId","type":"uint256"},{"name":"version","type":"string"}],"Person":[{"name":"name","type":"string"},{"name":"wallets","type":"address[]"}],"Mail":[{"name":"from","type":"Person"},{"name":"to","type":"Person[]"},{"name":"contents","type":"string"},{"name":"attachment","type":"bytes"}]},"primaryType":"Mail","domain":{"chainId":"0x539","name":"Ether Mail","version":"1"},"message":{"contents":"Hello, Bob!","from":{"name":"Cow","wallets":["0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826","0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF"]},"to":[{"name":"Bob","wallets":["0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB","0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57","0xB0B0b0b0b0b0B000000000000000000000000000"]}],"attachment":"0x"}}]`, |
There was a problem hiding this comment.
ℹ️ using the same test dapp message for v4 without the verifying contract field. This way, we can use the assertInfoValues method almost identically , with the caveat that now there's not verifying contract field
Builds ready [5d0748d]
UI Startup Metrics (1208 ± 56 ms)
Bundle size diffs
|
Builds ready [13feaca]
UI Startup Metrics (1208 ± 66 ms)
Bundle size diffs
|
| @@ -0,0 +1,26 @@ | |||
| import { Driver } from '../../webdriver/driver'; | |||
|
|
|||
| class TestDappIndividualRequest { | |||
There was a problem hiding this comment.
Why does this need to be a class? 🤔
There was a problem hiding this comment.
not "needed" per se, but I'm applying page objects, as we do in the rest of the dapps/screens.
I agree in this case could be too much? but still if this page grows (have more divs/btns), we'll already have it implemented, if that makes sense
https://github.com/MetaMask/metamask-extension/tree/main/test/e2e/page-objects/pages
Builds ready [718653a]
UI Startup Metrics (1259 ± 63 ms)
|
Builds ready [48056cd]
UI Startup Metrics (1219 ± 65 ms)
|
| const DAPP_HOST_ADDRESS = '127.0.0.1:8080'; | ||
| const DAPP_URL = `http://${DAPP_HOST_ADDRESS}`; |
There was a problem hiding this comment.
Aren't those available in the e2e constants file?
There was a problem hiding this comment.
aww yeahh nice catch! I copied the existing code from the test-dapp >.< I've updated both files now
|
|
||
| const DAPP_HOST_ADDRESS = '127.0.0.1:8080'; | ||
| const DAPP_URL = `http://${DAPP_HOST_ADDRESS}`; | ||
|
|
There was a problem hiding this comment.
changed because of review comment
Builds ready [a699053]
UI Startup Metrics (1254 ± 59 ms)
|
| } | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| async request(method: string, params: any[]) { |
There was a problem hiding this comment.
this belongs to the test dapp individual request class, not the test dapp "home" default page, so I've moved it there
|
LGTM ! |
|
Thanks for adding this test! I had started work on this myself, but got distracted by other work. This is a better solution than what I had drafted anyway. |
Description
The typed signatures were broken when we don't pass a verifyingContract value in the message. This was fixed, and now we add a spec to cover this user flow.
PR with the fix: #31613
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
verifyi9ng-contract-broken.mp4
After
verifyi9ng-contract-working.mp4
Pre-merge author checklist
Pre-merge reviewer checklist