* {{> waitUrlEquals }}
(urlPart, sec = null)
| 3448 | * {{> waitUrlEquals }} |
| 3449 | */ |
| 3450 | async waitUrlEquals(urlPart, sec = null) { |
| 3451 | const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout |
| 3452 | const expectedUrl = resolveUrl(urlPart, this.options.url) |
| 3453 | |
| 3454 | try { |
| 3455 | await this.page.waitForURL( |
| 3456 | url => url.href === expectedUrl, |
| 3457 | { timeout: waitTimeout }, |
| 3458 | ) |
| 3459 | } catch (e) { |
| 3460 | const currUrl = await this._getPageUrl() |
| 3461 | if (/Timeout/i.test(e.message)) { |
| 3462 | throw new Error(`expected url to be ${expectedUrl}, but found ${currUrl}`) |
| 3463 | } else { |
| 3464 | throw e |
| 3465 | } |
| 3466 | } |
| 3467 | } |
| 3468 | |
| 3469 | /** |
| 3470 | * {{> waitCurrentPathEquals }} |
nothing calls this directly
no test coverage detected