diff options
author | PaddyMc <paddymchale@hotmail.com> | 2018-11-14 01:19:12 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-11-14 01:19:12 +0800 |
commit | 7ce2cf4572f80b71d5ab4d4c479a49bcca9ccdf1 (patch) | |
tree | 388ef4fdb4d07864a6e6a37faa2b90532191112a /test/integration | |
parent | d943345151b7caf723533721a37ceea2e5286b9c (diff) | |
download | tangerine-wallet-browser-7ce2cf4572f80b71d5ab4d4c479a49bcca9ccdf1.tar tangerine-wallet-browser-7ce2cf4572f80b71d5ab4d4c479a49bcca9ccdf1.tar.gz tangerine-wallet-browser-7ce2cf4572f80b71d5ab4d4c479a49bcca9ccdf1.tar.bz2 tangerine-wallet-browser-7ce2cf4572f80b71d5ab4d4c479a49bcca9ccdf1.tar.lz tangerine-wallet-browser-7ce2cf4572f80b71d5ab4d4c479a49bcca9ccdf1.tar.xz tangerine-wallet-browser-7ce2cf4572f80b71d5ab4d4c479a49bcca9ccdf1.tar.zst tangerine-wallet-browser-7ce2cf4572f80b71d5ab4d4c479a49bcca9ccdf1.zip |
Fixes #3425: Better support for batch transactions (#5437)
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/lib/navigate-txs.js | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/test/integration/lib/navigate-txs.js b/test/integration/lib/navigate-txs.js new file mode 100644 index 000000000..0679d6b00 --- /dev/null +++ b/test/integration/lib/navigate-txs.js @@ -0,0 +1,87 @@ +const reactTriggerChange = require('react-trigger-change') +const { + timeout, + queryAsync, +} = require('../../lib/util') + +QUnit.module('navigate txs') + +QUnit.test('successful navigate', (assert) => { + const done = assert.async() + runNavigateTxsFlowTest(assert) + .then(done) + .catch(err => { + assert.notOk(err, `Error was thrown: ${err.stack}`) + done() + }) +}) + +async function runNavigateTxsFlowTest (assert, done) { + const selectState = await queryAsync($, 'select') + + selectState.val('navigate txs') + reactTriggerChange(selectState[0]) + + // Confirm navigation buttons present + let navigateTxButtons = await queryAsync($, '.confirm-page-container-navigation__arrow') + assert.ok(navigateTxButtons[0], 'navigation button present') + assert.ok(navigateTxButtons[1], 'navigation button present') + assert.ok(navigateTxButtons[2], 'navigation button present') + assert.ok(navigateTxButtons[3], 'navigation button present') + + // Verify number of transactions present + let trxNum = await queryAsync($, '.confirm-page-container-navigation') + assert.equal(trxNum[0].innerText.includes('1'), true, 'starts on first') + + // Verify correct route + let summaryAction = await queryAsync($, '.confirm-page-container-summary__action') + assert.equal(summaryAction[0].innerText, 'CONTRACT DEPLOYMENT', 'correct route') + + // Click navigation button + navigateTxButtons[2].click() + await timeout(2000) + + // Verify transaction changed to num 2 and routed correctly + trxNum = await queryAsync($, '.confirm-page-container-navigation') + assert.equal(trxNum[0].innerText.includes('2'), true, 'changed transaction right') + summaryAction = await queryAsync($, '.confirm-page-container-summary__action') + // assert.equal(summaryAction[0].innerText, 'CONFIRM', 'correct route') + + // Click navigation button + navigateTxButtons = await queryAsync($, '.confirm-page-container-navigation__arrow') + navigateTxButtons[2].click() + + // Verify transation changed to num 3 and routed correctly + trxNum = await queryAsync($, '.confirm-page-container-navigation') + assert.equal(trxNum[0].innerText.includes('3'), true, 'changed transaction right') + summaryAction = await queryAsync($, '.confirm-page-container-summary__action') + assert.equal(summaryAction[0].innerText, 'CONFIRM', 'correct route') + + // Click navigation button + navigateTxButtons = await queryAsync($, '.confirm-page-container-navigation__arrow') + navigateTxButtons[2].click() + + // Verify transation changed to num 4 and routed correctly + trxNum = await queryAsync($, '.confirm-page-container-navigation') + assert.equal(trxNum[0].innerText.split('4').length, 3, '4 transactions present') + summaryAction = await queryAsync($, '.confirm-page-container-summary__action') + assert.equal(summaryAction[0].innerText, 'TRANSFER', 'correct route') + + // Verify left arrow is working correctly + navigateTxButtons = await queryAsync($, '.confirm-page-container-navigation__arrow') + navigateTxButtons[1].click() + trxNum = await queryAsync($, '.confirm-page-container-navigation') + assert.equal(trxNum[0].innerText.includes('3'), true, 'changed transaction left') + + // Verify navigate to last transaction is working correctly + navigateTxButtons = await queryAsync($, '.confirm-page-container-navigation__arrow') + navigateTxButtons[3].click() + trxNum = await queryAsync($, '.confirm-page-container-navigation') + assert.equal(trxNum[0].innerText.split('4').length, 3, 'navigate to last transaction') + + // Verify navigate to first transaction is working correctly + navigateTxButtons = await queryAsync($, '.confirm-page-container-navigation__arrow') + navigateTxButtons[0].click() + trxNum = await queryAsync($, '.confirm-page-container-navigation') + assert.equal(trxNum[0].innerText.includes('1'), true, 'navigate to first transaction') +} |