Skip to content

Commit 4b392e2

Browse files
authored
Merge pull request #1595 from AmbireTech/cypress-fix
Changed test network from Mumbai to Sepolia
2 parents 41902e3 + 1891f1b commit 4b392e2

File tree

4 files changed

+40
-45
lines changed

4 files changed

+40
-45
lines changed

cypress/e2e/dapps.cy.ts

+26-29
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,55 @@
11
describe('dApps', () => {
22
before(() => {
3-
cy.login();
4-
cy.saveLocalStorage();
5-
});
3+
cy.login()
4+
cy.saveLocalStorage()
5+
})
66

77
beforeEach(() => {
8-
cy.restoreLocalStorage();
8+
cy.restoreLocalStorage()
99

1010
// First we get WalletConnect URI and store it at `wcUrl` variable
1111
cy.origin('https://se-sdk-dapp.vercel.app/', () => {
1212
cy.visit('/', {
1313
onBeforeLoad(win) {
14-
cy.stub(win.console, 'log').as('consoleLog');
14+
cy.stub(win.console, 'log').as('consoleLog')
1515
}
16-
});
16+
})
1717

18-
cy.contains('eip155:80001').click();
18+
cy.contains('eip155:80001').click()
1919
// Before adding the wait time here, the WalletConnect uri was expiring in 3/10 cases,
2020
// and we couldn't establish a connection between the dApp and Wallet.
2121
// The assumption is that WalletConnect QR modal kills the uri in the case we close the dApp page very quickly.
2222
cy.wait(1000)
2323

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()
2825

29-
cy.wait(1000);
26+
cy.wait(1000)
3027

3128
cy.get('@consoleLog')
3229
.invoke('getCalls')
3330
.then((calls) => {
34-
cy.task('setWcUrl', calls[1].lastArg);
35-
});
36-
});
37-
});
31+
cy.task('setWcUrl', calls[1].lastArg)
32+
})
33+
})
34+
})
3835

3936
it('Connects to a dApp', () => {
4037
cy.task('getWcUrl').then((wcUrl) => {
41-
cy.visit('/wallet/dashboard');
38+
cy.visit('/wallet/dashboard')
4239

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'
4441

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+
})
4845

49-
cy.get('[data-testid="dapp-dropdown"]').click();
50-
cy.wait(1000);
46+
cy.get('[data-testid="dapp-dropdown"]').click()
47+
cy.wait(1000)
5148

52-
cy.get('[data-testid="connect-btn"]').click();
53-
cy.wait(1000);
49+
cy.get('[data-testid="connect-btn"]').click()
50+
cy.wait(1000)
5451

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+
})

cypress/e2e/transfer.cy.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ import { Wallet } from 'ethers'
22

33
describe('Transfering funds', () => {
44
before(() => {
5-
cy.login();
6-
cy.saveLocalStorage();
5+
cy.login()
6+
cy.saveLocalStorage()
77
})
88

99
beforeEach(() => {
10-
cy.restoreLocalStorage();
10+
cy.restoreLocalStorage()
1111
})
1212

1313
it('Sends funds via Quick account', () => {
1414
cy.visit('/wallet/dashboards')
15-
cy.contains('Transfer').click();
15+
cy.contains('Transfer').click()
1616

1717
// Wait for the initial wallet load.
1818
// There are a lot of fetch requests under the hood.
@@ -41,7 +41,7 @@ describe('Transfering funds', () => {
4141
// Later we can make a polling mechanism for checking the code, instead of waiting 30 seconds.
4242
cy.wait(30000)
4343

44-
cy.task('get-confirm-code').then(code => {
44+
cy.task('get-confirm-code').then((code) => {
4545
cy.get('[data-testid="confirmationCode"]').type(code)
4646
cy.get('[data-testid="confirmSigning"]').click()
4747

@@ -50,4 +50,4 @@ describe('Transfering funds', () => {
5050
cy.get('[data-testid="txnSignedMsg"]').should('be.visible')
5151
})
5252
})
53-
})
53+
})

cypress/support/commands.ts

+7-9
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,12 @@
3636
// }
3737
// }
3838

39-
import "cypress-localstorage-commands";
39+
import 'cypress-localstorage-commands'
4040

4141
Cypress.Commands.add('login', () => {
42-
cy.setLocalStorage('selectedAcc', Cypress.env('SELECTED_ACCOUNT'));
43-
cy.setLocalStorage('accounts', JSON.stringify(Cypress.env('ACCOUNTS')));
44-
cy.setLocalStorage('networkId', 'mumbai');
45-
cy.setLocalStorage('permissionsModalHidden', 'true');
46-
cy.setLocalStorage('isDappMode', 'true');
47-
48-
49-
});
42+
cy.setLocalStorage('selectedAcc', Cypress.env('SELECTED_ACCOUNT'))
43+
cy.setLocalStorage('accounts', JSON.stringify(Cypress.env('ACCOUNTS')))
44+
cy.setLocalStorage('networkId', 'sepolia')
45+
cy.setLocalStorage('permissionsModalHidden', 'true')
46+
cy.setLocalStorage('isDappMode', 'true')
47+
})

src/components/Wallet/Transfer/Transfer.test.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ test('can send token', async () => {
109109
const confirm = screen.getByTestId('unknownAddressWarning')
110110
await user.click(confirm)
111111

112-
const confirmBinance = screen.getByText(/I confirm this address is not a/i)
112+
const confirmBinance = screen.getByText(/I confirm this address is not /i)
113113
await user.click(confirmBinance)
114114

115115
const sendButton = screen.getByTestId('send')

0 commit comments

Comments
 (0)