1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 15:50:28 +01:00
metamask-extension/test/integration/lib/tx-list-items.js

51 lines
2.0 KiB
JavaScript
Raw Normal View History

const reactTriggerChange = require('../../lib/react-trigger-change')
const {
queryAsync,
findAsync,
} = require('../../lib/util')
QUnit.module('tx list items')
QUnit.test('renders list items successfully', (assert) => {
const done = assert.async()
runTxListItemsTest(assert).then(done).catch((err) => {
assert.notOk(err, `Error was thrown: ${err.stack}`)
done()
})
})
global.ethQuery = global.ethQuery || {}
global.ethQuery.getTransactionCount = (_, cb) => {
2019-01-15 02:37:42 +01:00
cb(null, '0x4')
}
2018-07-03 00:49:33 +02:00
async function runTxListItemsTest (assert, done) {
console.log('*** start runTxListItemsTest')
const selectState = await queryAsync($, 'select')
selectState.val('tx list items')
reactTriggerChange(selectState[0])
2018-05-11 01:51:26 +02:00
const metamaskLogo = await queryAsync($, '.app-header__logo-container')
assert.ok(metamaskLogo[0], 'metamask logo present')
metamaskLogo[0].click()
2018-08-07 07:39:54 +02:00
const txListItems = await queryAsync($, '.transaction-list-item')
2019-01-15 02:37:42 +01:00
assert.equal(txListItems.length, 6, 'all tx list items are rendered')
2019-01-15 02:37:42 +01:00
const unapprovedMsg = txListItems[0]
2018-08-07 07:39:54 +02:00
const unapprovedMsgDescription = await findAsync($(unapprovedMsg), '.transaction-list-item__action')
assert.equal(unapprovedMsgDescription[0].textContent, 'Signature Request', 'unapprovedMsg has correct description')
2019-01-15 02:37:42 +01:00
const approvedTx = txListItems[2]
const approvedTxRenderedStatus = await findAsync($(approvedTx), '.transaction-list-item__status')
assert.equal(approvedTxRenderedStatus[0].textContent, 'pending', 'approvedTx has correct label')
2018-12-09 21:48:06 +01:00
const shapeShiftTx = txListItems[4]
const shapeShiftTxStatus = await findAsync($(shapeShiftTx), '.flex-column div:eq(1)')
assert.equal(shapeShiftTxStatus[0].textContent, 'No deposits received', 'shapeShiftTx has correct status')
2019-01-15 02:37:42 +01:00
const confirmedTokenTx = txListItems[5]
2018-08-07 07:39:54 +02:00
const confirmedTokenTxAddress = await findAsync($(confirmedTokenTx), '.transaction-list-item__status')
2018-08-24 04:19:48 +02:00
assert.equal(confirmedTokenTxAddress[0].textContent, 'Confirmed', 'confirmedTokenTx has correct address')
}