From 01908dac33f296e6fae5a42f6fc7b9cb121bdd6d Mon Sep 17 00:00:00 2001 From: dennistikhomirov Date: Fri, 14 Sep 2018 09:24:45 -0700 Subject: [PATCH 1/7] e2e:add dom elements for add tokens feature --- test/e2e/elements.js | 28 +++++++++++++++++++++++----- test/e2e/metamask.spec.js | 34 ++++++++++++++++++++++------------ 2 files changed, 45 insertions(+), 17 deletions(-) diff --git a/test/e2e/elements.js b/test/e2e/elements.js index b443e46ca925..d5fea94627ea 100644 --- a/test/e2e/elements.js +++ b/test/e2e/elements.js @@ -56,12 +56,30 @@ module.exports = { addToken: { title: By.className('page-subtitle'), titleText: 'Add Token', - fields: { - contractAddress: By.id('token-address'), - tokenSymbol: By.id('token_symbol'), - decimals: By.id('token_decimals'), + tab:{ + custom:By.className('inactiveForm pointer'), + search:By.className('inactiveForm pointer') + }, + search: { + fieldSearch: By.id('search-tokens'), + results: By.className('token-list__token-data'), + buttons: { + next: By.css('#app-content > div > div.app-primary.from-right > div > div:nth-child(3) > div.page-container__footer > div > button:nth-child(2)'), + cancel: By.className('btn-violet') + } }, - buttonAdd: By.css('.flex-space-around > button:nth-child(7)'), + custom: + { + fields: { + contractAddress: By.id('token-address'), + tokenSymbol: By.id('token_symbol'), + decimals: By.id('token_decimals'), + }, + buttons: { + add: By.css('#app-content > div > div.app-primary.from-right > div > div.flex-column.flex-justify-center.flex-grow.select-none > div > div:nth-child(7) > button:nth-child(2)'), + cancel: By.className('btn-violet') + }, + }, }, deleteCustomRPC: { diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js index 83a8c06baa2d..0df7f6fac91d 100644 --- a/test/e2e/metamask.spec.js +++ b/test/e2e/metamask.spec.js @@ -50,7 +50,7 @@ describe('Metamask popup page', async function () { }) after(async function () { - await driver.quit() + //await driver.quit() }) describe('Setup', async function () { @@ -231,7 +231,7 @@ describe('Metamask popup page', async function () { }) }) - describe('Export private key', async () => { + describe.skip('Export private key', async () => { it('open dialog', async function () { await driver.navigate().refresh() @@ -304,7 +304,7 @@ describe('Metamask popup page', async function () { }) }) - describe('Change password', async () => { + describe.skip('Change password', async () => { const newPassword = { correct: 'abcDEF123!@#', short: '123', @@ -315,7 +315,7 @@ describe('Metamask popup page', async function () { let fieldOldPassword let buttonYes - describe('Check screen "Settings" -> "Change password" ', async () => { + describe.skip('Check screen "Settings" -> "Change password" ', async () => { it('checks if current network name (localhost) is correct', async () => { const menu = await waitUntilShowUp(menus.sandwich.menu, 300) @@ -478,7 +478,7 @@ describe('Metamask popup page', async function () { }) }) - describe('Import Account', () => { + describe.skip('Import Account', () => { it('opens import account menu', async function () { const menu = await waitUntilShowUp(menus.account.menu) @@ -571,7 +571,7 @@ describe('Metamask popup page', async function () { await click(field) }) - it('balance renders', async function () { + it.skip('balance renders', async function () { const balance = await waitUntilShowUp(screens.main.balance) assert.equal(await balance.getText(), '100.000') }) @@ -674,14 +674,18 @@ describe('Metamask popup page', async function () { }) it('checks add token screen has correct title', async function () { - const addTokenScreen = await waitUntilShowUp(By.className('page-subtitle')) + const addTokenScreen = await waitUntilShowUp(screens.addToken.title) assert.equal(await addTokenScreen.getText(), screens.addToken.titleText) }) it('adds token parameters', async function () { - const tokenContractAddress = await waitUntilShowUp(screens.addToken.fields.contractAddress) + const tab = await waitUntilShowUp(screens.addToken.tab.custom) + await tab.click() + console.log(1) + const tokenContractAddress = await waitUntilShowUp(screens.addToken.custom.fields.contractAddress) await tokenContractAddress.sendKeys(tokenAddress) - const button = await waitUntilShowUp(screens.addToken.buttonAdd) + console.log(2) + const button = await waitUntilShowUp(screens.addToken.custom.buttons.add) await click(button) }) @@ -1079,7 +1083,7 @@ describe('Metamask popup page', async function () { } async function waitUntilShowUp (by, Twait) { - if (Twait === undefined) Twait = 2000 + if (Twait === undefined) Twait = 20 do { await delay(100) if (await isElementDisplayed(by)) return await driver.findElement(by) @@ -1117,11 +1121,17 @@ describe('Metamask popup page', async function () { try { const button = await waitUntilShowUp(screens.main.tokens.buttonAdd, 300) await click(button) - const field = await waitUntilShowUp(screens.addToken.fields.contractAddress) + //await delay(2000) + do { + const tab = await waitUntilShowUp(screens.addToken.tab.custom) + await tab.click() + } + while( await waitUntilShowUp(screens.addToken.custom.fields.contractAddress) === false) + const field = await waitUntilShowUp(screens.addToken.custom.fields.contractAddress) await clearField(field) await field.sendKeys(tokenAddress) - const buttonAdd = await waitUntilShowUp(screens.addToken.buttonAdd) + const buttonAdd = await waitUntilShowUp(screens.addToken.custom.buttons.add) await click(buttonAdd) return true } catch (err) { From b183835cc43fd5db0cdc8fbb17c1e4615c91cc27 Mon Sep 17 00:00:00 2001 From: dennistikhomirov Date: Fri, 14 Sep 2018 09:39:18 -0700 Subject: [PATCH 2/7] e2e:remove debug skips --- test/e2e/metamask.spec.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js index 0df7f6fac91d..a4f42070ac71 100644 --- a/test/e2e/metamask.spec.js +++ b/test/e2e/metamask.spec.js @@ -231,7 +231,7 @@ describe('Metamask popup page', async function () { }) }) - describe.skip('Export private key', async () => { + describe('Export private key', async () => { it('open dialog', async function () { await driver.navigate().refresh() @@ -304,7 +304,7 @@ describe('Metamask popup page', async function () { }) }) - describe.skip('Change password', async () => { + describe('Change password', async () => { const newPassword = { correct: 'abcDEF123!@#', short: '123', @@ -315,7 +315,7 @@ describe('Metamask popup page', async function () { let fieldOldPassword let buttonYes - describe.skip('Check screen "Settings" -> "Change password" ', async () => { + describe('Check screen "Settings" -> "Change password" ', async () => { it('checks if current network name (localhost) is correct', async () => { const menu = await waitUntilShowUp(menus.sandwich.menu, 300) @@ -478,7 +478,7 @@ describe('Metamask popup page', async function () { }) }) - describe.skip('Import Account', () => { + describe('Import Account', () => { it('opens import account menu', async function () { const menu = await waitUntilShowUp(menus.account.menu) @@ -571,7 +571,7 @@ describe('Metamask popup page', async function () { await click(field) }) - it.skip('balance renders', async function () { + it('balance renders', async function () { const balance = await waitUntilShowUp(screens.main.balance) assert.equal(await balance.getText(), '100.000') }) From 9927d2030251e90c8c3378724e221be0e6ac485d Mon Sep 17 00:00:00 2001 From: dennistikhomirov Date: Fri, 14 Sep 2018 09:41:16 -0700 Subject: [PATCH 3/7] lint fix --- test/e2e/elements.js | 12 ++++++------ test/e2e/metamask.spec.js | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/e2e/elements.js b/test/e2e/elements.js index d5fea94627ea..35174f329f69 100644 --- a/test/e2e/elements.js +++ b/test/e2e/elements.js @@ -56,17 +56,17 @@ module.exports = { addToken: { title: By.className('page-subtitle'), titleText: 'Add Token', - tab:{ - custom:By.className('inactiveForm pointer'), - search:By.className('inactiveForm pointer') + tab: { + custom: By.className('inactiveForm pointer'), + search: By.className('inactiveForm pointer'), }, search: { fieldSearch: By.id('search-tokens'), results: By.className('token-list__token-data'), buttons: { next: By.css('#app-content > div > div.app-primary.from-right > div > div:nth-child(3) > div.page-container__footer > div > button:nth-child(2)'), - cancel: By.className('btn-violet') - } + cancel: By.className('btn-violet'), + }, }, custom: { @@ -77,7 +77,7 @@ module.exports = { }, buttons: { add: By.css('#app-content > div > div.app-primary.from-right > div > div.flex-column.flex-justify-center.flex-grow.select-none > div > div:nth-child(7) > button:nth-child(2)'), - cancel: By.className('btn-violet') + cancel: By.className('btn-violet'), }, }, diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js index a4f42070ac71..9f1e2669dcfb 100644 --- a/test/e2e/metamask.spec.js +++ b/test/e2e/metamask.spec.js @@ -50,7 +50,7 @@ describe('Metamask popup page', async function () { }) after(async function () { - //await driver.quit() + await driver.quit() }) describe('Setup', async function () { @@ -1083,7 +1083,7 @@ describe('Metamask popup page', async function () { } async function waitUntilShowUp (by, Twait) { - if (Twait === undefined) Twait = 20 + if (Twait === undefined) Twait = 200 do { await delay(100) if (await isElementDisplayed(by)) return await driver.findElement(by) @@ -1121,12 +1121,12 @@ describe('Metamask popup page', async function () { try { const button = await waitUntilShowUp(screens.main.tokens.buttonAdd, 300) await click(button) - //await delay(2000) + // await delay(2000) do { const tab = await waitUntilShowUp(screens.addToken.tab.custom) await tab.click() } - while( await waitUntilShowUp(screens.addToken.custom.fields.contractAddress) === false) + while (await waitUntilShowUp(screens.addToken.custom.fields.contractAddress) === false) const field = await waitUntilShowUp(screens.addToken.custom.fields.contractAddress) await clearField(field) await field.sendKeys(tokenAddress) From e0b14b6c228af8060683c993dd365e0a5ec9cc68 Mon Sep 17 00:00:00 2001 From: dennistikhomirov Date: Mon, 17 Sep 2018 05:14:38 -0700 Subject: [PATCH 4/7] e2e: added tests search token pr#135 --- test/e2e/elements.js | 30 +- test/e2e/metamask.spec.js | 633 +++++++++++++++++++++++++++----------- 2 files changed, 475 insertions(+), 188 deletions(-) diff --git a/test/e2e/elements.js b/test/e2e/elements.js index 35174f329f69..200c59192d55 100644 --- a/test/e2e/elements.js +++ b/test/e2e/elements.js @@ -59,14 +59,36 @@ module.exports = { tab: { custom: By.className('inactiveForm pointer'), search: By.className('inactiveForm pointer'), - }, + }, search: { fieldSearch: By.id('search-tokens'), results: By.className('token-list__token-data'), - buttons: { + token: { + unselected: By.className('token-list__token'), + selected: By.className('token-list__token token-list__token--selected'), + name: By.className('token-list__token-name'), + icon: By.className('token-list__token-icon'), + }, + button: { next: By.css('#app-content > div > div.app-primary.from-right > div > div:nth-child(3) > div.page-container__footer > div > button:nth-child(2)'), cancel: By.className('btn-violet'), }, + confirm: { + label: By.className('confirm-label'), + labelText: By.className('Would you like to add these tokens?'), + button: { + add: By.className('btn-primary'), + cancel: By.className('btn-default btn-violet'), + }, + token: { + item: By.className('confirm-add-token__token-list-item'), + balance: By.className('confirm-add-token__balance'), + name: By.className('confirm-add-token__name'), + icon: By.className('confirm-add-token__token-icon identicon'), + }, + + + }, }, custom: { @@ -148,6 +170,7 @@ module.exports = { }, }, main: { + identicon: By.className('identicon-wrapper select-none'), accountName: By.className('sizing-input'), edit: By.className('edit-text'), iconCopy: By.className('clipboard cursor-pointer white'), @@ -168,13 +191,14 @@ module.exports = { tokens: { remove: By.className('trash'), menu: By.className('inactiveForm pointer'), - token: By.css('#app-content > div > div.app-primary.from-left > div > section > div.full-flex-height > ol > li'), + token: By.className('token-cell'), balance: By.css('#app-content > div > div.app-primary.from-left > div > section > div.full-flex-height > ol > li:nth-child(2) > h3'), amount: By.css('#app-content > div > div.app-primary.from-left > div > section > div.full-flex-height > div > span'), textNoTokens: 'No tokens found', textYouOwn1token: 'You own 1 token', buttonAdd: By.css('div.full-flex-height:nth-child(2) > div:nth-child(1) > button:nth-child(2)'), buttonAddText: 'Add Token', + counter: By.css('#app-content > div > div.app-primary.from-left > div > section > div.full-flex-height > div > span'), }, }, info: { diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js index 9f1e2669dcfb..33e3b000dccc 100644 --- a/test/e2e/metamask.spec.js +++ b/test/e2e/metamask.spec.js @@ -50,7 +50,7 @@ describe('Metamask popup page', async function () { }) after(async function () { - await driver.quit() + // await driver.quit() }) describe('Setup', async function () { @@ -606,107 +606,193 @@ describe('Metamask popup page', async function () { }) }) - describe('Token Factory', function () { + describe('Add Token:Search', function () { + const request = { + valid: 'cry', + invalid: 'zzz', + notExistingAddress: '0xE18035BF8712672935FDB4e5e431b1a0183d2DFC', + } + const Qtum = { + name: 'Qtum (QTUM)', + address: '0x9a642d6b3368ddc662CA244bAdf32cDA716005BC', + } - it('navigates to token factory', async function () { - await driver.get('http://tokenfactory.surge.sh/') - }) + describe('add Mainnet\'s tokens', function () { - it('navigates to create token contract link', async function () { - const createToken = await waitUntilShowUp(By.css('#bs-example-navbar-collapse-1 > ul > li:nth-child(3) > a')) - await createToken.click() - }) + it('user is able to open Add tokens:Search, field \'Search\' is displayed', async function () { + await setProvider(NETWORKS.MAINNET) + const tab = await waitUntilShowUp(screens.main.tokens.menu) + await tab.click() + const button = await waitUntilShowUp(screens.main.tokens.buttonAdd, 300) + await click(button) + const field = await waitUntilShowUp(screens.addToken.search.fieldSearch) + assert.notEqual(field, false, 'field \'Search\' isn\'t displayed') + }) - it('adds input for token', async function () { - const totalSupply = await waitUntilShowUp(By.css('#main > div > div > div > div:nth-child(2) > div > div:nth-child(5) > input')) - const tokenName = await waitUntilShowUp(By.css('#main > div > div > div > div:nth-child(2) > div > div:nth-child(6) > input')) - const tokenDecimal = await waitUntilShowUp(By.css('#main > div > div > div > div:nth-child(2) > div > div:nth-child(7) > input')) - const tokenSymbol = await waitUntilShowUp(By.css('#main > div > div > div > div:nth-child(2) > div > div:nth-child(8) > input')) - const createToken = await waitUntilShowUp(By.css('#main > div > div > div > div:nth-child(2) > div > button')) + it('button \'Next\' is disabled if no tokens found', async function () { + const button = await waitUntilShowUp(screens.addToken.search.button.next) + assert.equal(await button.isEnabled(), false, 'button is enabled') + assert.equal(await button.getText(), 'Next', 'button has incorrect name') + }) - await totalSupply.sendKeys('100') - await tokenName.sendKeys('Test') - await tokenDecimal.sendKeys('0') - await tokenSymbol.sendKeys('TST') - await click(createToken) - await delay(1000) - }) + it('button \'Cancel\' is enabled and lead to main screen ', async function () { + const button = await waitUntilShowUp(screens.addToken.search.button.cancel) + assert.equal(await button.isEnabled(), true, 'button isn\'t enabled') + assert.equal(await button.getText(), 'Cancel', 'button has incorrect name') + }) - // There is an issue with blank confirmation window in Firefox, but the button is still there and the driver is able to clicked (?.?) - it('confirms transaction in MetaMask popup', async function () { - const windowHandles = await driver.getAllWindowHandles() - await driver.switchTo().window(windowHandles[windowHandles.length - 1]) - const button = await waitUntilShowUp(screens.confirmTransaction.buttons.submit) - await click(button) - }) + it('Search by name: searching result list is empty if request invalid', async function () { + const field = await waitUntilShowUp(screens.addToken.search.fieldSearch) + await field.sendKeys(request.invalid) + const list = await waitUntilShowUp(screens.addToken.search.token.unselected, 20) + assert.equal(list, false, 'unexpected tokens are displayed') + }) - it('switches back to Token Factory to grab the token contract address', async function () { - const windowHandles = await driver.getAllWindowHandles() - await driver.switchTo().window(windowHandles[0]) - const tokenContactAddress = await waitUntilShowUp(By.css('#main > div > div > div > div:nth-child(2) > span:nth-child(3)')) - tokenAddress = await tokenContactAddress.getText() - await delay(500) - }) + it('Search by name: searching result list isn\'t empty ', async function () { + const field = await waitUntilShowUp(screens.addToken.search.fieldSearch) + await clearField(field) + await field.sendKeys(request.valid) + await waitUntilShowUp(screens.addToken.search.token.unselected) + const list = await driver.findElements(screens.addToken.search.token.unselected) + assert.notEqual(list, 0, 'tokens aren\'t displayed') + }) - it('navigates back to MetaMask popup in the tab', async function () { - if (process.env.SELENIUM_BROWSER === 'chrome') { - await driver.get(`chrome-extension://${extensionId}/popup.html`) - } else if (process.env.SELENIUM_BROWSER === 'firefox') { - await driver.get(`moz-extension://${extensionId}/popup.html`) - } - await delay(700) - }) - }) + it('Token\'s info contains name, symbol and picture ', async function () { + const tokens = await driver.findElements(screens.addToken.search.token.unselected) + const names = await driver.findElements(screens.addToken.search.token.name) + const icons = await driver.findElements(screens.addToken.search.token.icon) + assert.equal(tokens.length, names.length, 'some names are missed') + assert.equal(tokens.length, icons.length, 'some icons are missed') + }) - describe('Add Token', function () { + it('button \'Next\' is disabled if no one token is selected', async function () { + const button = await waitUntilShowUp(screens.addToken.search.button.next) + assert.equal(await button.isEnabled(), false, 'button is enabled') + }) - it('switches to the add token screen', async function () { - await waitUntilShowUp(screens.main.buttons.send) - const tokensTab = await driver.findElement(screens.main.tokens.menu) - assert.equal(await tokensTab.getText(), 'Tokens') - await tokensTab.click() - }) + it('user can select one token', async function () { + const token = await waitUntilShowUp(screens.addToken.search.token.unselected) + await token.click() + }) - it('navigates to the add token screen', async function () { - const addTokenButton = await waitUntilShowUp(screens.main.tokens.buttonAdd) - assert.equal(await addTokenButton.getText(), screens.main.tokens.buttonAddText) - await click(addTokenButton) - }) + it('button \'Next\' is enabled if token is selected', async function () { + const button = await waitUntilShowUp(screens.addToken.search.button.next) + assert.equal(await button.isEnabled(), true, 'button is disabled') + }) - it('checks add token screen has correct title', async function () { - const addTokenScreen = await waitUntilShowUp(screens.addToken.title) - assert.equal(await addTokenScreen.getText(), screens.addToken.titleText) - }) + it('user can unselected token', async function () { + const token = await waitUntilShowUp(screens.addToken.search.token.selected) + await token.click() + }) - it('adds token parameters', async function () { - const tab = await waitUntilShowUp(screens.addToken.tab.custom) - await tab.click() - console.log(1) - const tokenContractAddress = await waitUntilShowUp(screens.addToken.custom.fields.contractAddress) - await tokenContractAddress.sendKeys(tokenAddress) - console.log(2) - const button = await waitUntilShowUp(screens.addToken.custom.buttons.add) - await click(button) - }) + it('button \'Next\' is disabled after token was unselected', async function () { + const button = await waitUntilShowUp(screens.addToken.search.button.next) + assert.equal(await button.isEnabled(), false, 'button is enabled') + }) - it('checks the token balance', async function () { - const tokenBalance = await waitUntilShowUp(screens.main.tokens.balance) - assert.equal(await tokenBalance.getText(), '100 TST') - }) + it('user can select two tokens', async function () { + await waitUntilShowUp(screens.addToken.search.token.unselected) + const tokensUnselected = await driver.findElements(screens.addToken.search.token.unselected) + await tokensUnselected[0].click() + await tokensUnselected[2].click() + const tokensSelected = await driver.findElements(screens.addToken.search.token.selected) + assert.equal(tokensSelected.length, 2, 'user can\'t select 2 tokens') + }) - it('token balance updates if switch account', async function () { - const accountMenu = await waitUntilShowUp(menus.account.menu) - await accountMenu.click() - const item = await waitUntilShowUp(menus.account.createAccount) - await item.click() - const tokenBalance = await waitUntilShowUp(screens.main.tokens.balance) - assert.equal(await tokenBalance.getText(), '0 TST') - }) - }) + it('click button \'Next\' opens confirm screen ', async function () { + const button = await waitUntilShowUp(screens.addToken.search.button.next) + await click(button) + const buttonAdd = await waitUntilShowUp(screens.addToken.search.confirm.button.add) + assert.notEqual(buttonAdd, false, 'failed to open screen confirmation') + }) + + it('two selected tokens displayed and have correct parameters', async function () { + const tokens = await driver.findElements(screens.addToken.search.confirm.token.item) + assert.equal(tokens.length, 2, 'incorrect number of tokens are presented') + + const names = await driver.findElements(screens.addToken.search.confirm.token.name) + const name0 = await names[0].getText() + const name1 = await names[1].getText() + assert.equal(name0.length > 10, true, 'empty token name') + assert.equal(name1.length > 10, true, 'empty token name') + await delay(2000) + const balances = await driver.findElements(screens.addToken.search.confirm.token.balance) + const balance0 = await balances[1].getText() + const balance1 = await balances[2].getText() + assert.equal(balance0, '0', 'balance isn\'t 0') + assert.equal(balance1, '0', 'balance isn\'t 0') + }) + + it('button \'Cancel\' is enabled and leads to main screen ', async function () { + const button = await waitUntilShowUp(screens.addToken.search.button.cancel) + assert.equal(await button.isEnabled(), true, 'button isn\'t enabled') + await click(button) + const identicon = await waitUntilShowUp(screens.main.identicon) + assert.notEqual(identicon, false, 'main screen didn\'t opened') + }) + + it('button \'Next\' is enabled if confirmation list isn\'t empty', async function () { + const buttonAdd = await waitUntilShowUp(screens.main.tokens.buttonAdd) + await click(buttonAdd) + await waitUntilShowUp(screens.addToken.search.fieldSearch) + const button = await waitUntilShowUp(screens.addToken.search.button.next) + assert.equal(await button.isEnabled(), true, 'button is disabled') + }) - describe('Check support of token per network basis ', async function () { + it('Search by contract address: searching result list is empty if address invalid ', async function () { + const field = await waitUntilShowUp(screens.addToken.search.fieldSearch) + await field.sendKeys(request.notExistingAddress) + const list = await waitUntilShowUp(screens.addToken.search.token.unselected, 20) + assert.equal(list, false, 'unexpected tokens are displayed') - describe('Token should be displayed only for network, where it was added ', async function () { + }) + + it('Search by valid contract address: searching result list contains one token ', async function () { + const field = await waitUntilShowUp(screens.addToken.search.fieldSearch) + await clearField(field) + await clearField(field) + await field.sendKeys(Qtum.address) + const token = await waitUntilShowUp(screens.addToken.search.token.unselected) + const list = await driver.findElements(screens.addToken.search.token.unselected) + assert.notEqual(list, 0, 'tokens aren\'t displayed') + await token.click() + }) + + it('Token\'s info contains correct name ', async function () { + const name = await waitUntilShowUp(screens.addToken.search.token.name) + assert.equal(await name.getText(), Qtum.name, 'incorrect token\'s name') + }) + + it('one more token added to confirmation list', async function () { + const button = await waitUntilShowUp(screens.addToken.search.button.next) + await click(button) + await waitUntilShowUp(screens.addToken.search.confirm.token.item) + const list = await driver.findElements(screens.addToken.search.confirm.token.item) + assert.equal(list.length, 3, 'token wasn\'t added') + }) + + it('button \'Add tokens\' is enabled and clickable', async function () { + const button = await waitUntilShowUp(screens.addToken.search.confirm.button.add) + assert.equal(await button.isEnabled(), true, 'button isn\'t enabled') + await click(button) + const identicon = await waitUntilShowUp(screens.main.identicon) + assert.notEqual(identicon, false, 'main screen didn\'t opened') + }) + + it('all selected tokens are displayed on main screen', async function () { + await waitUntilShowUp(screens.main.tokens.token) + const tokens = await driver.findElements(screens.main.tokens.token) + assert.equal(tokens.length, 3, 'tokens weren\'t added') + }) + + it('correct value of counter of owned tokens', async function () { + const counter = await waitUntilShowUp(screens.main.tokens.counter) + assert.equal(await counter.getText(), 'You own 3 tokens', 'incorrect value of counter') + + }) + + }) + describe.skip('Token should be displayed only for network, where it was added ', async function () { it('token should not be displayed in POA network', async function () { await setProvider(NETWORKS.POA) @@ -718,8 +804,8 @@ describe('Metamask popup page', async function () { assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') }) - it('token should not be displayed in MAINNET network', async function () { - await setProvider(NETWORKS.MAINNET) + it('token should not be displayed in LOCALHOST network', async function () { + await setProvider(NETWORKS.LOCALHOST) assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') }) @@ -738,132 +824,302 @@ describe('Metamask popup page', async function () { assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') }) }) + describe('remove Mainnet\'s tokens', function () { - describe('Add token with the same address to each network ', async function () { + it('remove tokens', async function () { + await setProvider(NETWORKS.MAINNET) - const tokenName = 'DVT' - const tokenDecimals = '13' + let button + let counter + let buttonYes + let tokensNumber + + button = await waitUntilShowUp(screens.main.tokens.remove) + await button.click() + buttonYes = await waitUntilShowUp(screens.removeToken.buttons.yes) + await buttonYes.click() + counter = await waitUntilShowUp(screens.main.tokens.counter) + assert.equal(await counter.getText(), 'You own 2 tokens', 'incorrect value of counter') + tokensNumber = await driver.findElements(screens.main.tokens.token) + assert.equal(tokensNumber.length, 2, 'incorrect amount of token\'s is displayed') + + button = await waitUntilShowUp(screens.main.tokens.remove) + await button.click() + buttonYes = await waitUntilShowUp(screens.removeToken.buttons.yes) + await buttonYes.click() + counter = await waitUntilShowUp(screens.main.tokens.counter) + assert.equal(await counter.getText(), 'You own 1 token', 'incorrect value of counter') + tokensNumber = await driver.findElements(screens.main.tokens.token) + assert.equal(tokensNumber.length, 1, 'incorrect amount of token\'s is displayed') + + button = await waitUntilShowUp(screens.main.tokens.remove) + await button.click() + buttonYes = await waitUntilShowUp(screens.removeToken.buttons.yes) + await buttonYes.click() + counter = await waitUntilShowUp(screens.main.tokens.counter) + assert.equal(await counter.getText(), 'No tokens found', 'incorrect value of counter') - it('adds token with the same address to POA network', async function () { - await setProvider(NETWORKS.POA) - await addToken(tokenAddress, tokenName, tokenDecimals) - const tokenBalance = await waitUntilShowUp(screens.main.tokens.balance) - assert.notEqual(await tokenBalance.getText(), '') + assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') }) - it('adds token with the same address to SOKOL network', async function () { - await setProvider(NETWORKS.SOKOL) - await addToken(tokenAddress, tokenName, tokenDecimals) - const tokenBalance = await waitUntilShowUp(screens.main.tokens.balance) - assert.notEqual(await tokenBalance.getText(), '') + + }) + }) + + + describe('Add Token: Custom', function () { + + describe('Token Factory', function () { + + it('navigates to token factory', async function () { + await setProvider(NETWORKS.LOCALHOST) + await driver.get('http://tokenfactory.surge.sh/') }) - it('adds token with the same address to MAINNET network', async function () { - await setProvider(NETWORKS.MAINNET) - await addToken(tokenAddress, tokenName, tokenDecimals) - const tokenBalance = await waitUntilShowUp(screens.main.tokens.balance) - assert.notEqual(await tokenBalance.getText(), '') + it('navigates to create token contract link', async function () { + const createToken = await waitUntilShowUp(By.css('#bs-example-navbar-collapse-1 > ul > li:nth-child(3) > a')) + await createToken.click() }) - it('adds token with the same address to ROPSTEN network', async function () { - await setProvider(NETWORKS.ROPSTEN) - await addToken(tokenAddress, tokenName, tokenDecimals) - const tokenBalance = await waitUntilShowUp(screens.main.tokens.balance) - assert.notEqual(await tokenBalance.getText(), '') + it('adds input for token', async function () { + const totalSupply = await waitUntilShowUp(By.css('#main > div > div > div > div:nth-child(2) > div > div:nth-child(5) > input')) + const tokenName = await waitUntilShowUp(By.css('#main > div > div > div > div:nth-child(2) > div > div:nth-child(6) > input')) + const tokenDecimal = await waitUntilShowUp(By.css('#main > div > div > div > div:nth-child(2) > div > div:nth-child(7) > input')) + const tokenSymbol = await waitUntilShowUp(By.css('#main > div > div > div > div:nth-child(2) > div > div:nth-child(8) > input')) + const createToken = await waitUntilShowUp(By.css('#main > div > div > div > div:nth-child(2) > div > button')) + + await totalSupply.sendKeys('100') + await tokenName.sendKeys('Test') + await tokenDecimal.sendKeys('0') + await tokenSymbol.sendKeys('TST') + await click(createToken) + await delay(1000) }) - it('adds token with the same address to KOVAN network', async function () { - await setProvider(NETWORKS.KOVAN) - await addToken(tokenAddress, tokenName, tokenDecimals) - const tokenBalance = await waitUntilShowUp(screens.main.tokens.balance) - assert.notEqual(await tokenBalance.getText(), '') + // There is an issue with blank confirmation window in Firefox, but the button is still there and the driver is able to clicked (?.?) + it('confirms transaction in MetaMask popup', async function () { + const windowHandles = await driver.getAllWindowHandles() + await driver.switchTo().window(windowHandles[windowHandles.length - 1]) + const button = await waitUntilShowUp(screens.confirmTransaction.buttons.submit) + await click(button) }) - it('adds token with the same address to RINKEBY network', async function () { - await setProvider(NETWORKS.RINKEBY) - await addToken(tokenAddress, tokenName, tokenDecimals) - const tokenBalance = await waitUntilShowUp(screens.main.tokens.balance) - assert.notEqual(await tokenBalance.getText(), '') + it('switches back to Token Factory to grab the token contract address', async function () { + const windowHandles = await driver.getAllWindowHandles() + await driver.switchTo().window(windowHandles[0]) + const tokenContactAddress = await waitUntilShowUp(By.css('#main > div > div > div > div:nth-child(2) > span:nth-child(3)')) + tokenAddress = await tokenContactAddress.getText() + await delay(500) }) - it('token still should be displayed in LOCALHOST network', async function () { - await setProvider(NETWORKS.LOCALHOST) - await waitUntilDisappear(screens.main.tokens.amount) - assert.notEqual(await waitUntilShowUp(screens.main.tokens.amount), false, 'App is frozen') - const tokens = await driver.findElements(screens.main.tokens.amount) - assert.equal(tokens.length, 1, '\'Tokens\' section doesn\'t contain field with amount of tokens') - assert.equal(await tokens[0].getText(), screens.main.tokens.textYouOwn1token, 'Token isn\'t displayed') + it('navigates back to MetaMask popup in the tab', async function () { + if (process.env.SELENIUM_BROWSER === 'chrome') { + await driver.get(`chrome-extension://${extensionId}/popup.html`) + } else if (process.env.SELENIUM_BROWSER === 'firefox') { + await driver.get(`moz-extension://${extensionId}/popup.html`) + } + await delay(700) }) }) - }) + describe('Add token', function () { - describe('Remove Token', function () { + it('navigates to the add token screen', async function () { + await waitUntilShowUp(screens.main.identicon) + const addTokenButton = await waitUntilShowUp(screens.main.tokens.buttonAdd) + assert.equal(await addTokenButton.getText(), screens.main.tokens.buttonAddText) + await click(addTokenButton) + }) - it('button \'Remove token\' displayed', async function () { - await setProvider(NETWORKS.LOCALHOST) - const removeTokenButton = await waitUntilShowUp(screens.main.tokens.remove) - assert.notEqual(removeTokenButton, false, 'button isn\'t displayed') - await removeTokenButton.click() - }) + it('checks add token screen has correct title', async function () { + const addTokenScreen = await waitUntilShowUp(screens.addToken.title) + assert.equal(await addTokenScreen.getText(), screens.addToken.titleText) + }) - it('screen \'Remove token\' has correct title', async function () { - const title = await waitUntilShowUp(screens.removeToken.title) - assert.equal(await title.getText(), screens.removeToken.titleText, 'title is incorrect') - }) + it('adds token parameters', async function () { + const tab = await waitUntilShowUp(screens.addToken.tab.custom) + await tab.click() + const tokenContractAddress = await waitUntilShowUp(screens.addToken.custom.fields.contractAddress) + await tokenContractAddress.sendKeys(tokenAddress) + const button = await waitUntilShowUp(screens.addToken.custom.buttons.add) + await click(button) + }) - it('button "No" bring back to "Main" screen', async function () { - const title = await waitUntilShowUp(screens.removeToken.title) - assert.equal(await title.getText(), screens.removeToken.titleText, 'title is incorrect') - const button = await waitUntilShowUp(screens.removeToken.buttons.no) - assert.notEqual(button, false, 'button \'No\' isn\'t displayed ') - assert.equal(await button.getText(), 'No', 'button has incorrect name') - await click(button) - const token = await waitUntilShowUp(screens.main.tokens.balance) - assert.notEqual(await token.getText(), '', 'token is disapeared after return from remove token screen ') + it('checks the token balance', async function () { + const tokenBalance = await waitUntilShowUp(screens.main.tokens.balance) + assert.equal(await tokenBalance.getText(), '100 TST') + }) + + it('token balance updates if switch account', async function () { + const accountMenu = await waitUntilShowUp(menus.account.menu) + await accountMenu.click() + const item = await waitUntilShowUp(menus.account.createAccount) + await item.click() + const tokenBalance = await waitUntilShowUp(screens.main.tokens.balance) + assert.equal(await tokenBalance.getText(), '0 TST') + }) }) - it('button "Yes" delete token', async function () { - const removeTokenButton = await waitUntilShowUp(screens.main.tokens.remove) - assert.notEqual(removeTokenButton, false, 'button isn\'t displayed') - await removeTokenButton.click() - const title = await waitUntilShowUp(screens.removeToken.title) - assert.equal(await title.getText(), screens.removeToken.titleText, 'title is incorrect') + describe('Check support of token per network basis ', async function () { - const button = await waitUntilShowUp(screens.removeToken.buttons.yes) - assert.notEqual(button, false, 'button \'Yes\' isn\'t displayed ') - assert.equal(await button.getText(), 'Yes', 'button has incorrect name') - await click(button) - assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') - }) + describe('Token should be displayed only for network, where it was added ', async function () { - it('check if token was removed from SOKOL network', async function () { - await setProvider(NETWORKS.SOKOL) - assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') - }) + it('token should not be displayed in POA network', async function () { + await setProvider(NETWORKS.POA) + assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') + }) - it('check if token was removed from KOVAN network', async function () { - await setProvider(NETWORKS.KOVAN) - assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') - }) + it('token should not be displayed in SOKOL network', async function () { + await setProvider(NETWORKS.SOKOL) + assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') + }) - it('check if token was removed from ROPSTEN network', async function () { - await setProvider(NETWORKS.ROPSTEN) - assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') - }) + it('token should not be displayed in MAINNET network', async function () { + await setProvider(NETWORKS.MAINNET) + assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') + }) - it('check if token was removed from MAINNET network', async function () { - await setProvider(NETWORKS.MAINNET) - assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') - }) + it('token should not be displayed in ROPSTEN network', async function () { + await setProvider(NETWORKS.ROPSTEN) + assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') + }) + + it('token should not be displayed in KOVAN network', async function () { + await setProvider(NETWORKS.KOVAN) + assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') + }) + + it('token should not be displayed in RINKEBY network', async function () { + await setProvider(NETWORKS.RINKEBY) + assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') + }) + }) - it('check if token was removed from POA network', async function () { - await setProvider(NETWORKS.POA) - assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') + describe('Add token with the same address to each network ', async function () { + + const tokenName = 'DVT' + const tokenDecimals = '13' + + it('adds token with the same address to POA network', async function () { + await setProvider(NETWORKS.POA) + await addToken(tokenAddress, tokenName, tokenDecimals) + const tokenBalance = await waitUntilShowUp(screens.main.tokens.balance) + assert.notEqual(await tokenBalance.getText(), '') + }) + + it('adds token with the same address to SOKOL network', async function () { + await setProvider(NETWORKS.SOKOL) + await addToken(tokenAddress, tokenName, tokenDecimals) + const tokenBalance = await waitUntilShowUp(screens.main.tokens.balance) + assert.notEqual(await tokenBalance.getText(), '') + }) + + it('adds token with the same address to MAINNET network', async function () { + await setProvider(NETWORKS.MAINNET) + await addToken(tokenAddress, tokenName, tokenDecimals) + const tokenBalance = await waitUntilShowUp(screens.main.tokens.balance) + assert.notEqual(await tokenBalance.getText(), '') + }) + + it('adds token with the same address to ROPSTEN network', async function () { + await setProvider(NETWORKS.ROPSTEN) + await addToken(tokenAddress, tokenName, tokenDecimals) + const tokenBalance = await waitUntilShowUp(screens.main.tokens.balance) + assert.notEqual(await tokenBalance.getText(), '') + }) + + it('adds token with the same address to KOVAN network', async function () { + await setProvider(NETWORKS.KOVAN) + await addToken(tokenAddress, tokenName, tokenDecimals) + const tokenBalance = await waitUntilShowUp(screens.main.tokens.balance) + assert.notEqual(await tokenBalance.getText(), '') + }) + + it('adds token with the same address to RINKEBY network', async function () { + await setProvider(NETWORKS.RINKEBY) + await addToken(tokenAddress, tokenName, tokenDecimals) + const tokenBalance = await waitUntilShowUp(screens.main.tokens.balance) + assert.notEqual(await tokenBalance.getText(), '') + }) + + it('token still should be displayed in LOCALHOST network', async function () { + await setProvider(NETWORKS.LOCALHOST) + await waitUntilDisappear(screens.main.tokens.amount) + assert.notEqual(await waitUntilShowUp(screens.main.tokens.amount), false, 'App is frozen') + const tokens = await driver.findElements(screens.main.tokens.amount) + assert.equal(tokens.length, 1, '\'Tokens\' section doesn\'t contain field with amount of tokens') + assert.equal(await tokens[0].getText(), screens.main.tokens.textYouOwn1token, 'Token isn\'t displayed') + }) + }) }) - it('check if token was removed from RINKEBY network', async function () { - await setProvider(NETWORKS.RINKEBY) - assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') + describe('Remove token , provider is localhost', function () { + + it('button \'Remove token\' displayed', async function () { + await setProvider(NETWORKS.LOCALHOST) + const removeTokenButton = await waitUntilShowUp(screens.main.tokens.remove) + assert.notEqual(removeTokenButton, false, 'button isn\'t displayed') + await removeTokenButton.click() + }) + + it('screen \'Remove token\' has correct title', async function () { + const title = await waitUntilShowUp(screens.removeToken.title) + assert.equal(await title.getText(), screens.removeToken.titleText, 'title is incorrect') + }) + + it('button "No" bring back to "Main" screen', async function () { + const title = await waitUntilShowUp(screens.removeToken.title) + assert.equal(await title.getText(), screens.removeToken.titleText, 'title is incorrect') + const button = await waitUntilShowUp(screens.removeToken.buttons.no) + assert.notEqual(button, false, 'button \'No\' isn\'t displayed ') + assert.equal(await button.getText(), 'No', 'button has incorrect name') + await click(button) + const token = await waitUntilShowUp(screens.main.tokens.balance) + assert.notEqual(await token.getText(), '', 'token is disapeared after return from remove token screen ') + }) + + it('button "Yes" delete token', async function () { + const removeTokenButton = await waitUntilShowUp(screens.main.tokens.remove) + assert.notEqual(removeTokenButton, false, 'button isn\'t displayed') + await removeTokenButton.click() + const title = await waitUntilShowUp(screens.removeToken.title) + assert.equal(await title.getText(), screens.removeToken.titleText, 'title is incorrect') + + const button = await waitUntilShowUp(screens.removeToken.buttons.yes) + assert.notEqual(button, false, 'button \'Yes\' isn\'t displayed ') + assert.equal(await button.getText(), 'Yes', 'button has incorrect name') + await click(button) + assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') + }) + + it('check if token was removed from SOKOL network', async function () { + await setProvider(NETWORKS.SOKOL) + assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') + }) + + it('check if token was removed from KOVAN network', async function () { + await setProvider(NETWORKS.KOVAN) + assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') + }) + + it('check if token was removed from ROPSTEN network', async function () { + await setProvider(NETWORKS.ROPSTEN) + assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') + }) + + it('check if token was removed from MAINNET network', async function () { + await setProvider(NETWORKS.MAINNET) + assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') + }) + + it('check if token was removed from POA network', async function () { + await setProvider(NETWORKS.POA) + assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') + }) + + it('check if token was removed from RINKEBY network', async function () { + await setProvider(NETWORKS.RINKEBY) + assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') + }) }) }) @@ -1105,7 +1361,8 @@ describe('Metamask popup page', async function () { await waitUntilDisappear(elements.loader) assert.notEqual(await waitUntilShowUp(screens.main.tokens.amount), false, 'App is frozen') // Check tokens title - const tokensStatus = await driver.findElements(screens.main.tokens.amount) + await waitUntilShowUp(screens.main.tokens.counter) + const tokensStatus = await driver.findElements(screens.main.tokens.counter) assert.equal(tokensStatus.length, 1, '\'Tokens\' section doesn\'t contain field with amount of tokens') assert.equal(await tokensStatus[0].getText(), screens.main.tokens.textNoTokens, 'Unexpected token presents') // Check if token presents @@ -1113,6 +1370,7 @@ describe('Metamask popup page', async function () { assert.equal(tokens.length, 0, 'Unexpected token presents') return true } catch (err) { + console.log(err) return false } } @@ -1124,7 +1382,12 @@ describe('Metamask popup page', async function () { // await delay(2000) do { const tab = await waitUntilShowUp(screens.addToken.tab.custom) - await tab.click() + try { + await tab.click() + } catch (err) { + console.log(err) + } + } while (await waitUntilShowUp(screens.addToken.custom.fields.contractAddress) === false) const field = await waitUntilShowUp(screens.addToken.custom.fields.contractAddress) From b079370f85e8b0edb76dcb2d2b9cf4faac34f0b1 Mon Sep 17 00:00:00 2001 From: dennistikhomirov Date: Mon, 17 Sep 2018 05:18:31 -0700 Subject: [PATCH 5/7] sync with search-tokens --- test/e2e/metamask.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js index 33e3b000dccc..c9724ca290d3 100644 --- a/test/e2e/metamask.spec.js +++ b/test/e2e/metamask.spec.js @@ -50,7 +50,7 @@ describe('Metamask popup page', async function () { }) after(async function () { - // await driver.quit() + await driver.quit() }) describe('Setup', async function () { From 804d718e61e2f4292476c487d3198ebfe3d65074 Mon Sep 17 00:00:00 2001 From: dennistikhomirov Date: Mon, 17 Sep 2018 08:22:46 -0700 Subject: [PATCH 6/7] fix identation --- test/e2e/elements.js | 2 -- test/e2e/metamask.spec.js | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/test/e2e/elements.js b/test/e2e/elements.js index 200c59192d55..fc478cbde81e 100644 --- a/test/e2e/elements.js +++ b/test/e2e/elements.js @@ -86,8 +86,6 @@ module.exports = { name: By.className('confirm-add-token__name'), icon: By.className('confirm-add-token__token-icon identicon'), }, - - }, }, custom: diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js index c9724ca290d3..0b6a0a22cb13 100644 --- a/test/e2e/metamask.spec.js +++ b/test/e2e/metamask.spec.js @@ -937,7 +937,7 @@ describe('Metamask popup page', async function () { it('adds token parameters', async function () { const tab = await waitUntilShowUp(screens.addToken.tab.custom) - await tab.click() + if (! await waitUntilShowUp(screens.addToken.custom.fields.contractAddress)) await tab.click() const tokenContractAddress = await waitUntilShowUp(screens.addToken.custom.fields.contractAddress) await tokenContractAddress.sendKeys(tokenAddress) const button = await waitUntilShowUp(screens.addToken.custom.buttons.add) From debe600faa5a5637f3caefb39aa56539827962a7 Mon Sep 17 00:00:00 2001 From: dennistikhomirov Date: Mon, 17 Sep 2018 09:26:24 -0700 Subject: [PATCH 7/7] e2e: fix search-tokens display per network basis --- test/e2e/metamask.spec.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js index 0b6a0a22cb13..47325c755a9c 100644 --- a/test/e2e/metamask.spec.js +++ b/test/e2e/metamask.spec.js @@ -619,8 +619,9 @@ describe('Metamask popup page', async function () { describe('add Mainnet\'s tokens', function () { - it('user is able to open Add tokens:Search, field \'Search\' is displayed', async function () { + it(' field \'Search\' is displayed', async function () { await setProvider(NETWORKS.MAINNET) + await delay(2000) const tab = await waitUntilShowUp(screens.main.tokens.menu) await tab.click() const button = await waitUntilShowUp(screens.main.tokens.buttonAdd, 300) @@ -792,7 +793,7 @@ describe('Metamask popup page', async function () { }) }) - describe.skip('Token should be displayed only for network, where it was added ', async function () { + describe('Token should be displayed only for network, where it was added ', async function () { it('token should not be displayed in POA network', async function () { await setProvider(NETWORKS.POA) @@ -804,7 +805,8 @@ describe('Metamask popup page', async function () { assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') }) - it('token should not be displayed in LOCALHOST network', async function () { + it.skip('token should not be displayed in LOCALHOST network', async function () { + console.log('https://github.com/poanetwork/metamask-extension/issues/131') await setProvider(NETWORKS.LOCALHOST) assert.equal(await assertTokensNotDisplayed(), true, 'tokens are displayed') }) @@ -937,7 +939,7 @@ describe('Metamask popup page', async function () { it('adds token parameters', async function () { const tab = await waitUntilShowUp(screens.addToken.tab.custom) - if (! await waitUntilShowUp(screens.addToken.custom.fields.contractAddress)) await tab.click() + if (!await waitUntilShowUp(screens.addToken.custom.fields.contractAddress)) await tab.click() const tokenContractAddress = await waitUntilShowUp(screens.addToken.custom.fields.contractAddress) await tokenContractAddress.sendKeys(tokenAddress) const button = await waitUntilShowUp(screens.addToken.custom.buttons.add) @@ -1379,13 +1381,12 @@ describe('Metamask popup page', async function () { try { const button = await waitUntilShowUp(screens.main.tokens.buttonAdd, 300) await click(button) - // await delay(2000) + do { - const tab = await waitUntilShowUp(screens.addToken.tab.custom) + const tab = await waitUntilShowUp(screens.addToken.tab.custom, 10) try { await tab.click() } catch (err) { - console.log(err) } }