-
Notifications
You must be signed in to change notification settings - Fork 5
/
test.spec.js
68 lines (62 loc) · 2.15 KB
/
test.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* eslint-disable ui-testing/no-disabled-tests */
describe('DAPP Offer Up E2E Test Cases', () => {
context('Test commands', () => {
it(`should complete Keplr setup by importing an existing wallet using 24 word phrase`, () => {
cy.setupWallet({
secretWords:
'tackle hen gap lady bike explain erode midnight marriage wide upset culture model select dial trial swim wood step scan intact what card symptom',
password: 'Test1234',
newAccount: true,
walletName: 'My Wallet 2',
}).then(setupFinished => {
expect(setupFinished).to.be.true;
});
cy.visit('/');
});
it(`should reject connection with wallet`, () => {
const alertShown = cy.stub().as('alertShown');
cy.on('window:alert', alertShown);
cy.contains('Connect Wallet').click();
cy.rejectAccess().then(rejected => {
expect(rejected).to.be.true;
});
cy.get('@alertShown').should(
'have.been.calledOnceWith',
'Request rejected',
);
});
it(`should accept connection with wallet`, () => {
cy.reload();
cy.contains('Connect Wallet').click();
cy.acceptAccess().then(taskCompleted => {
expect(taskCompleted).to.be.true;
});
});
it(`should reject make an offer transaction`, () => {
const alertShown = cy.stub().as('alertShown');
cy.on('window:alert', alertShown);
cy.contains('Make an Offer').click();
cy.rejectTransaction().then(taskCompleted => {
expect(taskCompleted).to.be.true;
});
cy.get('@alertShown').should(
'have.been.calledOnceWith',
'Offer error: Error: Request rejected',
);
});
it(`should confirm make an offer transaction`, () => {
cy.reload();
cy.contains('Connect Wallet').click();
const alertShown = cy.stub().as('alertShown');
cy.on('window:alert', alertShown);
cy.contains('Make an Offer').click();
cy.confirmTransaction().then(taskCompleted => {
expect(taskCompleted).to.be.true;
});
cy.get('@alertShown').should(
'have.been.calledOnceWith',
'Offer accepted',
);
});
});
});