-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: corrected workflow build, improved test flow by serializing to s…
…imulate a real user
- Loading branch information
1 parent
0ae3421
commit bc718b2
Showing
4 changed files
with
90 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,126 +1,84 @@ | ||
import { DEFAULT_SESSION_PARAMS } from './shared/constants' | ||
import { testMW, expect } from './shared/fixtures/w3m-wallet-fixture' | ||
|
||
testMW.describe('W3M using wallet web-example', () => { | ||
testMW.beforeEach( | ||
async ({ modalPage, walletPage, modalValidator, walletValidator, browserName }) => { | ||
testMW.skip( | ||
browserName === 'webkit' && process.platform === 'linux', | ||
'Webkit on Linux does not support clipboard' | ||
) | ||
|
||
await modalPage.getUri() | ||
await walletPage.connect() | ||
|
||
await walletPage.handleSessionProposal(DEFAULT_SESSION_PARAMS) | ||
await modalValidator.expectConnected() | ||
await walletValidator.expectConnected() | ||
} | ||
) | ||
|
||
testMW( | ||
'Should be able to connect, then disconnect', | ||
async ({ modalPage, walletPage, modalValidator, walletValidator }) => { | ||
expect(modalPage).toBeDefined() | ||
expect(walletPage).toBeDefined() | ||
await modalPage.disconnect() | ||
await modalValidator.expectDisconnected() | ||
await walletValidator.expectDisconnected() | ||
} | ||
) | ||
|
||
testMW( | ||
'Should send disconnect to wallet', | ||
async ({ modalPage, modalValidator, walletValidator }) => { | ||
await modalPage.disconnect() | ||
await modalValidator.expectDisconnected() | ||
await walletValidator.expectDisconnected() | ||
} | ||
) | ||
testMW( | ||
'Should recieve disconnect from a wallet', | ||
async ({ walletPage, modalValidator, walletValidator }) => { | ||
await walletPage.disconnect() | ||
await walletValidator.expectDisconnected() | ||
await modalValidator.expectDisconnected() | ||
} | ||
) | ||
|
||
testMW( | ||
'Should sign a message', | ||
async ({ modalPage, walletPage, modalValidator, walletValidator }) => { | ||
await modalPage.sign() | ||
|
||
await walletValidator.expectRecievedSign({}) | ||
await walletPage.handleRequest({ accept: true }) | ||
|
||
await modalValidator.expectAcceptedSign() | ||
} | ||
) | ||
|
||
testMW( | ||
'Should handle rejected sign', | ||
async ({ modalPage, walletPage, modalValidator, walletValidator }) => { | ||
await modalPage.sign() | ||
|
||
await walletValidator.expectRecievedSign({}) | ||
await walletPage.handleRequest({ accept: false }) | ||
|
||
await modalValidator.expectRejectedSign() | ||
} | ||
) | ||
|
||
testMW( | ||
'should sign typed data', | ||
async ({ modalPage, walletPage, modalValidator, walletValidator }) => { | ||
await modalPage.signTyped() | ||
|
||
await walletValidator.expectRecievedSignTyped({}) | ||
await walletPage.handleRequest({ accept: true }) | ||
|
||
await modalValidator.expectAcceptedSignTyped() | ||
} | ||
) | ||
|
||
testMW( | ||
'should handle rejected sign typed data', | ||
async ({ modalPage, walletPage, modalValidator, walletValidator }) => { | ||
await modalPage.signTyped() | ||
|
||
await walletValidator.expectRecievedSignTyped({}) | ||
await walletPage.handleRequest({ accept: false }) | ||
|
||
await modalValidator.expectRejectedSignTyped() | ||
} | ||
) | ||
|
||
testMW( | ||
'should handle chain switch using sign', | ||
async ({ modalPage, walletPage, modalValidator, walletValidator }) => { | ||
await modalPage.switchChain({ chainName: 'Polygon' }) | ||
await modalPage.closeModal() | ||
|
||
await modalPage.sign() | ||
|
||
await walletValidator.expectRecievedSign({ chainName: 'Polygon' }) | ||
await walletPage.handleRequest({ accept: true }) | ||
|
||
await modalValidator.expectAcceptedSign() | ||
} | ||
) | ||
|
||
testMW( | ||
'should handle chain switch using sign typed', | ||
async ({ modalPage, walletPage, modalValidator, walletValidator }) => { | ||
await modalPage.switchChain({ chainName: 'Polygon' }) | ||
await modalPage.closeModal() | ||
|
||
await modalPage.signTyped() | ||
|
||
await walletValidator.expectRecievedSignTyped({ chainName: 'Polygon' }) | ||
await walletPage.handleRequest({ accept: true }) | ||
|
||
await modalValidator.expectAcceptedSignTyped() | ||
} | ||
) | ||
import { testMW } from './shared/fixtures/w3m-wallet-fixture' | ||
|
||
// Initialize the connection | ||
testMW.beforeEach(async ({ modalPage, walletPage, modalValidator, walletValidator }) => { | ||
await modalPage.getUri() | ||
await walletPage.connect() | ||
await walletPage.handleSessionProposal(DEFAULT_SESSION_PARAMS) | ||
await modalValidator.expectConnected() | ||
await walletValidator.expectConnected() | ||
}) | ||
|
||
testMW( | ||
'Should handle all sign requests', | ||
async ({ modalPage, walletPage, modalValidator, walletValidator }) => { | ||
// Should accept sign | ||
await modalPage.sign() | ||
await walletValidator.expectRecievedSign({}) | ||
await walletPage.handleRequest({ accept: true }) | ||
await modalValidator.expectAcceptedSign() | ||
await modalPage.closePopup() | ||
|
||
// Should reject sign | ||
await modalPage.sign() | ||
await walletValidator.expectRecievedSign({}) | ||
await walletPage.handleRequest({ accept: false }) | ||
await modalValidator.expectRejectedSign() | ||
await modalPage.closePopup() | ||
|
||
// Should accept sign typed | ||
await modalPage.signTyped() | ||
await walletValidator.expectRecievedSignTyped({}) | ||
await walletPage.handleRequest({ accept: true }) | ||
await modalValidator.expectAcceptedSignTyped() | ||
await modalPage.closePopup() | ||
|
||
// Should reject sign typed | ||
await modalPage.signTyped() | ||
await walletValidator.expectRecievedSignTyped({}) | ||
await walletPage.handleRequest({ accept: false }) | ||
await modalValidator.expectRejectedSignTyped() | ||
await modalPage.closePopup() | ||
|
||
// Should accept sign with chain switch | ||
await modalPage.switchChain({ chainName: 'Polygon' }) | ||
await modalPage.closeModal() | ||
await modalPage.sign() | ||
await walletValidator.expectRecievedSign({ chainName: 'Polygon' }) | ||
await walletPage.handleRequest({ accept: true }) | ||
await modalValidator.expectAcceptedSign() | ||
await modalPage.closePopup() | ||
|
||
// Should reject sign with chain switch | ||
await modalPage.switchChain({ chainName: 'Ethereum' }) | ||
await modalPage.closeModal() | ||
await modalPage.signTyped() | ||
await walletValidator.expectRecievedSignTyped({ chainName: 'Ethereum' }) | ||
await walletPage.handleRequest({ accept: true }) | ||
await modalValidator.expectAcceptedSignTyped() | ||
await modalPage.closePopup() | ||
} | ||
) | ||
|
||
testMW( | ||
'Should connect, send disconnect event to wallet, recieve disconnect event', | ||
async ({ modalPage, modalValidator, walletValidator }) => { | ||
await modalValidator.expectConnected() | ||
await walletValidator.expectConnected() | ||
await modalPage.disconnect() | ||
await modalValidator.expectDisconnected() | ||
await walletValidator.expectDisconnected() | ||
} | ||
) | ||
|
||
testMW( | ||
'Should connect, recieve disconnect event from wallet', | ||
async ({ walletPage, modalValidator, walletValidator }) => { | ||
await modalValidator.expectConnected() | ||
await walletValidator.expectConnected() | ||
await walletPage.disconnect() | ||
await walletValidator.expectDisconnected() | ||
await modalValidator.expectDisconnected() | ||
} | ||
) |