aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-11-27 04:45:59 +0800
committerWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-11-27 21:22:51 +0800
commit34da38817a14080982f514cee614abcd3758b0f7 (patch)
tree93fd4d24535cf08c513cec40cc7edc65a39c4ce7 /test
parentec4c93c59fccb83453d538e2d4a71dfc400ba4aa (diff)
downloadtangerine-wallet-browser-34da38817a14080982f514cee614abcd3758b0f7.tar
tangerine-wallet-browser-34da38817a14080982f514cee614abcd3758b0f7.tar.gz
tangerine-wallet-browser-34da38817a14080982f514cee614abcd3758b0f7.tar.bz2
tangerine-wallet-browser-34da38817a14080982f514cee614abcd3758b0f7.tar.lz
tangerine-wallet-browser-34da38817a14080982f514cee614abcd3758b0f7.tar.xz
tangerine-wallet-browser-34da38817a14080982f514cee614abcd3758b0f7.tar.zst
tangerine-wallet-browser-34da38817a14080982f514cee614abcd3758b0f7.zip
Update e2e tests to handle any post-install window creation
Diffstat (limited to 'test')
-rw-r--r--test/e2e/beta/from-import-beta-ui.spec.js14
-rw-r--r--test/e2e/beta/metamask-beta-responsive-ui.spec.js17
-rw-r--r--test/e2e/beta/metamask-beta-ui.spec.js16
3 files changed, 38 insertions, 9 deletions
diff --git a/test/e2e/beta/from-import-beta-ui.spec.js b/test/e2e/beta/from-import-beta-ui.spec.js
index 2b2e3361d..a180689e5 100644
--- a/test/e2e/beta/from-import-beta-ui.spec.js
+++ b/test/e2e/beta/from-import-beta-ui.spec.js
@@ -12,6 +12,7 @@ const {
} = require('../func')
const {
checkBrowserForConsoleErrors,
+ closeAllWindowHandlesExcept,
verboseReportOnFailure,
findElement,
findElements,
@@ -32,13 +33,14 @@ describe('Using MetaMask with an existing account', function () {
this.bail(true)
before(async function () {
+ let extensionUrl
switch (process.env.SELENIUM_BROWSER) {
case 'chrome': {
const extensionPath = path.resolve('dist/chrome')
driver = buildChromeWebDriver(extensionPath)
extensionId = await getExtensionIdChrome(driver)
- await driver.get(`chrome-extension://${extensionId}/home.html`)
await delay(regularDelayMs)
+ extensionUrl = `chrome-extension://${extensionId}/home.html`
break
}
case 'firefox': {
@@ -47,11 +49,17 @@ describe('Using MetaMask with an existing account', function () {
await installWebExt(driver, extensionPath)
await delay(regularDelayMs)
extensionId = await getExtensionIdFirefox(driver)
- await driver.get(`moz-extension://${extensionId}/home.html`)
- await delay(regularDelayMs)
+ extensionUrl = `moz-extension://${extensionId}/home.html`
break
}
}
+ // Depending on the state of the application built into the above directory (extPath) and the value of
+ // METAMASK_DEBUG we will see different post-install behaviour and possibly some extra windows. Here we
+ // are closing any extraneous windows to reset us to a single window before continuing.
+ const [tab1] = await driver.getAllWindowHandles()
+ await closeAllWindowHandlesExcept(driver, [tab1])
+ await driver.switchTo().window(tab1)
+ await driver.get(extensionUrl)
})
afterEach(async function () {
diff --git a/test/e2e/beta/metamask-beta-responsive-ui.spec.js b/test/e2e/beta/metamask-beta-responsive-ui.spec.js
index 107f9aa6c..8b34f9027 100644
--- a/test/e2e/beta/metamask-beta-responsive-ui.spec.js
+++ b/test/e2e/beta/metamask-beta-responsive-ui.spec.js
@@ -12,6 +12,7 @@ const {
} = require('../func')
const {
checkBrowserForConsoleErrors,
+ closeAllWindowHandlesExcept,
findElement,
findElements,
loadExtension,
@@ -31,23 +32,33 @@ describe('MetaMask', function () {
this.bail(true)
before(async function () {
+ let extensionUrl
switch (process.env.SELENIUM_BROWSER) {
case 'chrome': {
const extPath = path.resolve('dist/chrome')
driver = buildChromeWebDriver(extPath, { responsive: true })
extensionId = await getExtensionIdChrome(driver)
- await driver.get(`chrome-extension://${extensionId}/home.html`)
+ await delay(largeDelayMs)
+ extensionUrl = `chrome-extension://${extensionId}/home.html`
break
}
case 'firefox': {
const extPath = path.resolve('dist/firefox')
driver = buildFirefoxWebdriver({ responsive: true })
await installWebExt(driver, extPath)
- await delay(700)
+ await delay(largeDelayMs)
extensionId = await getExtensionIdFirefox(driver)
- await driver.get(`moz-extension://${extensionId}/home.html`)
+ extensionUrl = `moz-extension://${extensionId}/home.html`
+ break
}
}
+ // Depending on the state of the application built into the above directory (extPath) and the value of
+ // METAMASK_DEBUG we will see different post-install behaviour and possibly some extra windows. Here we
+ // are closing any extraneous windows to reset us to a single window before continuing.
+ const [tab1] = await driver.getAllWindowHandles()
+ await closeAllWindowHandlesExcept(driver, [tab1])
+ await driver.switchTo().window(tab1)
+ await driver.get(extensionUrl)
})
afterEach(async function () {
diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js
index 9e96ceee6..e91af5303 100644
--- a/test/e2e/beta/metamask-beta-ui.spec.js
+++ b/test/e2e/beta/metamask-beta-ui.spec.js
@@ -37,23 +37,33 @@ describe('MetaMask', function () {
this.bail(true)
before(async function () {
+ let extensionUrl
switch (process.env.SELENIUM_BROWSER) {
case 'chrome': {
const extPath = path.resolve('dist/chrome')
driver = buildChromeWebDriver(extPath)
extensionId = await getExtensionIdChrome(driver)
- await driver.get(`chrome-extension://${extensionId}/home.html`)
+ await delay(largeDelayMs)
+ extensionUrl = `chrome-extension://${extensionId}/home.html`
break
}
case 'firefox': {
const extPath = path.resolve('dist/firefox')
driver = buildFirefoxWebdriver()
await installWebExt(driver, extPath)
- await delay(700)
+ await delay(largeDelayMs)
extensionId = await getExtensionIdFirefox(driver)
- await driver.get(`moz-extension://${extensionId}/home.html`)
+ extensionUrl = `moz-extension://${extensionId}/home.html`
+ break
}
}
+ // Depending on the state of the application built into the above directory (extPath) and the value of
+ // METAMASK_DEBUG we will see different post-install behaviour and possibly some extra windows. Here we
+ // are closing any extraneous windows to reset us to a single window before continuing.
+ const [tab1] = await driver.getAllWindowHandles()
+ await closeAllWindowHandlesExcept(driver, [tab1])
+ await driver.switchTo().window(tab1)
+ await driver.get(extensionUrl)
})
afterEach(async function () {