WA-232 Reducing executing time of transactions DOM tests by 40%
This commit is contained in:
parent
c40488493d
commit
91b2fa8e0e
|
@ -10,6 +10,7 @@ import { checkMinedThresholdTx, sendChangeThresholdForm, checkThresholdOf } from
|
|||
import { sendWithdrawForm, checkMinedWithdrawTx } from '~/test/utils/transactions/withdraw.helper'
|
||||
import { processTransaction } from '~/routes/safe/component/Transactions/processTransactions'
|
||||
import { checkBalanceOf } from '~/test/utils/tokenMovements'
|
||||
import { sleep } from '~/utils/timer'
|
||||
|
||||
describe('DOM > Feature > SAFE MULTISIG Transactions', () => {
|
||||
let domSafe: DomSafe
|
||||
|
@ -26,6 +27,7 @@ describe('DOM > Feature > SAFE MULTISIG Transactions', () => {
|
|||
await sendMoveFundsForm(SafeDom, safeButtons[EXPAND_BALANCE_INDEX], '0.01', accounts[1])
|
||||
await sendWithdrawForm(SafeDom, safeButtons[WITHDRAW_INDEX], '0.01', accounts[3])
|
||||
await sendAddOwnerForm(SafeDom, safeButtons[ADD_OWNERS_INDEX], 'Adol Metamask 2', accounts[1])
|
||||
await sleep(1200)
|
||||
await sendChangeThresholdForm(SafeDom, safeButtons[EDIT_THRESHOLD_INDEX], '2')
|
||||
|
||||
// THEN
|
||||
|
|
|
@ -3,7 +3,7 @@ import TestUtils from 'react-dom/test-utils'
|
|||
import { sleep } from '~/utils/timer'
|
||||
import { checkMinedTx, checkPendingTx } from '~/test/builder/safe.dom.utils'
|
||||
|
||||
export const sendAddOwnerForm = (
|
||||
export const sendAddOwnerForm = async (
|
||||
SafeDom: React$Component<any, any>,
|
||||
addOwner: React$Component<any, any>,
|
||||
ownerName: string,
|
||||
|
@ -13,7 +13,7 @@ export const sendAddOwnerForm = (
|
|||
// load add multisig form component
|
||||
TestUtils.Simulate.click(addOwner)
|
||||
// give time to re-render it
|
||||
sleep(600)
|
||||
await sleep(400)
|
||||
|
||||
// fill the form
|
||||
const inputs = TestUtils.scryRenderedDOMComponentsWithTag(SafeDom, 'input')
|
||||
|
@ -33,9 +33,6 @@ export const sendAddOwnerForm = (
|
|||
// submit it
|
||||
TestUtils.Simulate.submit(form)
|
||||
TestUtils.Simulate.submit(form)
|
||||
|
||||
// give time to process transaction
|
||||
return sleep(2500)
|
||||
}
|
||||
|
||||
export const checkMinedAddOwnerTx = (Transaction: React$Component<any, any>, name: string) => {
|
||||
|
|
|
@ -12,13 +12,13 @@ export const sendMoveFundsForm = async (
|
|||
// load add multisig form component
|
||||
TestUtils.Simulate.click(expandBalance)
|
||||
// give time to re-render it
|
||||
await sleep(600)
|
||||
await sleep(400)
|
||||
|
||||
const ethList = TestUtils.findRenderedDOMComponentWithClass(SafeDom, 'ETH')
|
||||
if (!ethList) throw new Error()
|
||||
const ethButton = ethList.getElementsByTagName('button')
|
||||
TestUtils.Simulate.click(ethButton[0])
|
||||
await sleep(850)
|
||||
await sleep(450)
|
||||
|
||||
// fill the form
|
||||
const inputs = TestUtils.scryRenderedDOMComponentsWithTag(SafeDom, 'input')
|
||||
|
@ -32,9 +32,6 @@ export const sendMoveFundsForm = async (
|
|||
// submit it
|
||||
TestUtils.Simulate.submit(form)
|
||||
TestUtils.Simulate.submit(form)
|
||||
|
||||
// give time to process transaction
|
||||
return sleep(2500)
|
||||
}
|
||||
|
||||
export const checkMinedMoveFundsTx = (Transaction: React$Component<any, any>, name: string) => {
|
||||
|
|
|
@ -14,7 +14,7 @@ export const sendMoveTokensForm = async (
|
|||
destination: string,
|
||||
) => {
|
||||
TestUtils.Simulate.click(expandBalance)
|
||||
await sleep(800)
|
||||
await sleep(500)
|
||||
|
||||
// $FlowFixMe
|
||||
const balanceButtons = TestUtils.scryRenderedDOMComponentsWithTag(SafeDom, 'button')
|
||||
|
@ -23,7 +23,7 @@ export const sendMoveTokensForm = async (
|
|||
|
||||
// load move tokens form component
|
||||
TestUtils.Simulate.click(tokenButton)
|
||||
await sleep(800)
|
||||
await sleep(500)
|
||||
|
||||
// fill the form
|
||||
const inputs = TestUtils.scryRenderedDOMComponentsWithTag(SafeDom, 'input')
|
||||
|
@ -37,9 +37,6 @@ export const sendMoveTokensForm = async (
|
|||
// submit it
|
||||
TestUtils.Simulate.submit(form)
|
||||
TestUtils.Simulate.submit(form)
|
||||
|
||||
// give time to process transaction
|
||||
return sleep(1250)
|
||||
}
|
||||
|
||||
export const dispatchTknBalance = async (store: Store, tokenAddress: string, address: string) => {
|
||||
|
|
|
@ -10,7 +10,7 @@ export const sendRemoveOwnerForm = async (
|
|||
) => {
|
||||
// Expand owners
|
||||
TestUtils.Simulate.click(expandOwners)
|
||||
await sleep(600)
|
||||
await sleep(400)
|
||||
|
||||
// Get delete button user
|
||||
const allButtons = TestUtils.scryRenderedDOMComponentsWithTag(SafeDom, 'button')
|
||||
|
@ -20,7 +20,7 @@ export const sendRemoveOwnerForm = async (
|
|||
|
||||
// render form for deleting the user
|
||||
TestUtils.Simulate.click(removeUserButton)
|
||||
await sleep(600)
|
||||
await sleep(400)
|
||||
|
||||
// $FlowFixMe
|
||||
const form = TestUtils.findRenderedDOMComponentWithTag(SafeDom, 'form')
|
||||
|
@ -28,9 +28,6 @@ export const sendRemoveOwnerForm = async (
|
|||
// submit it
|
||||
TestUtils.Simulate.submit(form)
|
||||
TestUtils.Simulate.submit(form)
|
||||
|
||||
// give time to process transaction
|
||||
return sleep(2500)
|
||||
}
|
||||
|
||||
export const checkMinedRemoveOwnerTx = (Transaction: React$Component<any, any>, name: string) => {
|
||||
|
|
|
@ -4,14 +4,14 @@ import { sleep } from '~/utils/timer'
|
|||
import { checkMinedTx } from '~/test/builder/safe.dom.utils'
|
||||
import { getGnosisSafeInstanceAt } from '~/wallets/safeContracts'
|
||||
|
||||
export const sendChangeThresholdForm = (
|
||||
export const sendChangeThresholdForm = async (
|
||||
SafeDom: React$Component<any, any>,
|
||||
changeThreshold: React$Component<any, any>,
|
||||
threshold: string,
|
||||
) => {
|
||||
// Load the Threshold Form
|
||||
TestUtils.Simulate.click(changeThreshold)
|
||||
sleep(600)
|
||||
await sleep(400)
|
||||
|
||||
// fill the form
|
||||
const inputs = TestUtils.scryRenderedDOMComponentsWithTag(SafeDom, 'input')
|
||||
|
@ -23,9 +23,6 @@ export const sendChangeThresholdForm = (
|
|||
// submit it
|
||||
TestUtils.Simulate.submit(form)
|
||||
TestUtils.Simulate.submit(form)
|
||||
|
||||
// give time to process transaction
|
||||
return sleep(2500)
|
||||
}
|
||||
|
||||
export const checkMinedThresholdTx = (Transaction: React$Component<any, any>, name: string) => {
|
||||
|
|
|
@ -13,7 +13,7 @@ export const sendWithdrawForm = async (
|
|||
// load add multisig form component
|
||||
TestUtils.Simulate.click(withdrawButton)
|
||||
// give time to re-render it
|
||||
await sleep(600)
|
||||
await sleep(400)
|
||||
|
||||
// fill the form
|
||||
const inputs = TestUtils.scryRenderedDOMComponentsWithTag(SafeDom, 'input')
|
||||
|
@ -27,9 +27,6 @@ export const sendWithdrawForm = async (
|
|||
// submit it
|
||||
TestUtils.Simulate.submit(form)
|
||||
TestUtils.Simulate.submit(form)
|
||||
|
||||
// give time to process transaction
|
||||
return sleep(2500)
|
||||
}
|
||||
|
||||
export const checkMinedWithdrawTx = async (
|
||||
|
|
Loading…
Reference in New Issue