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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
const reactTriggerChange = require('react-trigger-change')
const {
timeout,
queryAsync,
} = require('../../lib/util')
QUnit.module('navigate txs')
QUnit.test('successful navigate', (assert) => {
const done = assert.async()
runNavigateTxsFlowTest(assert)
.then(done)
.catch(err => {
assert.notOk(err, `Error was thrown: ${err.stack}`)
done()
})
})
async function runNavigateTxsFlowTest (assert, done) {
const selectState = await queryAsync($, 'select')
selectState.val('navigate txs')
reactTriggerChange(selectState[0])
// Confirm navigation buttons present
let navigateTxButtons = await queryAsync($, '.confirm-page-container-navigation__arrow')
assert.ok(navigateTxButtons[0], 'navigation button present')
assert.ok(navigateTxButtons[1], 'navigation button present')
assert.ok(navigateTxButtons[2], 'navigation button present')
assert.ok(navigateTxButtons[3], 'navigation button present')
// Verify number of transactions present
let trxNum = await queryAsync($, '.confirm-page-container-navigation')
assert.equal(trxNum[0].innerText.includes('1'), true, 'starts on first')
// Verify correct route
let summaryAction = await queryAsync($, '.confirm-page-container-summary__action')
assert.equal(summaryAction[0].innerText, 'CONTRACT DEPLOYMENT', 'correct route')
// Click navigation button
navigateTxButtons[2].click()
await timeout(2000)
// Verify transaction changed to num 2 and routed correctly
trxNum = await queryAsync($, '.confirm-page-container-navigation')
assert.equal(trxNum[0].innerText.includes('2'), true, 'changed transaction right')
summaryAction = await queryAsync($, '.confirm-page-container-summary__action')
// assert.equal(summaryAction[0].innerText, 'CONFIRM', 'correct route')
// Click navigation button
navigateTxButtons = await queryAsync($, '.confirm-page-container-navigation__arrow')
navigateTxButtons[2].click()
// Verify transation changed to num 3 and routed correctly
trxNum = await queryAsync($, '.confirm-page-container-navigation')
assert.equal(trxNum[0].innerText.includes('3'), true, 'changed transaction right')
summaryAction = await queryAsync($, '.confirm-page-container-summary__action')
assert.equal(summaryAction[0].innerText, 'CONFIRM', 'correct route')
// Click navigation button
navigateTxButtons = await queryAsync($, '.confirm-page-container-navigation__arrow')
navigateTxButtons[2].click()
// Verify transation changed to num 4 and routed correctly
trxNum = await queryAsync($, '.confirm-page-container-navigation')
assert.equal(trxNum[0].innerText.split('4').length, 3, '4 transactions present')
summaryAction = await queryAsync($, '.confirm-page-container-summary__action')
assert.equal(summaryAction[0].innerText, 'TRANSFER', 'correct route')
// Verify left arrow is working correctly
navigateTxButtons = await queryAsync($, '.confirm-page-container-navigation__arrow')
navigateTxButtons[1].click()
trxNum = await queryAsync($, '.confirm-page-container-navigation')
assert.equal(trxNum[0].innerText.includes('3'), true, 'changed transaction left')
// Verify navigate to last transaction is working correctly
navigateTxButtons = await queryAsync($, '.confirm-page-container-navigation__arrow')
navigateTxButtons[3].click()
trxNum = await queryAsync($, '.confirm-page-container-navigation')
assert.equal(trxNum[0].innerText.split('4').length, 3, 'navigate to last transaction')
// Verify navigate to first transaction is working correctly
navigateTxButtons = await queryAsync($, '.confirm-page-container-navigation__arrow')
navigateTxButtons[0].click()
trxNum = await queryAsync($, '.confirm-page-container-navigation')
assert.equal(trxNum[0].innerText.includes('1'), true, 'navigate to first transaction')
}
|