2018-02-06 19:20:37 +01:00
|
|
|
const reactTriggerChange = require('react-trigger-change')
|
2018-03-12 03:29:35 +01:00
|
|
|
const {
|
2018-07-11 02:09:22 +02:00
|
|
|
timeout,
|
2018-03-12 03:29:35 +01:00
|
|
|
queryAsync,
|
|
|
|
} = require('../../lib/util')
|
2018-02-06 19:20:37 +01:00
|
|
|
|
|
|
|
QUnit.module('confirm sig requests')
|
|
|
|
|
|
|
|
QUnit.test('successful confirmation of sig requests', (assert) => {
|
|
|
|
const done = assert.async()
|
|
|
|
runConfirmSigRequestsTest(assert).then(done).catch((err) => {
|
|
|
|
assert.notOk(err, `Error was thrown: ${err.stack}`)
|
|
|
|
done()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2018-07-03 00:49:33 +02:00
|
|
|
async function runConfirmSigRequestsTest (assert, done) {
|
|
|
|
const selectState = await queryAsync($, 'select')
|
2018-02-06 19:20:37 +01:00
|
|
|
selectState.val('confirm sig requests')
|
|
|
|
reactTriggerChange(selectState[0])
|
|
|
|
|
2018-04-06 11:04:39 +02:00
|
|
|
const pendingRequestItem = $.find('.tx-list-item.tx-list-pending-item-container.tx-list-clickable')
|
|
|
|
|
|
|
|
if (pendingRequestItem[0]) {
|
|
|
|
pendingRequestItem[0].click()
|
|
|
|
}
|
2018-04-05 03:46:22 +02:00
|
|
|
|
2018-07-11 02:09:22 +02:00
|
|
|
await timeout(1000)
|
|
|
|
|
2018-03-12 03:29:35 +01:00
|
|
|
let confirmSigHeadline = await queryAsync($, '.request-signature__headline')
|
2018-02-06 19:20:37 +01:00
|
|
|
assert.equal(confirmSigHeadline[0].textContent, 'Your signature is being requested')
|
|
|
|
|
2018-07-03 00:49:33 +02:00
|
|
|
const confirmSigMessage = await queryAsync($, '.request-signature__notice')
|
2018-04-06 11:04:39 +02:00
|
|
|
assert.ok(confirmSigMessage[0].textContent.match(/^Signing\sthis\smessage/))
|
|
|
|
|
2018-03-12 03:29:35 +01:00
|
|
|
let confirmSigRowValue = await queryAsync($, '.request-signature__row-value')
|
2018-04-06 11:04:39 +02:00
|
|
|
assert.equal(confirmSigRowValue[0].textContent, '0x879a053d4800c6354e76c7985a865d2922c82fb5b3f4577b2fe08b998954f2e0')
|
2018-02-06 19:20:37 +01:00
|
|
|
|
2018-05-31 01:17:40 +02:00
|
|
|
let confirmSigSignButton = await queryAsync($, 'button.btn-primary.btn--large')
|
2018-02-06 19:20:37 +01:00
|
|
|
confirmSigSignButton[0].click()
|
2018-07-11 02:09:22 +02:00
|
|
|
await timeout(1000)
|
2018-03-12 03:29:35 +01:00
|
|
|
confirmSigHeadline = await queryAsync($, '.request-signature__headline')
|
2018-02-06 19:20:37 +01:00
|
|
|
assert.equal(confirmSigHeadline[0].textContent, 'Your signature is being requested')
|
|
|
|
|
2018-04-06 11:04:39 +02:00
|
|
|
confirmSigRowValue = await queryAsync($, '.request-signature__row-value')
|
2018-07-03 01:52:49 +02:00
|
|
|
assert.ok(confirmSigRowValue[0].textContent.match(/^#\sTerms\sof\sUse/))
|
2018-02-06 19:20:37 +01:00
|
|
|
|
2018-05-31 01:17:40 +02:00
|
|
|
confirmSigSignButton = await queryAsync($, 'button.btn-primary.btn--large')
|
2018-02-06 19:20:37 +01:00
|
|
|
confirmSigSignButton[0].click()
|
2018-07-11 02:09:22 +02:00
|
|
|
await timeout(1000)
|
2018-03-12 03:29:35 +01:00
|
|
|
confirmSigHeadline = await queryAsync($, '.request-signature__headline')
|
2018-02-06 19:20:37 +01:00
|
|
|
assert.equal(confirmSigHeadline[0].textContent, 'Your signature is being requested')
|
|
|
|
|
2018-03-12 03:29:35 +01:00
|
|
|
confirmSigRowValue = await queryAsync($, '.request-signature__row-value')
|
2018-02-06 19:20:37 +01:00
|
|
|
assert.equal(confirmSigRowValue[0].textContent, 'Hi, Alice!')
|
|
|
|
assert.equal(confirmSigRowValue[1].textContent, '1337')
|
|
|
|
|
2018-05-31 01:17:40 +02:00
|
|
|
confirmSigSignButton = await queryAsync($, 'button.btn-primary.btn--large')
|
2018-02-06 19:20:37 +01:00
|
|
|
confirmSigSignButton[0].click()
|
2018-07-11 18:07:26 +02:00
|
|
|
|
|
|
|
await timeout(2000)
|
2018-02-06 19:20:37 +01:00
|
|
|
}
|