From 309239afb402e7729184ff7c5956497263b4e0b8 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 18 Jun 2018 21:52:52 -0230 Subject: [PATCH] Wait for locating of submit buttons before attempting to click in metamask.spec.js --- test/e2e/metamask.spec.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js index b0a8fe411..6ab21dfcd 100644 --- a/test/e2e/metamask.spec.js +++ b/test/e2e/metamask.spec.js @@ -4,7 +4,7 @@ const path = require('path') const assert = require('assert') const pify = require('pify') const webdriver = require('selenium-webdriver') -const { By, Key } = webdriver +const { By, Key, until } = webdriver const { delay, buildChromeWebDriver, buildFirefoxWebdriver, installWebExt, getExtensionIdChrome, getExtensionIdFirefox } = require('./func') describe('Metamask popup page', function () { @@ -229,7 +229,11 @@ describe('Metamask popup page', function () { it('confirms transaction', async function () { await delay(300) - await driver.findElement(By.css('#pending-tx-form > div.flex-row.flex-space-around.conf-buttons > input')).click() + const bySubmitButton = By.css('#pending-tx-form > div.flex-row.flex-space-around.conf-buttons > input') + const submitButton = await driver.wait(until.elementLocated(bySubmitButton)) + + submitButton.click() + await delay(500) }) @@ -269,7 +273,8 @@ describe('Metamask popup page', function () { it('confirms transaction in MetaMask popup', async function () { const windowHandles = await driver.getAllWindowHandles() await driver.switchTo().window(windowHandles[windowHandles.length - 1]) - const metamaskSubmit = await driver.findElement(By.css('#pending-tx-form > div.flex-row.flex-space-around.conf-buttons > input')) + const byMetamaskSubmit = By.css('#pending-tx-form > div.flex-row.flex-space-around.conf-buttons > input') + const metamaskSubmit = await driver.wait(until.elementLocated(byMetamaskSubmit)) await metamaskSubmit.click() await delay(1000) })