WA-438 Fix tests

This commit is contained in:
apanizo 2018-06-22 10:44:49 +02:00
parent f8e7b13095
commit 63bba3ccd5
15 changed files with 105 additions and 41 deletions

View File

@ -1270,8 +1270,14 @@
"links": {}, "links": {},
"address": "0xadf257fb7290315d37d6b11ccdbb648a5d3d148f", "address": "0xadf257fb7290315d37d6b11ccdbb648a5d3d148f",
"transactionHash": "0x80d74510df045a8b9ff09a084394dfd4eae7b7db3921dd9bde780fa7edf4d076" "transactionHash": "0x80d74510df045a8b9ff09a084394dfd4eae7b7db3921dd9bde780fa7edf4d076"
},
"1529652204341": {
"events": {},
"links": {},
"address": "0x8abc460ef144c8a56bee97dc35821f3adff74f3c",
"transactionHash": "0x7af1e557142bc9cc9bedcfbd550efa8d91bfabefb4cde8f29294155c9465c137"
} }
}, },
"schemaVersion": "2.0.0", "schemaVersion": "2.0.0",
"updatedAt": "2018-06-20T07:58:01.354Z" "updatedAt": "2018-06-22T07:24:16.273Z"
} }

View File

@ -6693,8 +6693,14 @@
"links": {}, "links": {},
"address": "0xaff94993c9e18850a990c68bbb61d4531d3e61dd", "address": "0xaff94993c9e18850a990c68bbb61d4531d3e61dd",
"transactionHash": "0xff53c43c6c273ba0614353b138d78042df23d7dc6bdf767fd00fe03b538fa019" "transactionHash": "0xff53c43c6c273ba0614353b138d78042df23d7dc6bdf767fd00fe03b538fa019"
},
"1529652204341": {
"events": {},
"links": {},
"address": "0x33eccff7f17d7533b9d127d3885ea4b145ca962c",
"transactionHash": "0x95b2c0b5b1a282240281542feb7748212fb861c364007da93b6aba6ce6bc38cf"
} }
}, },
"schemaVersion": "2.0.0", "schemaVersion": "2.0.0",
"updatedAt": "2018-06-20T07:58:01.364Z" "updatedAt": "2018-06-22T07:24:16.257Z"
} }

View File

@ -9122,8 +9122,14 @@
"links": {}, "links": {},
"address": "0x0c6b67148fe8939c20040e409fc2e5bc349cf1fd", "address": "0x0c6b67148fe8939c20040e409fc2e5bc349cf1fd",
"transactionHash": "0xa3d4ad952d11ed76260a43d543cd9e20075a9fd4e69a1001c5ca76dfc73b8ca0" "transactionHash": "0xa3d4ad952d11ed76260a43d543cd9e20075a9fd4e69a1001c5ca76dfc73b8ca0"
},
"1529652204341": {
"events": {},
"links": {},
"address": "0x3a153e91544b2639d1bff08ddf29cfe0b90d54c2",
"transactionHash": "0x3324c7ff6568820ed79ff9613ae1d851689b2d93a8eafa70c1a40e833f7cfe7b"
} }
}, },
"schemaVersion": "2.0.0", "schemaVersion": "2.0.0",
"updatedAt": "2018-06-20T07:58:01.351Z" "updatedAt": "2018-06-22T07:24:16.246Z"
} }

View File

@ -6954,8 +6954,14 @@
"links": {}, "links": {},
"address": "0xd748a53c2061521b6b3b5b0d40b91461591b0dc7", "address": "0xd748a53c2061521b6b3b5b0d40b91461591b0dc7",
"transactionHash": "0xe82ec5350517d60310a99990cfa668570eb06a1d69fa9f4b884eab0d5caa1ad1" "transactionHash": "0xe82ec5350517d60310a99990cfa668570eb06a1d69fa9f4b884eab0d5caa1ad1"
},
"1529652204341": {
"events": {},
"links": {},
"address": "0xffc8d32e746202b3676a206fa5296edd43cb2cd3",
"transactionHash": "0x9ae1de406cd8d0ca8fe85c77d43349ae77fd4d9691defa15cd9380f4c49e3a98"
} }
}, },
"schemaVersion": "2.0.0", "schemaVersion": "2.0.0",
"updatedAt": "2018-06-20T07:58:01.347Z" "updatedAt": "2018-06-22T07:24:16.250Z"
} }

View File

@ -1392,8 +1392,14 @@
"links": {}, "links": {},
"address": "0xf1a3a15c821eb31eadcbbdb05e3a19d41e622074", "address": "0xf1a3a15c821eb31eadcbbdb05e3a19d41e622074",
"transactionHash": "0x78a7a50665062991b8931337e43ac4f21200e6cecaa102d7685d9a391119c3ce" "transactionHash": "0x78a7a50665062991b8931337e43ac4f21200e6cecaa102d7685d9a391119c3ce"
},
"1529652204341": {
"events": {},
"links": {},
"address": "0x8b8f0365a24b4c968b7a1ada7b116c510f2df133",
"transactionHash": "0xb6a19a7a679a1474c09c651e4151421f210afa3f47effed019d4c0206144ee5f"
} }
}, },
"schemaVersion": "2.0.0", "schemaVersion": "2.0.0",
"updatedAt": "2018-06-20T07:58:01.359Z" "updatedAt": "2018-06-22T07:24:16.275Z"
} }

View File

@ -372,8 +372,14 @@
"links": {}, "links": {},
"address": "0xaba1a0da223a2a5e04158bd80b2af7671e27e2c6", "address": "0xaba1a0da223a2a5e04158bd80b2af7671e27e2c6",
"transactionHash": "0x6e7c0c3947a3a851738677ae63915781ce79fdfb0453030fc63bbcd346f2cf89" "transactionHash": "0x6e7c0c3947a3a851738677ae63915781ce79fdfb0453030fc63bbcd346f2cf89"
},
"1529652204341": {
"events": {},
"links": {},
"address": "0x2013688de17569d52fc4cd4fe5f18821d8b32b2a",
"transactionHash": "0x2d7f72a94ced345c372040faa1f51a51f3e8da27a02dd04b9eefef487de3ba05"
} }
}, },
"schemaVersion": "2.0.0", "schemaVersion": "2.0.0",
"updatedAt": "2018-06-20T07:58:01.355Z" "updatedAt": "2018-06-22T07:24:16.274Z"
} }

View File

@ -1005,8 +1005,14 @@
"links": {}, "links": {},
"address": "0xce824fab495ef56405218cce3512b7a73df9e2ca", "address": "0xce824fab495ef56405218cce3512b7a73df9e2ca",
"transactionHash": "0x10a89cb87c96bb1becc3a78f1bfdd54f98cdc1cb7e5164e26b1cbbd09d69be8c" "transactionHash": "0x10a89cb87c96bb1becc3a78f1bfdd54f98cdc1cb7e5164e26b1cbbd09d69be8c"
},
"1529652204341": {
"events": {},
"links": {},
"address": "0xffacf76025eda5f84659135a9d5c2d815dbe1caa",
"transactionHash": "0x75ad1066b44cd801ac66a316dbe4c09e72636d72b70fd62eb647295a0fc5e285"
} }
}, },
"schemaVersion": "2.0.0", "schemaVersion": "2.0.0",
"updatedAt": "2018-06-20T07:58:01.341Z" "updatedAt": "2018-06-22T07:24:16.243Z"
} }

View File

@ -7304,8 +7304,14 @@
"links": {}, "links": {},
"address": "0x9d6575ea466550e050f4c08eff7075ab099db8f6", "address": "0x9d6575ea466550e050f4c08eff7075ab099db8f6",
"transactionHash": "0x8c0dc99f8f345ac15f129ef0e98e60a7fde3975cf8b77fbb9f0b1e75eae34c30" "transactionHash": "0x8c0dc99f8f345ac15f129ef0e98e60a7fde3975cf8b77fbb9f0b1e75eae34c30"
},
"1529652204341": {
"events": {},
"links": {},
"address": "0xdfcdce812f5f001cdd35506bfb01cc02e31ae5a2",
"transactionHash": "0x6c40a3712932d0e03f4a6f0ad0f39be479bac35533935534577070e087245a52"
} }
}, },
"schemaVersion": "2.0.0", "schemaVersion": "2.0.0",
"updatedAt": "2018-06-20T07:58:01.368Z" "updatedAt": "2018-06-22T07:24:16.270Z"
} }

View File

@ -5437,8 +5437,14 @@
"links": {}, "links": {},
"address": "0x437ca411c1aa04e6012dbe1ac8cd0ccc87c1e6d9", "address": "0x437ca411c1aa04e6012dbe1ac8cd0ccc87c1e6d9",
"transactionHash": "0xe7066b0fd7695e7e5956681c536759a36839b507de3a4fde6509dab7c6d9b152" "transactionHash": "0xe7066b0fd7695e7e5956681c536759a36839b507de3a4fde6509dab7c6d9b152"
},
"1529652204341": {
"events": {},
"links": {},
"address": "0xcda1de5ecadaf89d663ed589a615e0ba8d697d3d",
"transactionHash": "0xcc681aa2ad918c4a255559fa45f9c64405ce4064db091ce1d7749bf3e6f05899"
} }
}, },
"schemaVersion": "2.0.0", "schemaVersion": "2.0.0",
"updatedAt": "2018-06-20T07:58:01.343Z" "updatedAt": "2018-06-22T07:24:16.253Z"
} }

View File

@ -4348,8 +4348,14 @@
"links": {}, "links": {},
"address": "0x6fafade61582e994730a7cd15480155d8017e888", "address": "0x6fafade61582e994730a7cd15480155d8017e888",
"transactionHash": "0x7850b601cdea18ba050f455b4fad47c152c51ed5d2c56e88a54a336780ddcbd2" "transactionHash": "0x7850b601cdea18ba050f455b4fad47c152c51ed5d2c56e88a54a336780ddcbd2"
},
"1529652204341": {
"events": {},
"links": {},
"address": "0x88ed584819ee8dda7263b501af76ca07befa9ac7",
"transactionHash": "0x07909d849b2c29127266874541e7145062da0e1af6ab5d204cd91ca8d08d48d0"
} }
}, },
"schemaVersion": "2.0.0", "schemaVersion": "2.0.0",
"updatedAt": "2018-06-20T07:58:01.360Z" "updatedAt": "2018-06-22T07:24:16.263Z"
} }

View File

@ -17,6 +17,7 @@ import { getBalanceInEtherOf } from '~/wallets/getWeb3'
import { sleep } from '~/utils/timer' import { sleep } from '~/utils/timer'
import { ADD_MULTISIG_BUTTON_TEXT } from '~/routes/safe/component/Safe/MultisigTx' import { ADD_MULTISIG_BUTTON_TEXT } from '~/routes/safe/component/Safe/MultisigTx'
import { safeTransactionsSelector } from '~/routes/safe/store/selectors/index' import { safeTransactionsSelector } from '~/routes/safe/store/selectors/index'
import { MOVE_FUNDS_INDEX } from '~/test/builder/safe.dom.utils'
describe('React DOM TESTS > Withdraw funds from safe', () => { describe('React DOM TESTS > Withdraw funds from safe', () => {
let SafeDom let SafeDom
@ -44,12 +45,12 @@ describe('React DOM TESTS > Withdraw funds from safe', () => {
const Safe = TestUtils.findRenderedComponentWithType(SafeDom, SafeView) const Safe = TestUtils.findRenderedComponentWithType(SafeDom, SafeView)
// $FlowFixMe // $FlowFixMe
const buttons = TestUtils.scryRenderedComponentsWithType(Safe, Button) const buttons = TestUtils.scryRenderedDOMComponentsWithTag(Safe, 'button')
const addTxButton = buttons[3] const addTxButton = buttons[MOVE_FUNDS_INDEX]
expect(addTxButton.props.children).toEqual(ADD_MULTISIG_BUTTON_TEXT) expect(addTxButton.getElementsByTagName('span')[0].innerHTML).toEqual(ADD_MULTISIG_BUTTON_TEXT)
await sleep(1800) // Give time to enable Add button
TestUtils.Simulate.click(TestUtils.scryRenderedDOMComponentsWithTag(addTxButton, 'button')[0])
await sleep(1800) // Give time to enable Add button
TestUtils.Simulate.click(addTxButton)
const AddTransaction = TestUtils.findRenderedComponentWithType(SafeDom, AddTransactionComponent) const AddTransaction = TestUtils.findRenderedComponentWithType(SafeDom, AddTransactionComponent)
// $FlowFixMe // $FlowFixMe

View File

@ -17,6 +17,7 @@ import { sleep } from '~/utils/timer'
import { getDailyLimitFrom } from '~/routes/safe/component/Withdraw/withdraw' import { getDailyLimitFrom } from '~/routes/safe/component/Withdraw/withdraw'
import { type DailyLimitProps } from '~/routes/safe/store/model/dailyLimit' import { type DailyLimitProps } from '~/routes/safe/store/model/dailyLimit'
import { ADD_MULTISIG_BUTTON_TEXT } from '~/routes/safe/component/Safe/MultisigTx' import { ADD_MULTISIG_BUTTON_TEXT } from '~/routes/safe/component/Safe/MultisigTx'
import { WITHDRAW_INDEX, MOVE_FUNDS_INDEX } from '~/test/builder/safe.dom.utils'
describe('React DOM TESTS > Withdraw funds from safe', () => { describe('React DOM TESTS > Withdraw funds from safe', () => {
let SafeDom let SafeDom
@ -45,10 +46,10 @@ describe('React DOM TESTS > Withdraw funds from safe', () => {
const Safe = TestUtils.findRenderedComponentWithType(SafeDom, SafeView) const Safe = TestUtils.findRenderedComponentWithType(SafeDom, SafeView)
// $FlowFixMe // $FlowFixMe
const buttons = TestUtils.scryRenderedComponentsWithType(Safe, Button) const buttons = TestUtils.scryRenderedDOMComponentsWithTag(Safe, 'button')
const withdrawButton = buttons[2] const addWithdrawButton = buttons[WITHDRAW_INDEX]
expect(withdrawButton.props.children).toEqual(WITHDRAW_BUTTON_TEXT) expect(addWithdrawButton.getElementsByTagName('span')[0].innerHTML).toEqual(WITHDRAW_BUTTON_TEXT)
TestUtils.Simulate.click(TestUtils.scryRenderedDOMComponentsWithTag(withdrawButton, 'button')[0]) TestUtils.Simulate.click(addWithdrawButton)
await sleep(4000) await sleep(4000)
const Withdraw = TestUtils.findRenderedComponentWithType(SafeDom, WithdrawComponent) const Withdraw = TestUtils.findRenderedComponentWithType(SafeDom, WithdrawComponent)
@ -95,28 +96,28 @@ describe('React DOM TESTS > Withdraw funds from safe', () => {
it('add multisig txs button disabled when balance is 0', async () => { it('add multisig txs button disabled when balance is 0', async () => {
const Safe = TestUtils.findRenderedComponentWithType(SafeDom, SafeView) const Safe = TestUtils.findRenderedComponentWithType(SafeDom, SafeView)
// $FlowFixMe // $FlowFixMe
const buttons = TestUtils.scryRenderedComponentsWithType(Safe, Button) const buttons = TestUtils.scryRenderedDOMComponentsWithTag(Safe, 'button')
const addTxButton = buttons[3] const addTxButton = buttons[MOVE_FUNDS_INDEX]
expect(addTxButton.props.children).toEqual(ADD_MULTISIG_BUTTON_TEXT) expect(addTxButton.getElementsByTagName('span')[0].innerHTML).toEqual(ADD_MULTISIG_BUTTON_TEXT)
expect(addTxButton.props.disabled).toBe(true) expect(addTxButton.hasAttribute('disabled')).toBe(true)
await addEtherTo(address, '0.1') await addEtherTo(address, '0.1')
await sleep(1800) await sleep(1800)
expect(addTxButton.props.disabled).toBe(false) expect(addTxButton.hasAttribute('disabled')).toBe(false)
}) })
it('Withdraw button disabled when balance is 0', async () => { it('Withdraw button disabled when balance is 0', async () => {
const Safe = TestUtils.findRenderedComponentWithType(SafeDom, SafeView) const Safe = TestUtils.findRenderedComponentWithType(SafeDom, SafeView)
// $FlowFixMe // $FlowFixMe
const buttons = TestUtils.scryRenderedComponentsWithType(Safe, Button) const buttons = TestUtils.scryRenderedDOMComponentsWithTag(Safe, 'button')
const addTxButton = buttons[2] const addWithdrawButton = buttons[WITHDRAW_INDEX]
expect(addTxButton.props.children).toEqual(WITHDRAW_BUTTON_TEXT) expect(addWithdrawButton.getElementsByTagName('span')[0].innerHTML).toEqual(WITHDRAW_BUTTON_TEXT)
expect(addTxButton.props.disabled).toBe(true) expect(addWithdrawButton.hasAttribute('disabled')).toBe(true)
await addEtherTo(address, '0.1') await addEtherTo(address, '0.1')
await sleep(1800) await sleep(1800)
expect(addTxButton.props.disabled).toBe(false) expect(addWithdrawButton.hasAttribute('disabled')).toBe(false)
}) })
}) })

View File

@ -2,7 +2,6 @@
import TestUtils from 'react-dom/test-utils' import TestUtils from 'react-dom/test-utils'
import { sleep } from '~/utils/timer' import { sleep } from '~/utils/timer'
import { getBalanceInEtherOf } from '~/wallets/getWeb3' import { getBalanceInEtherOf } from '~/wallets/getWeb3'
import Button from '~/components/layout/Button'
import { ADD_MULTISIG_BUTTON_TEXT, SEE_MULTISIG_BUTTON_TEXT } from '~/routes/safe/component/Safe/MultisigTx' import { ADD_MULTISIG_BUTTON_TEXT, SEE_MULTISIG_BUTTON_TEXT } from '~/routes/safe/component/Safe/MultisigTx'
import { addEtherTo } from '~/test/utils/etherMovements' import { addEtherTo } from '~/test/utils/etherMovements'
import SafeView from '~/routes/safe/component/Safe' import SafeView from '~/routes/safe/component/Safe'
@ -11,6 +10,7 @@ import TransactionComponent from '~/routes/safe/component/Transactions/Transacti
import { safeTransactionsSelector } from '~/routes/safe/store/selectors/index' import { safeTransactionsSelector } from '~/routes/safe/store/selectors/index'
import { type GlobalState } from '~/store/index' import { type GlobalState } from '~/store/index'
import ListItemText from '~/components/List/ListItemText' import ListItemText from '~/components/List/ListItemText'
import { MOVE_FUNDS_INDEX, LIST_TXS_INDEX } from '~/test/builder/safe.dom.utils'
export const createMultisigTxFilling = async ( export const createMultisigTxFilling = async (
SafeDom: React$Component<any, any>, SafeDom: React$Component<any, any>,
@ -48,21 +48,22 @@ export const addFundsTo = async (SafeDom: React$Component<any, any>, destination
const Safe = TestUtils.findRenderedComponentWithType(SafeDom, SafeView) const Safe = TestUtils.findRenderedComponentWithType(SafeDom, SafeView)
// $FlowFixMe // $FlowFixMe
const buttons = TestUtils.scryRenderedComponentsWithType(Safe, Button) const buttons = TestUtils.scryRenderedDOMComponentsWithTag(Safe, 'button')
const addTxButton = buttons[3] const addTxButton = buttons[MOVE_FUNDS_INDEX]
expect(addTxButton.props.children).toEqual(ADD_MULTISIG_BUTTON_TEXT) expect(addTxButton.getElementsByTagName('span')[0].innerHTML).toEqual(ADD_MULTISIG_BUTTON_TEXT)
await sleep(1800) // Give time to enable Add button await sleep(1800) // Give time to enable Add button
TestUtils.Simulate.click(TestUtils.scryRenderedDOMComponentsWithTag(addTxButton, 'button')[0]) TestUtils.Simulate.click(addTxButton)
} }
export const listTxsOf = (SafeDom: React$Component<any, any>) => { export const listTxsOf = (SafeDom: React$Component<any, any>) => {
const Safe = TestUtils.findRenderedComponentWithType(SafeDom, SafeView) const Safe = TestUtils.findRenderedComponentWithType(SafeDom, SafeView)
// $FlowFixMe // $FlowFixMe
const buttons = TestUtils.scryRenderedComponentsWithType(Safe, Button) const buttons = TestUtils.scryRenderedDOMComponentsWithTag(Safe, 'button')
const seeTx = buttons[4] const seeTx = buttons[LIST_TXS_INDEX]
expect(seeTx.props.children).toEqual(SEE_MULTISIG_BUTTON_TEXT) expect(seeTx.getElementsByTagName('span')[0].innerHTML).toEqual(SEE_MULTISIG_BUTTON_TEXT)
TestUtils.Simulate.click(TestUtils.scryRenderedDOMComponentsWithTag(seeTx, 'button')[0]) TestUtils.Simulate.click(seeTx)
} }
export const getListItemsFrom = (SafeDom: React$Component<any, any>) => { export const getListItemsFrom = (SafeDom: React$Component<any, any>) => {

View File

@ -8,9 +8,10 @@ import { sleep } from '~/utils/timer'
export const EXPAND_OWNERS_INDEX = 0 export const EXPAND_OWNERS_INDEX = 0
export const ADD_OWNERS_INDEX = 1 export const ADD_OWNERS_INDEX = 1
export const EDIT_THRESHOLD_INDEX = 2 export const EDIT_THRESHOLD_INDEX = 2
export const WITHDRAW_INDEX = 3 export const EDIT_INDEX = 3
export const MOVE_FUNDS_INDEX = 4 export const WITHDRAW_INDEX = 4
export const LIST_TXS_INDEX = 5 export const MOVE_FUNDS_INDEX = 5
export const LIST_TXS_INDEX = 6
export const listTxsClickingOn = async (seeTxsButton: Element) => { export const listTxsClickingOn = async (seeTxsButton: Element) => {
expect(seeTxsButton.getElementsByTagName('span')[0].innerHTML).toEqual(SEE_MULTISIG_BUTTON_TEXT) expect(seeTxsButton.getElementsByTagName('span')[0].innerHTML).toEqual(SEE_MULTISIG_BUTTON_TEXT)