* {{> waitCurrentPathEquals }}
(path, sec = null)
| 2570 | * {{> waitCurrentPathEquals }} |
| 2571 | */ |
| 2572 | async waitCurrentPathEquals(path, sec = null) { |
| 2573 | const aSec = sec || this.options.waitForTimeoutInSeconds |
| 2574 | const normalizedPath = normalizePath(path) |
| 2575 | const baseUrl = this.options.url || 'http://localhost' |
| 2576 | let actualPath = '' |
| 2577 | |
| 2578 | return this.browser |
| 2579 | .waitUntil( |
| 2580 | async () => { |
| 2581 | const currUrl = await this.browser.getUrl() |
| 2582 | const url = new URL(currUrl, baseUrl) |
| 2583 | actualPath = url.pathname |
| 2584 | return normalizePath(actualPath) === normalizedPath |
| 2585 | }, |
| 2586 | { timeout: aSec * 1000 }, |
| 2587 | ) |
| 2588 | .catch(e => { |
| 2589 | e = wrapError(e) |
| 2590 | if (e.message.indexOf('timeout')) { |
| 2591 | throw new Error(`expected path to be ${normalizedPath}, but found ${normalizePath(actualPath)}`) |
| 2592 | } |
| 2593 | throw e |
| 2594 | }) |
| 2595 | } |
| 2596 | |
| 2597 | /** |
| 2598 | * {{> waitForText }} |
nothing calls this directly
no test coverage detected