Fix integration tests

feature/default_network_editable
Alexander Tseung 6 years ago
parent c9ec5ed38d
commit 9adf0c4b60
  1. 3
      app/_locales/en/messages.json
  2. 4
      development/states/tx-list-items.json
  3. 4
      test/integration/lib/add-token.js
  4. 2
      test/integration/lib/confirm-sig-requests.js
  5. 6
      test/integration/lib/currency-localization.js
  6. 2
      test/integration/lib/send-new-ui.js
  7. 25
      test/integration/lib/tx-list-items.js
  8. 3
      ui/app/components/shift-list-item.js
  9. 5
      ui/app/components/transaction-list-item/transaction-list-item.component.js
  10. 4
      ui/app/components/transaction-list/transaction-list.container.js
  11. 2
      ui/app/components/transaction-status/index.scss
  12. 1
      ui/app/constants/transactions.js
  13. 7
      ui/app/helpers/transactions.util.js
  14. 7
      ui/app/selectors/transactions.js

@ -982,6 +982,9 @@
"sign": { "sign": {
"message": "Sign" "message": "Sign"
}, },
"signatureRequest": {
"message": "Signature Request"
},
"signed": { "signed": {
"message": "Signed" "message": "Signed"
}, },

File diff suppressed because one or more lines are too long

@ -86,7 +86,7 @@ async function runAddTokenFlowTest (assert, done) {
$('button.btn-primary.btn--large')[0].click() $('button.btn-primary.btn--large')[0].click()
// Verify added token image // Verify added token image
let heroBalance = await queryAsync($, '.hero-balance') let heroBalance = await queryAsync($, '.token-view-balance__balance-container')
assert.ok(heroBalance, 'rendered hero balance') assert.ok(heroBalance, 'rendered hero balance')
assert.ok(tokenImageUrl.indexOf(heroBalance.find('img').attr('src')) > -1, 'token added') assert.ok(tokenImageUrl.indexOf(heroBalance.find('img').attr('src')) > -1, 'token added')
@ -134,7 +134,7 @@ async function runAddTokenFlowTest (assert, done) {
// $('button.btn-primary--lg')[0].click() // $('button.btn-primary--lg')[0].click()
// Verify added token image // Verify added token image
heroBalance = await queryAsync($, '.hero-balance') heroBalance = await queryAsync($, '.token-view-balance__balance-container')
assert.ok(heroBalance, 'rendered hero balance') assert.ok(heroBalance, 'rendered hero balance')
assert.ok(heroBalance.find('.identicon')[0], 'token added') assert.ok(heroBalance.find('.identicon')[0], 'token added')
} }

@ -19,7 +19,7 @@ async function runConfirmSigRequestsTest (assert, done) {
selectState.val('confirm sig requests') selectState.val('confirm sig requests')
reactTriggerChange(selectState[0]) reactTriggerChange(selectState[0])
const pendingRequestItem = $.find('.tx-list-item.tx-list-pending-item-container.tx-list-clickable') const pendingRequestItem = $.find('.transaction-list-item')
if (pendingRequestItem[0]) { if (pendingRequestItem[0]) {
pendingRequestItem[0].click() pendingRequestItem[0].click()

@ -22,8 +22,8 @@ async function runCurrencyLocalizationTest (assert, done) {
await timeout(1000) await timeout(1000)
reactTriggerChange(selectState[0]) reactTriggerChange(selectState[0])
await timeout(1000) await timeout(1000)
const txView = await queryAsync($, '.tx-view') const txView = await queryAsync($, '.token-view')
const heroBalance = await findAsync($(txView), '.hero-balance') const heroBalance = await findAsync($(txView), '.token-view-balance__balance')
const fiatAmount = await findAsync($(heroBalance), '.fiat-amount') const fiatAmount = await findAsync($(heroBalance), '.token-view-balance__secondary-balance')
assert.equal(fiatAmount[0].textContent, '₱102,707.97') assert.equal(fiatAmount[0].textContent, '₱102,707.97')
} }

@ -58,7 +58,7 @@ async function runSendFlowTest (assert, done) {
selectState.val('send new ui') selectState.val('send new ui')
reactTriggerChange(selectState[0]) reactTriggerChange(selectState[0])
const sendScreenButton = await queryAsync($, 'button.btn-primary.hero-balance-button') const sendScreenButton = await queryAsync($, 'button.btn-primary.token-view-balance__button')
assert.ok(sendScreenButton[1], 'send screen button present') assert.ok(sendScreenButton[1], 'send screen button present')
sendScreenButton[1].click() sendScreenButton[1].click()

@ -29,37 +29,34 @@ async function runTxListItemsTest (assert, done) {
assert.ok(metamaskLogo[0], 'metamask logo present') assert.ok(metamaskLogo[0], 'metamask logo present')
metamaskLogo[0].click() metamaskLogo[0].click()
const txListItems = await queryAsync($, '.tx-list-item') const txListItems = await queryAsync($, '.transaction-list-item')
assert.equal(txListItems.length, 8, 'all tx list items are rendered') assert.equal(txListItems.length, 8, 'all tx list items are rendered')
const unapprovedTx = txListItems[0]
assert.equal($(unapprovedTx).hasClass('tx-list-pending-item-container'), true, 'unapprovedTx has the correct class')
const retryTx = txListItems[1] const retryTx = txListItems[1]
const retryTxLink = await findAsync($(retryTx), '.tx-list-item-retry-container span') const retryTxLink = await findAsync($(retryTx), '.transaction-list-item__retry')
assert.equal(retryTxLink[0].textContent, 'Taking too long? Increase the gas price on your transaction', 'retryTx has expected link') assert.equal(retryTxLink[0].textContent, 'Taking too long? Increase the gas price on your transaction', 'retryTx has expected link')
const approvedTx = txListItems[2] const approvedTx = txListItems[2]
const approvedTxRenderedStatus = await findAsync($(approvedTx), '.tx-list-status') const approvedTxRenderedStatus = await findAsync($(approvedTx), '.transaction-list-item__status')
assert.equal(approvedTxRenderedStatus[0].textContent, 'Approved', 'approvedTx has correct label') assert.equal(approvedTxRenderedStatus[0].textContent, 'pending', 'approvedTx has correct label')
const unapprovedMsg = txListItems[3] const unapprovedMsg = txListItems[3]
const unapprovedMsgDescription = await findAsync($(unapprovedMsg), '.tx-list-account') const unapprovedMsgDescription = await findAsync($(unapprovedMsg), '.transaction-list-item__action')
assert.equal(unapprovedMsgDescription[0].textContent, 'Signature Request', 'unapprovedMsg has correct description') assert.equal(unapprovedMsgDescription[0].textContent, 'Signature Request', 'unapprovedMsg has correct description')
const failedTx = txListItems[4] const failedTx = txListItems[4]
const failedTxRenderedStatus = await findAsync($(failedTx), '.tx-list-status') const failedTxRenderedStatus = await findAsync($(failedTx), '.transaction-list-item__status')
assert.equal(failedTxRenderedStatus[0].textContent, 'Failed', 'failedTx has correct label') assert.equal(failedTxRenderedStatus[0].textContent, 'failed', 'failedTx has correct label')
const shapeShiftTx = txListItems[5] const shapeShiftTx = txListItems[5]
const shapeShiftTxStatus = await findAsync($(shapeShiftTx), '.flex-column div:eq(1)') const shapeShiftTxStatus = await findAsync($(shapeShiftTx), '.flex-column div:eq(1)')
assert.equal(shapeShiftTxStatus[0].textContent, 'No deposits received', 'shapeShiftTx has correct status') assert.equal(shapeShiftTxStatus[0].textContent, 'No deposits received', 'shapeShiftTx has correct status')
const confirmedTokenTx = txListItems[6] const confirmedTokenTx = txListItems[6]
const confirmedTokenTxAddress = await findAsync($(confirmedTokenTx), '.tx-list-account') const confirmedTokenTxAddress = await findAsync($(confirmedTokenTx), '.transaction-list-item__status')
assert.equal(confirmedTokenTxAddress[0].textContent, '0xE7884118...81a9', 'confirmedTokenTx has correct address') assert.equal(confirmedTokenTxAddress[0].textContent, 'confirmed', 'confirmedTokenTx has correct address')
const rejectedTx = txListItems[7] const rejectedTx = txListItems[7]
const rejectedTxRenderedStatus = await findAsync($(rejectedTx), '.tx-list-status') const rejectedTxRenderedStatus = await findAsync($(rejectedTx), '.transaction-list-item__status')
assert.equal(rejectedTxRenderedStatus[0].textContent, 'Rejected', 'rejectedTx has correct label') assert.equal(rejectedTxRenderedStatus[0].textContent, 'rejected', 'rejectedTx has correct label')
} }

@ -35,12 +35,13 @@ function ShiftListItem () {
} }
ShiftListItem.prototype.render = function () { ShiftListItem.prototype.render = function () {
return h('div.tx-list-item.tx-list-clickable', { return h('div.transaction-list-item.tx-list-clickable', {
style: { style: {
paddingTop: '20px', paddingTop: '20px',
paddingBottom: '20px', paddingBottom: '20px',
justifyContent: 'space-around', justifyContent: 'space-around',
alignItems: 'center', alignItems: 'center',
flexDirection: 'row',
}, },
}, [ }, [
h('div', { h('div', {

@ -67,7 +67,10 @@ export default class TransactionListItem extends PureComponent {
const { txParams = {} } = transaction const { txParams = {} } = transaction
const nonce = hexToDecimal(txParams.nonce) const nonce = hexToDecimal(txParams.nonce)
const nonceAndDateText = `#${nonce} - ${formatDate(transaction.time)}` const nonceAndDateText = nonce
? `#${nonce} - ${formatDate(transaction.time)}`
: formatDate(transaction.time)
const fiatDisplayText = `-${fiatDisplayValue}` const fiatDisplayText = `-${fiatDisplayValue}`
const ethDisplayText = ethTransactionAmount && `-${ethTransactionAmount} ETH` const ethDisplayText = ethTransactionAmount && `-${ethTransactionAmount} ETH`

@ -4,6 +4,7 @@ import { compose } from 'recompose'
import TransactionList from './transaction-list.component' import TransactionList from './transaction-list.component'
import { import {
pendingTransactionsSelector, pendingTransactionsSelector,
submittedPendingTransactionsSelector,
completedTransactionsSelector, completedTransactionsSelector,
} from '../../selectors/transactions' } from '../../selectors/transactions'
import { selectedTokenSelector } from '../../selectors/tokens' import { selectedTokenSelector } from '../../selectors/tokens'
@ -11,11 +12,12 @@ import { getLatestSubmittedTxWithEarliestNonce } from '../../helpers/transaction
const mapStateToProps = state => { const mapStateToProps = state => {
const pendingTransactions = pendingTransactionsSelector(state) const pendingTransactions = pendingTransactionsSelector(state)
const submittedPendingTransactions = submittedPendingTransactionsSelector(state)
return { return {
completedTransactions: completedTransactionsSelector(state), completedTransactions: completedTransactionsSelector(state),
pendingTransactions, pendingTransactions,
transactionToRetry: getLatestSubmittedTxWithEarliestNonce(pendingTransactions), transactionToRetry: getLatestSubmittedTxWithEarliestNonce(submittedPendingTransactions),
selectedToken: selectedTokenSelector(state), selectedToken: selectedTokenSelector(state),
} }
} }

@ -21,7 +21,7 @@
color: #609a1c; color: #609a1c;
} }
&--approved { &--approved, &--submitted {
background-color: #FFF2DB; background-color: #FFF2DB;
color: #CA810A; color: #CA810A;
} }

@ -16,5 +16,6 @@ export const DEPLOY_CONTRACT_ACTION_KEY = 'contractDeployment'
export const APPROVE_ACTION_KEY = 'approve' export const APPROVE_ACTION_KEY = 'approve'
export const SEND_TOKEN_ACTION_KEY = 'outgoing' export const SEND_TOKEN_ACTION_KEY = 'outgoing'
export const TRANSFER_FROM_ACTION_KEY = 'transferFrom' export const TRANSFER_FROM_ACTION_KEY = 'transferFrom'
export const SIGNATURE_REQUEST_KEY = 'signatureRequest'
export const TRANSACTION_TYPE_SHAPESHIFT = 'shapeshift' export const TRANSACTION_TYPE_SHAPESHIFT = 'shapeshift'

@ -13,6 +13,7 @@ import {
APPROVE_ACTION_KEY, APPROVE_ACTION_KEY,
SEND_TOKEN_ACTION_KEY, SEND_TOKEN_ACTION_KEY,
TRANSFER_FROM_ACTION_KEY, TRANSFER_FROM_ACTION_KEY,
SIGNATURE_REQUEST_KEY,
} from '../constants/transactions' } from '../constants/transactions'
abiDecoder.addABI(abi) abiDecoder.addABI(abi)
@ -41,7 +42,11 @@ export function isConfirmDeployContract (txData = {}) {
} }
export function getTransactionActionKey (transaction, methodData) { export function getTransactionActionKey (transaction, methodData) {
const { txParams: { data } = {} } = transaction const { txParams: { data } = {}, msgParams } = transaction
if (msgParams) {
return SIGNATURE_REQUEST_KEY
}
if (isConfirmDeployContract(transaction)) { if (isConfirmDeployContract(transaction)) {
return DEPLOY_CONTRACT_ACTION_KEY return DEPLOY_CONTRACT_ACTION_KEY

@ -43,6 +43,13 @@ export const pendingTransactionsSelector = createSelector(
) )
) )
export const submittedPendingTransactionsSelector = createSelector(
transactionsSelector,
(transactions = []) => (
transactions.filter(transaction => transaction.status === SUBMITTED_STATUS)
)
)
export const completedTransactionsSelector = createSelector( export const completedTransactionsSelector = createSelector(
transactionsSelector, transactionsSelector,
(transactions = []) => ( (transactions = []) => (

Loading…
Cancel
Save