MCPcopy
hub / github.com/codeceptjs/CodeceptJS / waitUrlEquals

Method waitUrlEquals

lib/helper/Playwright.js:3450–3467  ·  view source on GitHub ↗

* {{> waitUrlEquals }}

(urlPart, sec = null)

Source from the content-addressed store, hash-verified

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 }}

Callers

nothing calls this directly

Calls 3

_getPageUrlMethod · 0.95
resolveUrlFunction · 0.90
waitForURLMethod · 0.80

Tested by

no test coverage detected