* {{> waitInUrl }}
(urlPart, sec = null)
| 2519 | * {{> waitInUrl }} |
| 2520 | */ |
| 2521 | async waitInUrl(urlPart, sec = null) { |
| 2522 | const client = this.browser |
| 2523 | const aSec = sec || this.options.waitForTimeoutInSeconds |
| 2524 | const expectedUrl = resolveUrl(urlPart, this.options.url) |
| 2525 | let currUrl = '' |
| 2526 | |
| 2527 | return client |
| 2528 | .waitUntil( |
| 2529 | function () { |
| 2530 | return this.getUrl().then(res => { |
| 2531 | currUrl = decodeUrl(res) |
| 2532 | return currUrl.indexOf(expectedUrl) > -1 |
| 2533 | }) |
| 2534 | }, |
| 2535 | { timeout: aSec * 1000 }, |
| 2536 | ) |
| 2537 | .catch(e => { |
| 2538 | e = wrapError(e) |
| 2539 | if (e.message.indexOf('timeout')) { |
| 2540 | throw new Error(`expected url to include ${expectedUrl}, but found ${currUrl}`) |
| 2541 | } |
| 2542 | throw e |
| 2543 | }) |
| 2544 | } |
| 2545 | |
| 2546 | /** |
| 2547 | * {{> waitUrlEquals }} |
nothing calls this directly
no test coverage detected