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:
parent
046b495670
commit
d843bed4e3
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user