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 949fece96..c1080e8db 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') const testContract = ` pragma solidity ^0.4.0; @@ -37,6 +38,7 @@ module.exports = { verboseReportOnFailure, findElement, findElements, + openNewPage, testContract, } @@ -93,3 +95,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 lastHandle = handles.pop() + await driver.switchTo().window(lastHandle) + + await driver.get(url) + await delay(1000) +} |