1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

Robustify waiting logic in e2e test (#9704)

* Robustify waiting for popup to open

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
This commit is contained in:
Erik Marks 2020-10-23 16:24:20 -07:00 committed by GitHub
parent 046b495670
commit d843bed4e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -772,9 +772,8 @@ describe('MetaMask', function () {
await driver.delay(regularDelayMs * 2)
await driver.clickElement(By.xpath(`//button[contains(text(), 'Create Token')]`))
await driver.delay(largeDelayMs)
windowHandles = await driver.waitUntilXWindowHandles(3)
windowHandles = await driver.getAllWindowHandles()
const popup = windowHandles[2]
await driver.switchToWindow(popup)
await driver.delay(regularDelayMs)

View File

@ -124,10 +124,11 @@ class Driver {
async waitUntilXWindowHandles (x, delayStep = 1000, timeout = 5000) {
let timeElapsed = 0
let windowHandles = []
while (timeElapsed <= timeout) {
const windowHandles = await this.driver.getAllWindowHandles()
windowHandles = await this.driver.getAllWindowHandles()
if (windowHandles.length === x) {
return
return windowHandles
}
await this.delay(delayStep)
timeElapsed += delayStep