2018-02-06 19:20:37 +01:00
|
|
|
const reactTriggerChange = require('react-trigger-change')
|
2018-03-12 03:29:35 +01:00
|
|
|
const {
|
|
|
|
timeout,
|
|
|
|
queryAsync,
|
|
|
|
findAsync,
|
|
|
|
} = require('../../lib/util')
|
2018-02-06 19:20:37 +01:00
|
|
|
const PASSWORD = 'password123'
|
|
|
|
|
|
|
|
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()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
async function runConfirmSigRequestsTest(assert, done) {
|
2018-03-12 03:29:35 +01:00
|
|
|
let selectState = await queryAsync($, 'select')
|
2018-02-06 19:20:37 +01:00
|
|
|
selectState.val('confirm sig requests')
|
|
|
|
reactTriggerChange(selectState[0])
|
|
|
|
|
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-03-12 03:29:35 +01:00
|
|
|
let confirmSigRowValue = await queryAsync($, '.request-signature__row-value')
|
2018-02-06 19:20:37 +01:00
|
|
|
assert.ok(confirmSigRowValue[0].textContent.match(/^\#\sTerms\sof\sUse/))
|
|
|
|
|
2018-03-26 07:19:42 +02:00
|
|
|
let confirmSigSignButton = await queryAsync($, 'button.btn-primary--lg')
|
2018-02-06 19:20:37 +01:00
|
|
|
confirmSigSignButton[0].click()
|
|
|
|
|
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
|
|
|
let confirmSigMessage = await queryAsync($, '.request-signature__notice')
|
2018-02-06 19:20:37 +01:00
|
|
|
assert.ok(confirmSigMessage[0].textContent.match(/^Signing\sthis\smessage/))
|
|
|
|
|
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, '0x879a053d4800c6354e76c7985a865d2922c82fb5b3f4577b2fe08b998954f2e0')
|
|
|
|
|
2018-03-26 07:19:42 +02:00
|
|
|
confirmSigSignButton = await queryAsync($, 'button.btn-primary--lg')
|
2018-02-06 19:20:37 +01:00
|
|
|
confirmSigSignButton[0].click()
|
|
|
|
|
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-03-26 07:19:42 +02:00
|
|
|
confirmSigSignButton = await queryAsync($, 'button.btn-primary--lg')
|
2018-02-06 19:20:37 +01:00
|
|
|
confirmSigSignButton[0].click()
|
|
|
|
|
2018-03-12 03:29:35 +01:00
|
|
|
const txView = await queryAsync($, '.tx-view')
|
2018-02-06 19:20:37 +01:00
|
|
|
assert.ok(txView[0], 'Should return to the account details screen after confirming')
|
|
|
|
}
|