|
1 | 1 | describe('dApps', () => {
|
2 | 2 | before(() => {
|
3 |
| - cy.login(); |
4 |
| - cy.saveLocalStorage(); |
5 |
| - }); |
| 3 | + cy.login() |
| 4 | + cy.saveLocalStorage() |
| 5 | + }) |
6 | 6 |
|
7 | 7 | beforeEach(() => {
|
8 |
| - cy.restoreLocalStorage(); |
| 8 | + cy.restoreLocalStorage() |
9 | 9 |
|
10 | 10 | // First we get WalletConnect URI and store it at `wcUrl` variable
|
11 | 11 | cy.origin('https://se-sdk-dapp.vercel.app/', () => {
|
12 | 12 | cy.visit('/', {
|
13 | 13 | onBeforeLoad(win) {
|
14 |
| - cy.stub(win.console, 'log').as('consoleLog'); |
| 14 | + cy.stub(win.console, 'log').as('consoleLog') |
15 | 15 | }
|
16 |
| - }); |
| 16 | + }) |
17 | 17 |
|
18 |
| - cy.contains('eip155:80001').click(); |
| 18 | + cy.contains('eip155:80001').click() |
19 | 19 | // Before adding the wait time here, the WalletConnect uri was expiring in 3/10 cases,
|
20 | 20 | // and we couldn't establish a connection between the dApp and Wallet.
|
21 | 21 | // The assumption is that WalletConnect QR modal kills the uri in the case we close the dApp page very quickly.
|
22 | 22 | cy.wait(1000)
|
23 | 23 |
|
24 |
| - cy.get('wcm-modal-header') |
25 |
| - .shadow() |
26 |
| - .find('[class="wcm-action-btn"]') |
27 |
| - .click(); |
| 24 | + cy.get('wcm-modal-header').shadow().find('[class="wcm-action-btn"]').click() |
28 | 25 |
|
29 |
| - cy.wait(1000); |
| 26 | + cy.wait(1000) |
30 | 27 |
|
31 | 28 | cy.get('@consoleLog')
|
32 | 29 | .invoke('getCalls')
|
33 | 30 | .then((calls) => {
|
34 |
| - cy.task('setWcUrl', calls[1].lastArg); |
35 |
| - }); |
36 |
| - }); |
37 |
| - }); |
| 31 | + cy.task('setWcUrl', calls[1].lastArg) |
| 32 | + }) |
| 33 | + }) |
| 34 | + }) |
38 | 35 |
|
39 | 36 | it('Connects to a dApp', () => {
|
40 | 37 | cy.task('getWcUrl').then((wcUrl) => {
|
41 |
| - cy.visit('/wallet/dashboard'); |
| 38 | + cy.visit('/wallet/dashboard') |
42 | 39 |
|
43 |
| - cy.url().should('include', '/wallet/dashboard'); // Wait for URL to include '/wallet/dashboard' |
| 40 | + cy.url().should('include', '/wallet/dashboard') // Wait for URL to include '/wallet/dashboard' |
44 | 41 |
|
45 |
| - cy.window().then(win => { |
46 |
| - cy.stub(win, 'prompt').returns(wcUrl); |
47 |
| - }); |
| 42 | + cy.window().then((win) => { |
| 43 | + cy.stub(win, 'prompt').returns(wcUrl) |
| 44 | + }) |
48 | 45 |
|
49 |
| - cy.get('[data-testid="dapp-dropdown"]').click(); |
50 |
| - cy.wait(1000); |
| 46 | + cy.get('[data-testid="dapp-dropdown"]').click() |
| 47 | + cy.wait(1000) |
51 | 48 |
|
52 |
| - cy.get('[data-testid="connect-btn"]').click(); |
53 |
| - cy.wait(1000); |
| 49 | + cy.get('[data-testid="connect-btn"]').click() |
| 50 | + cy.wait(1000) |
54 | 51 |
|
55 |
| - cy.contains('React App with ethers').should('be.visible'); |
56 |
| - }); |
57 |
| - }); |
58 |
| -}); |
| 52 | + cy.contains('React App with ethers').should('be.visible') |
| 53 | + }) |
| 54 | + }) |
| 55 | +}) |
0 commit comments