From 7294aede4fc33e950f84147f1b7402675f53398d Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Mon, 20 Aug 2018 20:16:54 -0700 Subject: Add new variant for SenderToRecipient component --- test/integration/lib/send-new-ui.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js index 406863ca6..cef1a32d7 100644 --- a/test/integration/lib/send-new-ui.js +++ b/test/integration/lib/send-new-ui.js @@ -124,10 +124,10 @@ async function runSendFlowTest (assert, done) { selectState.val('send edit') reactTriggerChange(selectState[0]) - const confirmFromName = (await queryAsync($, '.sender-to-recipient__sender-name')).first() + const confirmFromName = (await queryAsync($, '.sender-to-recipient__name')).first() assert.equal(confirmFromName[0].textContent, 'Send Account 4', 'confirm screen should show correct from name') - const confirmToName = (await queryAsync($, '.sender-to-recipient__recipient-name')).last() + const confirmToName = (await queryAsync($, '.sender-to-recipient__name')).last() assert.equal(confirmToName[0].textContent, 'Send Account 3', 'confirm screen should show correct to name') const confirmScreenRowFiats = await queryAsync($, '.confirm-detail-row__fiat') -- cgit v1.2.3 From e803b8e047b5acad9143fe28d99d9e7d65211f46 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Mon, 20 Aug 2018 12:07:44 -0230 Subject: Add test cases for MetaMaskController#_onKeyringControllerUpdate --- .../app/controllers/metamask-controller-test.js | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'test') diff --git a/test/unit/app/controllers/metamask-controller-test.js b/test/unit/app/controllers/metamask-controller-test.js index a798d41e2..85c78fe1e 100644 --- a/test/unit/app/controllers/metamask-controller-test.js +++ b/test/unit/app/controllers/metamask-controller-test.js @@ -814,6 +814,77 @@ describe('MetaMaskController', function () { }) }) + describe('#_onKeyringControllerUpdate', function () { + it('should do nothing if there are no keyrings in state', async function () { + const addAddresses = sinon.fake() + const syncWithAddresses = sinon.fake() + sandbox.replace(metamaskController, 'preferencesController', { + addAddresses, + }) + sandbox.replace(metamaskController, 'accountTracker', { + syncWithAddresses, + }) + + const oldState = metamaskController.getState() + await metamaskController._onKeyringControllerUpdate({keyrings: []}) + + assert.ok(addAddresses.notCalled) + assert.ok(syncWithAddresses.notCalled) + assert.deepEqual(metamaskController.getState(), oldState) + }) + + it('should update selected address if keyrings was locked', async function () { + const addAddresses = sinon.fake() + const getSelectedAddress = sinon.fake.returns('0x42') + const setSelectedAddress = sinon.fake() + const syncWithAddresses = sinon.fake() + sandbox.replace(metamaskController, 'preferencesController', { + addAddresses, + getSelectedAddress, + setSelectedAddress, + }) + sandbox.replace(metamaskController, 'accountTracker', { + syncWithAddresses, + }) + + const oldState = metamaskController.getState() + await metamaskController._onKeyringControllerUpdate({ + isUnlocked: false, + keyrings: [{ + accounts: ['0x1', '0x2'], + }], + }) + + assert.deepEqual(addAddresses.args, [[['0x1', '0x2']]]) + assert.deepEqual(syncWithAddresses.args, [[['0x1', '0x2']]]) + assert.deepEqual(setSelectedAddress.args, [['0x1']]) + assert.deepEqual(metamaskController.getState(), oldState) + }) + + it('should NOT update selected address if already unlocked', async function () { + const addAddresses = sinon.fake() + const syncWithAddresses = sinon.fake() + sandbox.replace(metamaskController, 'preferencesController', { + addAddresses, + }) + sandbox.replace(metamaskController, 'accountTracker', { + syncWithAddresses, + }) + + const oldState = metamaskController.getState() + await metamaskController._onKeyringControllerUpdate({ + isUnlocked: true, + keyrings: [{ + accounts: ['0x1', '0x2'], + }], + }) + + assert.deepEqual(addAddresses.args, [[['0x1', '0x2']]]) + assert.deepEqual(syncWithAddresses.args, [[['0x1', '0x2']]]) + assert.deepEqual(metamaskController.getState(), oldState) + }) + }) + }) function deferredPromise () { -- cgit v1.2.3 From 01c0c98501c02623b0cd650483d14c99566ce0af Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Wed, 18 Jul 2018 17:47:01 -0700 Subject: Add tabs support for PageContainer --- test/e2e/beta/metamask-beta-ui.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index dd327accb..40ef90506 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -665,7 +665,7 @@ describe('MetaMask', function () { }) it('picks the newly created Test token', async () => { - const addCustomToken = await findElement(driver, By.xpath("//div[contains(text(), 'Custom Token')]")) + const addCustomToken = await findElement(driver, By.xpath("//li[contains(text(), 'Custom Token')]")) await addCustomToken.click() await delay(regularDelayMs) -- cgit v1.2.3 From b23cca14699b6c6a8c843c9cc020ec96fe758822 Mon Sep 17 00:00:00 2001 From: Evgeniy Filatov Date: Sun, 19 Aug 2018 20:25:33 +0300 Subject: implemented improvements to RPC history --- test/e2e/beta/metamask-beta-ui.spec.js | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'test') diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index 40ef90506..bb562c83a 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -1011,4 +1011,64 @@ describe('MetaMask', function () { await delay(regularDelayMs) }) }) + + describe('Stores custom RPC history', () => { + const customRpcUrls = [ + 'https://mainnet.infura.io/1', + 'https://mainnet.infura.io/2', + 'https://mainnet.infura.io/3', + 'https://mainnet.infura.io/4', + ] + + customRpcUrls.forEach(customRpcUrl => { + it('creates custom RPC: ' + customRpcUrl, async () => { + const networkDropdown = await findElement(driver, By.css('.network-name')) + await networkDropdown.click() + await delay(regularDelayMs) + + const customRpcButton = await findElement(driver, By.xpath(`//span[contains(text(), 'Custom RPC')]`)) + await customRpcButton.click() + await delay(regularDelayMs) + + const customRpcInput = await findElement(driver, By.css('input[placeholder="New RPC URL"]')) + await customRpcInput.clear() + await customRpcInput.sendKeys(customRpcUrl) + + const customRpcSave = await findElement(driver, By.css('.settings__rpc-save-button')) + await customRpcSave.click() + await delay(largeDelayMs * 2) + }) + }) + + it('selects another provider', async () => { + const networkDropdown = await findElement(driver, By.css('.network-name')) + await networkDropdown.click() + await delay(regularDelayMs) + + const customRpcButton = await findElement(driver, By.xpath(`//span[contains(text(), 'Main Ethereum Network')]`)) + await customRpcButton.click() + await delay(largeDelayMs * 2) + }) + + it('finds 3 recent RPCs in history', async () => { + const networkDropdown = await findElement(driver, By.css('.network-name')) + await networkDropdown.click() + await delay(regularDelayMs) + + // oldest selected RPC is not found + await assertElementNotPresent(webdriver, driver, By.xpath(`//span[contains(text(), '${customRpcUrls[0]}')]`)) + + // only recent 3 are found and in correct order (most recent at the top) + const customRpcs = await findElements(driver, By.xpath(`//span[contains(text(), 'https://mainnet.infura.io/')]`)) + + assert.equal(customRpcs.length, 3) + + for (let i = 0; i < customRpcs.length; i++) { + const linkText = await customRpcs[i].getText() + const rpcUrl = customRpcUrls[customRpcUrls.length - i - 1] + + assert.notEqual(linkText.indexOf(rpcUrl), -1) + } + }) + }) }) \ No newline at end of file -- cgit v1.2.3 From 13c4ecd6101e57b9184b14f4e0136206843f51eb Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Fri, 3 Aug 2018 13:11:31 -0700 Subject: Fix tests --- test/e2e/beta/metamask-beta-ui.spec.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index bb562c83a..6bae5768b 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -414,12 +414,12 @@ describe('MetaMask', function () { }) it('finds the transaction in the transactions list', async function () { - const transactions = await findElements(driver, By.css('.tx-list-item')) + const transactions = await findElements(driver, By.css('.transaction-list-item')) assert.equal(transactions.length, 1) if (process.env.SELENIUM_BROWSER !== 'firefox') { - const txValues = await findElement(driver, By.css('.tx-list-value')) - await driver.wait(until.elementTextMatches(txValues, /1\sETH/), 10000) + const txValues = await findElement(driver, By.css('.transaction-list-item__amount--secondary')) + await driver.wait(until.elementTextMatches(txValues, /-1\sETH/), 10000) } }) }) @@ -457,14 +457,11 @@ describe('MetaMask', function () { }) it('finds the transaction in the transactions list', async function () { - const transactions = await findElements(driver, By.css('.tx-list-item')) + const transactions = await findElements(driver, By.css('.transaction-list-item')) assert.equal(transactions.length, 2) - const txStatuses = await findElements(driver, By.css('.tx-list-status')) - await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed/)) - - const txValues = await findElement(driver, By.css('.tx-list-value')) - await driver.wait(until.elementTextMatches(txValues, /3\sETH/), 10000) + const txValues = await findElement(driver, By.css('.transaction-list-item__amount--secondary')) + await driver.wait(until.elementTextMatches(txValues, /-3\sETH/), 10000) }) }) @@ -1071,4 +1068,4 @@ describe('MetaMask', function () { } }) }) -}) \ No newline at end of file +}) -- cgit v1.2.3 From c9ec5ed38d0e2475778ca6eb18d29b3389f67190 Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Mon, 6 Aug 2018 14:08:00 -0700 Subject: Fix e2e tests --- test/e2e/beta/metamask-beta-ui.spec.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index 6bae5768b..25e25dac4 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -587,7 +587,7 @@ describe('MetaMask', function () { await driver.switchTo().window(extension) await delay(regularDelayMs) - const txListItem = await findElement(driver, By.css('.tx-list-item')) + const txListItem = await findElement(driver, By.css('.transaction-list-item')) await txListItem.click() await delay(regularDelayMs) @@ -749,21 +749,21 @@ describe('MetaMask', function () { }) it('finds the transaction in the transactions list', async function () { - const transactions = await findElements(driver, By.css('.tx-list-item')) + const transactions = await findElements(driver, By.css('.transaction-list-item')) assert.equal(transactions.length, 1) - const txValues = await findElements(driver, By.css('.tx-list-value')) + const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary')) assert.equal(txValues.length, 1) // test cancelled on firefox until https://github.com/mozilla/geckodriver/issues/906 is resolved, // or possibly until we use latest version of firefox in the tests if (process.env.SELENIUM_BROWSER !== 'firefox') { - await driver.wait(until.elementTextMatches(txValues[0], /50\sTST/), 10000) + await driver.wait(until.elementTextMatches(txValues[0], /-50\sTST/), 10000) } - const txStatuses = await findElements(driver, By.css('.tx-list-status')) - const tx = await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed|Failed/), 10000) - assert.equal(await tx.getText(), 'Confirmed') + const txStatuses = await findElements(driver, By.css('.transaction-list-item__status')) + const tx = await driver.wait(until.elementTextMatches(txStatuses[0], /Outgoing|Failed/), 10000) + assert.equal(await tx.getText(), 'Outgoing') }) }) -- cgit v1.2.3 From 9adf0c4b60c863a820af7b20ff66a8b29f7bdbe7 Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Mon, 6 Aug 2018 22:39:54 -0700 Subject: Fix integration tests --- test/integration/lib/add-token.js | 4 ++-- test/integration/lib/confirm-sig-requests.js | 2 +- test/integration/lib/currency-localization.js | 6 +++--- test/integration/lib/send-new-ui.js | 2 +- test/integration/lib/tx-list-items.js | 25 +++++++++++-------------- 5 files changed, 18 insertions(+), 21 deletions(-) (limited to 'test') diff --git a/test/integration/lib/add-token.js b/test/integration/lib/add-token.js index 6de7574c4..6e85b3631 100644 --- a/test/integration/lib/add-token.js +++ b/test/integration/lib/add-token.js @@ -86,7 +86,7 @@ async function runAddTokenFlowTest (assert, done) { $('button.btn-primary.btn--large')[0].click() // 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(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() // 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.find('.identicon')[0], 'token added') } diff --git a/test/integration/lib/confirm-sig-requests.js b/test/integration/lib/confirm-sig-requests.js index dcc25c493..3539e97be 100644 --- a/test/integration/lib/confirm-sig-requests.js +++ b/test/integration/lib/confirm-sig-requests.js @@ -19,7 +19,7 @@ async function runConfirmSigRequestsTest (assert, done) { selectState.val('confirm sig requests') 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]) { pendingRequestItem[0].click() diff --git a/test/integration/lib/currency-localization.js b/test/integration/lib/currency-localization.js index d42b7495d..15dff1bfd 100644 --- a/test/integration/lib/currency-localization.js +++ b/test/integration/lib/currency-localization.js @@ -22,8 +22,8 @@ async function runCurrencyLocalizationTest (assert, done) { await timeout(1000) reactTriggerChange(selectState[0]) await timeout(1000) - const txView = await queryAsync($, '.tx-view') - const heroBalance = await findAsync($(txView), '.hero-balance') - const fiatAmount = await findAsync($(heroBalance), '.fiat-amount') + const txView = await queryAsync($, '.token-view') + const heroBalance = await findAsync($(txView), '.token-view-balance__balance') + const fiatAmount = await findAsync($(heroBalance), '.token-view-balance__secondary-balance') assert.equal(fiatAmount[0].textContent, '₱102,707.97') } diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js index cef1a32d7..177c9817d 100644 --- a/test/integration/lib/send-new-ui.js +++ b/test/integration/lib/send-new-ui.js @@ -58,7 +58,7 @@ async function runSendFlowTest (assert, done) { selectState.val('send new ui') 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') sendScreenButton[1].click() diff --git a/test/integration/lib/tx-list-items.js b/test/integration/lib/tx-list-items.js index 9075efe03..ca0dd76ab 100644 --- a/test/integration/lib/tx-list-items.js +++ b/test/integration/lib/tx-list-items.js @@ -29,37 +29,34 @@ async function runTxListItemsTest (assert, done) { assert.ok(metamaskLogo[0], 'metamask logo present') 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') - const unapprovedTx = txListItems[0] - assert.equal($(unapprovedTx).hasClass('tx-list-pending-item-container'), true, 'unapprovedTx has the correct class') - 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') const approvedTx = txListItems[2] - const approvedTxRenderedStatus = await findAsync($(approvedTx), '.tx-list-status') - assert.equal(approvedTxRenderedStatus[0].textContent, 'Approved', 'approvedTx has correct label') + const approvedTxRenderedStatus = await findAsync($(approvedTx), '.transaction-list-item__status') + assert.equal(approvedTxRenderedStatus[0].textContent, 'pending', 'approvedTx has correct label') 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') const failedTx = txListItems[4] - const failedTxRenderedStatus = await findAsync($(failedTx), '.tx-list-status') - assert.equal(failedTxRenderedStatus[0].textContent, 'Failed', 'failedTx has correct label') + const failedTxRenderedStatus = await findAsync($(failedTx), '.transaction-list-item__status') + assert.equal(failedTxRenderedStatus[0].textContent, 'failed', 'failedTx has correct label') const shapeShiftTx = txListItems[5] const shapeShiftTxStatus = await findAsync($(shapeShiftTx), '.flex-column div:eq(1)') assert.equal(shapeShiftTxStatus[0].textContent, 'No deposits received', 'shapeShiftTx has correct status') const confirmedTokenTx = txListItems[6] - const confirmedTokenTxAddress = await findAsync($(confirmedTokenTx), '.tx-list-account') - assert.equal(confirmedTokenTxAddress[0].textContent, '0xE7884118...81a9', 'confirmedTokenTx has correct address') + const confirmedTokenTxAddress = await findAsync($(confirmedTokenTx), '.transaction-list-item__status') + assert.equal(confirmedTokenTxAddress[0].textContent, 'confirmed', 'confirmedTokenTx has correct address') const rejectedTx = txListItems[7] - const rejectedTxRenderedStatus = await findAsync($(rejectedTx), '.tx-list-status') - assert.equal(rejectedTxRenderedStatus[0].textContent, 'Rejected', 'rejectedTx has correct label') + const rejectedTxRenderedStatus = await findAsync($(rejectedTx), '.transaction-list-item__status') + assert.equal(rejectedTxRenderedStatus[0].textContent, 'rejected', 'rejectedTx has correct label') } -- cgit v1.2.3 From 5dcd8ceb7bbaef33fef5588feceac17577679e74 Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Tue, 7 Aug 2018 01:57:46 -0700 Subject: Fix e2e tests --- test/e2e/beta/metamask-beta-ui.spec.js | 136 +++++++++++++++++++-------------- 1 file changed, 78 insertions(+), 58 deletions(-) (limited to 'test') diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index 25e25dac4..8ad24e5ea 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -225,19 +225,9 @@ describe('MetaMask', function () { await delay(regularDelayMs) } - await clickWordAndWait(words[0]) - await clickWordAndWait(words[1]) - await clickWordAndWait(words[2]) - await clickWordAndWait(words[3]) - await clickWordAndWait(words[4]) - await clickWordAndWait(words[5]) - await clickWordAndWait(words[6]) - await clickWordAndWait(words[7]) - await clickWordAndWait(words[8]) - await clickWordAndWait(words[9]) - await clickWordAndWait(words[10]) - await clickWordAndWait(words[11]) - + for (let i = 0; i < 12; i++) { + await clickWordAndWait(words[i]) + } } catch (e) { if (count > 2) { throw e @@ -484,7 +474,7 @@ describe('MetaMask', function () { await driver.switchTo().window(extension) await delay(regularDelayMs) - const txListItem = await findElement(driver, By.xpath(`//span[contains(text(), 'Contract Deployment')]`)) + const txListItem = await findElement(driver, By.xpath(`//div[contains(text(), 'Contract Deployment')]`)) await txListItem.click() await delay(regularDelayMs) }) @@ -508,13 +498,15 @@ describe('MetaMask', function () { it('confirms a deploy contract transaction', async () => { const confirmButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`)) await confirmButton.click() - await delay(regularDelayMs) + await delay(largeDelayMs) - const txStatuses = await findElements(driver, By.css('.tx-list-status')) - await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed/)) + driver.wait(async () => { + const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) + return confirmedTxes.length === 3 + }, 10000) - const txAccounts = await findElements(driver, By.css('.tx-list-account')) - assert.equal(await txAccounts[0].getText(), 'Contract Deployment') + const txAction = await findElements(driver, By.css('.transaction-list-item__action')) + await driver.wait(until.elementTextMatches(txAction[0], /Contract\sDeployment/), 10000) await delay(regularDelayMs) }) @@ -535,9 +527,9 @@ describe('MetaMask', function () { await driver.switchTo().window(extension) await delay(largeDelayMs) - await findElements(driver, By.css('.tx-list-pending-item-container')) - const [txListValue] = await findElements(driver, By.css('.tx-list-value')) - await driver.wait(until.elementTextMatches(txListValue, /4\sETH/), 10000) + await findElements(driver, By.css('.transaction-list-item')) + const [txListValue] = await findElements(driver, By.css('.transaction-list-item__amount--secondary')) + await driver.wait(until.elementTextMatches(txListValue, /-4\sETH/), 10000) await txListValue.click() await delay(regularDelayMs) @@ -565,15 +557,20 @@ describe('MetaMask', function () { await confirmButton.click() await delay(regularDelayMs) - const txStatuses = await findElements(driver, By.css('.tx-list-status')) - await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed/)) + // const txStatuses = await findElements(driver, By.css('.transaction-list-item__status')) + // await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed/)) + let confirmedTxes + driver.wait(async () => { + confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) + return confirmedTxes.length === 4 + }, 10000) - const txValues = await findElement(driver, By.css('.tx-list-value')) - await driver.wait(until.elementTextMatches(txValues, /4\sETH/), 10000) + const txValues = await findElement(driver, By.css('.transaction-list-item__amount--secondary')) + await driver.wait(until.elementTextMatches(txValues, /-4\sETH/), 10000) - const txAccounts = await findElements(driver, By.css('.tx-list-account')) - const firstTxAddress = await txAccounts[0].getText() - assert(firstTxAddress.match(/^0x\w{8}\.{3}\w{4}$/)) + // const txAccounts = await findElements(driver, By.css('.tx-list-account')) + // const firstTxAddress = await txAccounts[0].getText() + // assert(firstTxAddress.match(/^0x\w{8}\.{3}\w{4}$/)) }) it('calls and confirms a contract method where ETH is received', async () => { @@ -595,18 +592,23 @@ describe('MetaMask', function () { await confirmButton.click() await delay(regularDelayMs) - const txStatuses = await findElements(driver, By.css('.tx-list-status')) - await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed/)) + // const txStatuses = await findElements(driver, By.css('.tx-list-status')) + // await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed/)) + let confirmedTxes + driver.wait(async () => { + confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) + return confirmedTxes.length === 5 + }, 10000) - const txValues = await findElement(driver, By.css('.tx-list-value')) - await driver.wait(until.elementTextMatches(txValues, /0\sETH/), 10000) + const txValues = await findElement(driver, By.css('.transaction-list-item__amount--secondary')) + await driver.wait(until.elementTextMatches(txValues, /-0\sETH/), 10000) await closeAllWindowHandlesExcept(driver, [extension, dapp]) await driver.switchTo().window(extension) }) it('renders the correct ETH balance', async () => { - const balance = await findElement(driver, By.css('.tx-view .balance-display .token-amount')) + const balance = await findElement(driver, By.css('.token-view-balance__primary-balance')) await delay(regularDelayMs) if (process.env.SELENIUM_BROWSER !== 'firefox') { await driver.wait(until.elementTextMatches(balance, /^92.*ETH.*$/), 10000) @@ -651,12 +653,11 @@ describe('MetaMask', function () { await closeAllWindowHandlesExcept(driver, [extension, dapp]) await delay(regularDelayMs) await driver.switchTo().window(extension) - await delay(regularDelayMs) - + await delay(largeDelayMs) }) it('clicks on the Add Token button', async () => { - const addToken = await findElement(driver, By.xpath(`//button[contains(text(), 'Add Token')]`)) + const addToken = await driver.findElement(By.css('.wallet-view__add-token-button')) await addToken.click() await delay(regularDelayMs) }) @@ -680,7 +681,7 @@ describe('MetaMask', function () { }) it('renders the balance for the new token', async () => { - const balance = await findElement(driver, By.css('.tx-view .balance-display .token-amount')) + const balance = await findElement(driver, By.css('.token-view-balance .token-view-balance__token-balance')) await driver.wait(until.elementTextMatches(balance, /^100\s*TST\s*$/)) const tokenAmount = await balance.getText() assert.ok(/^100\s*TST\s*$/.test(tokenAmount)) @@ -761,7 +762,11 @@ describe('MetaMask', function () { await driver.wait(until.elementTextMatches(txValues[0], /-50\sTST/), 10000) } - const txStatuses = await findElements(driver, By.css('.transaction-list-item__status')) + driver.wait(async () => { + const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) + return confirmedTxes.length === 1 + }, 10000) + const txStatuses = await findElements(driver, By.css('.transaction-list-item__action')) const tx = await driver.wait(until.elementTextMatches(txStatuses[0], /Outgoing|Failed/), 10000) assert.equal(await tx.getText(), 'Outgoing') }) @@ -786,9 +791,9 @@ describe('MetaMask', function () { await driver.switchTo().window(extension) await delay(largeDelayMs) - await findElements(driver, By.css('.tx-list-pending-item-container')) - const [txListValue] = await findElements(driver, By.css('.tx-list-value')) - await driver.wait(until.elementTextMatches(txListValue, /7\sTST/), 10000) + await findElements(driver, By.css('.transaction-list__pending-transactions')) + const [txListValue] = await findElements(driver, By.css('.transaction-list-item__amount--primary')) + await driver.wait(until.elementTextMatches(txListValue, /-7\sTST/), 10000) await txListValue.click() await delay(regularDelayMs) @@ -835,25 +840,30 @@ describe('MetaMask', function () { }) it('finds the transaction in the transactions list', async function () { - const transactions = await findElements(driver, By.css('.tx-list-item')) - assert.equal(transactions.length, 2) + driver.wait(async () => { + const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) + return confirmedTxes.length === 2 + }, 10000) + // const transactions = await findElements(driver, By.css('.transaction-list-item')) + // assert.equal(transactions.length, 2) - const txValues = await findElements(driver, By.css('.tx-list-value')) - await driver.wait(until.elementTextMatches(txValues[0], /7\sTST/)) - const txStatuses = await findElements(driver, By.css('.tx-list-status')) - await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed/)) + const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary')) + await driver.wait(until.elementTextMatches(txValues[0], /-7\sTST/)) + const txStatuses = await findElements(driver, By.css('.transaction-list-item__action')) + await driver.wait(until.elementTextMatches(txStatuses[0], /Outgoing/)) const walletBalance = await findElement(driver, By.css('.wallet-balance')) await walletBalance.click() const tokenListItems = await findElements(driver, By.css('.token-list-item')) await tokenListItems[0].click() + await delay(regularDelayMs) // test cancelled on firefox until https://github.com/mozilla/geckodriver/issues/906 is resolved, // or possibly until we use latest version of firefox in the tests if (process.env.SELENIUM_BROWSER !== 'firefox') { - const tokenBalanceAmount = await findElement(driver, By.css('.token-balance__amount')) - assert.equal(await tokenBalanceAmount.getText(), '43') + const tokenBalanceAmount = await findElement(driver, By.css('.token-view-balance__token-balance')) + assert.equal(await tokenBalanceAmount.getText(), '43 TST') } }) }) @@ -877,9 +887,14 @@ describe('MetaMask', function () { await driver.switchTo().window(extension) await delay(regularDelayMs) - const [txListItem] = await findElements(driver, By.css('.tx-list-item')) - const [txListValue] = await findElements(driver, By.css('.tx-list-value')) - await driver.wait(until.elementTextMatches(txListValue, /0\sETH/)) + driver.wait(async () => { + const pendingTxes = await findElements(driver, By.css('.transaction-list__pending-transactions .transaction-list-item')) + return pendingTxes.length === 1 + }, 10000) + + const [txListItem] = await findElements(driver, By.css('.transaction-list-item')) + const [txListValue] = await findElements(driver, By.css('.transaction-list-item__amount--primary')) + await driver.wait(until.elementTextMatches(txListValue, /-7\sTST/)) await txListItem.click() await delay(regularDelayMs) }) @@ -950,10 +965,15 @@ describe('MetaMask', function () { }) it('finds the transaction in the transactions list', async function () { - const txValues = await findElements(driver, By.css('.tx-list-value')) - await driver.wait(until.elementTextMatches(txValues[0], /0\sETH/)) - const txStatuses = await findElements(driver, By.css('.tx-list-status')) - await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed/)) + driver.wait(async () => { + const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) + return confirmedTxes.length === 3 + }, 10000) + + const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary')) + await driver.wait(until.elementTextMatches(txValues[0], /-7\sTST/)) + const txStatuses = await findElements(driver, By.css('.transaction-list-item__action')) + await driver.wait(until.elementTextMatches(txStatuses[0], /Approve/)) }) }) @@ -1003,7 +1023,7 @@ describe('MetaMask', function () { }) it('renders the balance for the chosen token', async () => { - const balance = await findElement(driver, By.css('.tx-view .balance-display .token-amount')) + const balance = await findElement(driver, By.css('.balance-display .token-amount')) await driver.wait(until.elementTextMatches(balance, /0\sBAT/)) await delay(regularDelayMs) }) -- cgit v1.2.3 From a430eed2d89bcadc93bad84859581fb4184ac0f7 Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Sun, 12 Aug 2018 11:22:43 -0500 Subject: Fix integration tests --- test/integration/lib/tx-list-items.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/lib/tx-list-items.js b/test/integration/lib/tx-list-items.js index ca0dd76ab..732e14577 100644 --- a/test/integration/lib/tx-list-items.js +++ b/test/integration/lib/tx-list-items.js @@ -16,7 +16,7 @@ QUnit.test('renders list items successfully', (assert) => { global.ethQuery = global.ethQuery || {} global.ethQuery.getTransactionCount = (_, cb) => { - cb(null, '0x3') + cb(null, '0x0') } async function runTxListItemsTest (assert, done) { -- cgit v1.2.3 From 6670bc0e09dacaf9a91031a348d1a551ed1e3987 Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Wed, 15 Aug 2018 08:00:55 -0700 Subject: Fix e2e tests --- test/e2e/beta/from-import-beta-ui.spec.js | 6 +++--- test/e2e/beta/metamask-beta-ui.spec.js | 14 +++----------- 2 files changed, 6 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/e2e/beta/from-import-beta-ui.spec.js b/test/e2e/beta/from-import-beta-ui.spec.js index 1261b6f95..f8a904263 100644 --- a/test/e2e/beta/from-import-beta-ui.spec.js +++ b/test/e2e/beta/from-import-beta-ui.spec.js @@ -314,12 +314,12 @@ describe('Using MetaMask with an existing account', function () { }) it('finds the transaction in the transactions list', async function () { - const transactions = await findElements(driver, By.css('.tx-list-item')) + const transactions = await findElements(driver, By.css('.transaction-list-item')) assert.equal(transactions.length, 1) - const txValues = await findElements(driver, By.css('.tx-list-value')) + const txValues = await findElements(driver, By.css('.transaction-list-item__amount--secondary')) assert.equal(txValues.length, 1) - assert.equal(await txValues[0].getText(), '1 ETH') + assert.equal(await txValues[0].getText(), '-1 ETH') }) }) diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index 8ad24e5ea..6a2fb0186 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -557,11 +557,8 @@ describe('MetaMask', function () { await confirmButton.click() await delay(regularDelayMs) - // const txStatuses = await findElements(driver, By.css('.transaction-list-item__status')) - // await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed/)) - let confirmedTxes driver.wait(async () => { - confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) + const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) return confirmedTxes.length === 4 }, 10000) @@ -592,11 +589,8 @@ describe('MetaMask', function () { await confirmButton.click() await delay(regularDelayMs) - // const txStatuses = await findElements(driver, By.css('.tx-list-status')) - // await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed/)) - let confirmedTxes driver.wait(async () => { - confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) + const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) return confirmedTxes.length === 5 }, 10000) @@ -844,8 +838,6 @@ describe('MetaMask', function () { const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) return confirmedTxes.length === 2 }, 10000) - // const transactions = await findElements(driver, By.css('.transaction-list-item')) - // assert.equal(transactions.length, 2) const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary')) await driver.wait(until.elementTextMatches(txValues[0], /-7\sTST/)) @@ -1023,7 +1015,7 @@ describe('MetaMask', function () { }) it('renders the balance for the chosen token', async () => { - const balance = await findElement(driver, By.css('.balance-display .token-amount')) + const balance = await findElement(driver, By.css('.token-view-balance__token-balance')) await driver.wait(until.elementTextMatches(balance, /0\sBAT/)) await delay(regularDelayMs) }) -- cgit v1.2.3 From 62e2d5e01ce950e356c2438e112a1291df3b7039 Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Wed, 15 Aug 2018 20:16:10 -0700 Subject: Fix integration tests --- test/integration/lib/currency-localization.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/lib/currency-localization.js b/test/integration/lib/currency-localization.js index 15dff1bfd..eee354276 100644 --- a/test/integration/lib/currency-localization.js +++ b/test/integration/lib/currency-localization.js @@ -25,5 +25,5 @@ async function runCurrencyLocalizationTest (assert, done) { const txView = await queryAsync($, '.token-view') const heroBalance = await findAsync($(txView), '.token-view-balance__balance') 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 PHP') } -- cgit v1.2.3 From c06a0be486a6a484929cd3f43fb766f5848ce9db Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Thu, 16 Aug 2018 11:06:53 -0700 Subject: Fix Firefox e2e tests --- test/e2e/beta/metamask-beta-ui.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index 6a2fb0186..60ab115a0 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -562,8 +562,8 @@ describe('MetaMask', function () { return confirmedTxes.length === 4 }, 10000) - const txValues = await findElement(driver, By.css('.transaction-list-item__amount--secondary')) - await driver.wait(until.elementTextMatches(txValues, /-4\sETH/), 10000) + const txValues = await findElements(driver, By.css('.transaction-list-item__amount--secondary')) + await driver.wait(until.elementTextMatches(txValues[0], /-4\sETH/), 10000) // const txAccounts = await findElements(driver, By.css('.tx-list-account')) // const firstTxAddress = await txAccounts[0].getText() -- cgit v1.2.3 From eb17151ff4c668ff1a99bad696cd379ffc3d8f24 Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Thu, 16 Aug 2018 12:46:40 -0700 Subject: Change "Outgoing" to "Sent Ether" or "Sent Token" --- test/e2e/beta/metamask-beta-ui.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index 60ab115a0..eede90ecd 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -560,7 +560,7 @@ describe('MetaMask', function () { driver.wait(async () => { const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) return confirmedTxes.length === 4 - }, 10000) + }, 15000) const txValues = await findElements(driver, By.css('.transaction-list-item__amount--secondary')) await driver.wait(until.elementTextMatches(txValues[0], /-4\sETH/), 10000) @@ -761,8 +761,8 @@ describe('MetaMask', function () { return confirmedTxes.length === 1 }, 10000) const txStatuses = await findElements(driver, By.css('.transaction-list-item__action')) - const tx = await driver.wait(until.elementTextMatches(txStatuses[0], /Outgoing|Failed/), 10000) - assert.equal(await tx.getText(), 'Outgoing') + const tx = await driver.wait(until.elementTextMatches(txStatuses[0], /Sent\sToken|Failed/), 10000) + assert.equal(await tx.getText(), 'Sent Tokens') }) }) @@ -842,7 +842,7 @@ describe('MetaMask', function () { const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary')) await driver.wait(until.elementTextMatches(txValues[0], /-7\sTST/)) const txStatuses = await findElements(driver, By.css('.transaction-list-item__action')) - await driver.wait(until.elementTextMatches(txStatuses[0], /Outgoing/)) + await driver.wait(until.elementTextMatches(txStatuses[0], /Sent\sToken/)) const walletBalance = await findElement(driver, By.css('.wallet-balance')) await walletBalance.click() -- cgit v1.2.3 From bdfd54ec54e737adface6943d3edb03ce8fae9c2 Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Thu, 16 Aug 2018 18:53:54 -0700 Subject: Increase e2e timeouts for firefox --- test/e2e/beta/metamask-beta-ui.spec.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index eede90ecd..7f0391d33 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -476,7 +476,7 @@ describe('MetaMask', function () { const txListItem = await findElement(driver, By.xpath(`//div[contains(text(), 'Contract Deployment')]`)) await txListItem.click() - await delay(regularDelayMs) + await delay(largeDelayMs) }) it('displays the contract creation data', async () => { @@ -503,7 +503,7 @@ describe('MetaMask', function () { driver.wait(async () => { const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) return confirmedTxes.length === 3 - }, 10000) + }, 200000) const txAction = await findElements(driver, By.css('.transaction-list-item__action')) await driver.wait(until.elementTextMatches(txAction[0], /Contract\sDeployment/), 10000) @@ -560,7 +560,7 @@ describe('MetaMask', function () { driver.wait(async () => { const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) return confirmedTxes.length === 4 - }, 15000) + }, 200000) const txValues = await findElements(driver, By.css('.transaction-list-item__amount--secondary')) await driver.wait(until.elementTextMatches(txValues[0], /-4\sETH/), 10000) @@ -592,7 +592,7 @@ describe('MetaMask', function () { driver.wait(async () => { const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) return confirmedTxes.length === 5 - }, 10000) + }, 200000) const txValues = await findElement(driver, By.css('.transaction-list-item__amount--secondary')) await driver.wait(until.elementTextMatches(txValues, /-0\sETH/), 10000) @@ -759,7 +759,7 @@ describe('MetaMask', function () { driver.wait(async () => { const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) return confirmedTxes.length === 1 - }, 10000) + }, 200000) const txStatuses = await findElements(driver, By.css('.transaction-list-item__action')) const tx = await driver.wait(until.elementTextMatches(txStatuses[0], /Sent\sToken|Failed/), 10000) assert.equal(await tx.getText(), 'Sent Tokens') @@ -837,7 +837,7 @@ describe('MetaMask', function () { driver.wait(async () => { const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) return confirmedTxes.length === 2 - }, 10000) + }, 200000) const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary')) await driver.wait(until.elementTextMatches(txValues[0], /-7\sTST/)) @@ -960,7 +960,7 @@ describe('MetaMask', function () { driver.wait(async () => { const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) return confirmedTxes.length === 3 - }, 10000) + }, 200000) const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary')) await driver.wait(until.elementTextMatches(txValues[0], /-7\sTST/)) -- cgit v1.2.3 From 2d76ee754b1dd2473d744ce2dba2a3501c9a149c Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Wed, 22 Aug 2018 20:17:37 -0700 Subject: Reduce large timeouts --- test/e2e/beta/metamask-beta-ui.spec.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index 7f0391d33..d427318ce 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -503,7 +503,7 @@ describe('MetaMask', function () { driver.wait(async () => { const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) return confirmedTxes.length === 3 - }, 200000) + }, 10000) const txAction = await findElements(driver, By.css('.transaction-list-item__action')) await driver.wait(until.elementTextMatches(txAction[0], /Contract\sDeployment/), 10000) @@ -560,7 +560,7 @@ describe('MetaMask', function () { driver.wait(async () => { const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) return confirmedTxes.length === 4 - }, 200000) + }, 10000) const txValues = await findElements(driver, By.css('.transaction-list-item__amount--secondary')) await driver.wait(until.elementTextMatches(txValues[0], /-4\sETH/), 10000) @@ -592,7 +592,7 @@ describe('MetaMask', function () { driver.wait(async () => { const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) return confirmedTxes.length === 5 - }, 200000) + }, 10000) const txValues = await findElement(driver, By.css('.transaction-list-item__amount--secondary')) await driver.wait(until.elementTextMatches(txValues, /-0\sETH/), 10000) @@ -759,7 +759,7 @@ describe('MetaMask', function () { driver.wait(async () => { const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) return confirmedTxes.length === 1 - }, 200000) + }, 10000) const txStatuses = await findElements(driver, By.css('.transaction-list-item__action')) const tx = await driver.wait(until.elementTextMatches(txStatuses[0], /Sent\sToken|Failed/), 10000) assert.equal(await tx.getText(), 'Sent Tokens') @@ -837,7 +837,7 @@ describe('MetaMask', function () { driver.wait(async () => { const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) return confirmedTxes.length === 2 - }, 200000) + }, 10000) const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary')) await driver.wait(until.elementTextMatches(txValues[0], /-7\sTST/)) @@ -960,7 +960,7 @@ describe('MetaMask', function () { driver.wait(async () => { const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item')) return confirmedTxes.length === 3 - }, 200000) + }, 10000) const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary')) await driver.wait(until.elementTextMatches(txValues[0], /-7\sTST/)) -- cgit v1.2.3 From c0e97d17393c9ce5024af8626c1bafc5d5b4efe4 Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Thu, 23 Aug 2018 19:19:48 -0700 Subject: Fix tests --- test/e2e/beta/metamask-beta-ui.spec.js | 8 ++++---- test/integration/lib/add-token.js | 4 ++-- test/integration/lib/currency-localization.js | 6 +++--- test/integration/lib/send-new-ui.js | 2 +- test/integration/lib/tx-list-items.js | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index d427318ce..c9f759780 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -602,7 +602,7 @@ describe('MetaMask', function () { }) it('renders the correct ETH balance', async () => { - const balance = await findElement(driver, By.css('.token-view-balance__primary-balance')) + const balance = await findElement(driver, By.css('.transaction-view-balance__primary-balance')) await delay(regularDelayMs) if (process.env.SELENIUM_BROWSER !== 'firefox') { await driver.wait(until.elementTextMatches(balance, /^92.*ETH.*$/), 10000) @@ -675,7 +675,7 @@ describe('MetaMask', function () { }) it('renders the balance for the new token', async () => { - const balance = await findElement(driver, By.css('.token-view-balance .token-view-balance__token-balance')) + const balance = await findElement(driver, By.css('.transaction-view-balance .transaction-view-balance__token-balance')) await driver.wait(until.elementTextMatches(balance, /^100\s*TST\s*$/)) const tokenAmount = await balance.getText() assert.ok(/^100\s*TST\s*$/.test(tokenAmount)) @@ -854,7 +854,7 @@ describe('MetaMask', function () { // test cancelled on firefox until https://github.com/mozilla/geckodriver/issues/906 is resolved, // or possibly until we use latest version of firefox in the tests if (process.env.SELENIUM_BROWSER !== 'firefox') { - const tokenBalanceAmount = await findElement(driver, By.css('.token-view-balance__token-balance')) + const tokenBalanceAmount = await findElement(driver, By.css('.transaction-view-balance__token-balance')) assert.equal(await tokenBalanceAmount.getText(), '43 TST') } }) @@ -1015,7 +1015,7 @@ describe('MetaMask', function () { }) it('renders the balance for the chosen token', async () => { - const balance = await findElement(driver, By.css('.token-view-balance__token-balance')) + const balance = await findElement(driver, By.css('.transaction-view-balance__token-balance')) await driver.wait(until.elementTextMatches(balance, /0\sBAT/)) await delay(regularDelayMs) }) diff --git a/test/integration/lib/add-token.js b/test/integration/lib/add-token.js index 6e85b3631..bb9d0d10f 100644 --- a/test/integration/lib/add-token.js +++ b/test/integration/lib/add-token.js @@ -86,7 +86,7 @@ async function runAddTokenFlowTest (assert, done) { $('button.btn-primary.btn--large')[0].click() // Verify added token image - let heroBalance = await queryAsync($, '.token-view-balance__balance-container') + let heroBalance = await queryAsync($, '.transaction-view-balance__balance-container') assert.ok(heroBalance, 'rendered hero balance') 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() // Verify added token image - heroBalance = await queryAsync($, '.token-view-balance__balance-container') + heroBalance = await queryAsync($, '.transaction-view-balance__balance-container') assert.ok(heroBalance, 'rendered hero balance') assert.ok(heroBalance.find('.identicon')[0], 'token added') } diff --git a/test/integration/lib/currency-localization.js b/test/integration/lib/currency-localization.js index eee354276..8d5acf5d0 100644 --- a/test/integration/lib/currency-localization.js +++ b/test/integration/lib/currency-localization.js @@ -22,8 +22,8 @@ async function runCurrencyLocalizationTest (assert, done) { await timeout(1000) reactTriggerChange(selectState[0]) await timeout(1000) - const txView = await queryAsync($, '.token-view') - const heroBalance = await findAsync($(txView), '.token-view-balance__balance') - const fiatAmount = await findAsync($(heroBalance), '.token-view-balance__secondary-balance') + const txView = await queryAsync($, '.transaction-view') + const heroBalance = await findAsync($(txView), '.transaction-view-balance__balance') + const fiatAmount = await findAsync($(heroBalance), '.transaction-view-balance__secondary-balance') assert.equal(fiatAmount[0].textContent, '₱102,707.97 PHP') } diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js index 177c9817d..7f3c114e4 100644 --- a/test/integration/lib/send-new-ui.js +++ b/test/integration/lib/send-new-ui.js @@ -58,7 +58,7 @@ async function runSendFlowTest (assert, done) { selectState.val('send new ui') reactTriggerChange(selectState[0]) - const sendScreenButton = await queryAsync($, 'button.btn-primary.token-view-balance__button') + const sendScreenButton = await queryAsync($, 'button.btn-primary.transaction-view-balance__button') assert.ok(sendScreenButton[1], 'send screen button present') sendScreenButton[1].click() diff --git a/test/integration/lib/tx-list-items.js b/test/integration/lib/tx-list-items.js index 732e14577..a29a668ca 100644 --- a/test/integration/lib/tx-list-items.js +++ b/test/integration/lib/tx-list-items.js @@ -46,7 +46,7 @@ async function runTxListItemsTest (assert, done) { const failedTx = txListItems[4] 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 shapeShiftTxStatus = await findAsync($(shapeShiftTx), '.flex-column div:eq(1)') @@ -54,9 +54,9 @@ async function runTxListItemsTest (assert, done) { const confirmedTokenTx = txListItems[6] const confirmedTokenTxAddress = await findAsync($(confirmedTokenTx), '.transaction-list-item__status') - assert.equal(confirmedTokenTxAddress[0].textContent, 'confirmed', 'confirmedTokenTx has correct address') + assert.equal(confirmedTokenTxAddress[0].textContent, 'Confirmed', 'confirmedTokenTx has correct address') const rejectedTx = txListItems[7] 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') } -- cgit v1.2.3 From 952edf695c167385e9d864c45bd889219c456e78 Mon Sep 17 00:00:00 2001 From: Dan Miller Date: Mon, 27 Aug 2018 17:07:01 -0230 Subject: Revert changes to tx-list-items.json, and to mock getTransactionCount method in tx-list-items integration test. --- test/integration/lib/tx-list-items.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/lib/tx-list-items.js b/test/integration/lib/tx-list-items.js index a29a668ca..7572d1629 100644 --- a/test/integration/lib/tx-list-items.js +++ b/test/integration/lib/tx-list-items.js @@ -16,7 +16,7 @@ QUnit.test('renders list items successfully', (assert) => { global.ethQuery = global.ethQuery || {} global.ethQuery.getTransactionCount = (_, cb) => { - cb(null, '0x0') + cb(null, '0x3') } async function runTxListItemsTest (assert, done) { -- cgit v1.2.3