MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / waitUrlEquals

Method waitUrlEquals

lib/helper/WebDriver.js:2549–2567  ·  view source on GitHub ↗

* {{> waitUrlEquals }}

(urlPart, sec = null)

Source from the content-addressed store, hash-verified

2547 * {{> waitUrlEquals }}
2548 */
2549 async waitUrlEquals(urlPart, sec = null) {
2550 const aSec = sec || this.options.waitForTimeoutInSeconds
2551 const expectedUrl = resolveUrl(urlPart, this.options.url)
2552 let currUrl = ''
2553 return this.browser
2554 .waitUntil(function () {
2555 return this.getUrl().then(res => {
2556 currUrl = decodeUrl(res)
2557 return currUrl === expectedUrl
2558 })
2559 }, aSec * 1000)
2560 .catch(e => {
2561 e = wrapError(e)
2562 if (e.message.indexOf('timeout')) {
2563 throw new Error(`expected url to be ${expectedUrl}, but found ${currUrl}`)
2564 }
2565 throw e
2566 })
2567 }
2568
2569 /**
2570 * {{> waitCurrentPathEquals }}

Callers

nothing calls this directly

Calls 3

resolveUrlFunction · 0.90
decodeUrlFunction · 0.90
wrapErrorFunction · 0.70

Tested by

no test coverage detected