diff options
Diffstat (limited to 'test/e2e/beta/helpers.js')
-rw-r--r-- | test/e2e/beta/helpers.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/e2e/beta/helpers.js b/test/e2e/beta/helpers.js index 31c41d8b7..fcc3e96d6 100644 --- a/test/e2e/beta/helpers.js +++ b/test/e2e/beta/helpers.js @@ -2,6 +2,7 @@ const fs = require('fs') const mkdirp = require('mkdirp') const pify = require('pify') const {until} = require('selenium-webdriver') +const { delay } = require('../func') module.exports = { checkBrowserForConsoleErrors, @@ -9,6 +10,7 @@ module.exports = { verboseReportOnFailure, findElement, findElements, + openNewPage, } async function loadExtension (driver, extensionId) { @@ -64,3 +66,15 @@ async function findElement (driver, by, timeout = 10000) { async function findElements (driver, by, timeout = 10000) { return driver.wait(until.elementsLocated(by), timeout) } + +async function openNewPage (driver, url) { + await driver.executeScript('window.open()') + await delay(1000) + + const handles = await driver.getAllWindowHandles() + const secondHandle = handles[1] + await driver.switchTo().window(secondHandle) + + await driver.get(url) + await delay(1000) +} |