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

Function initUrlMode

lib/plugin/pause.js:105–131  ·  view source on GitHub ↗
(pattern)

Source from the content-addressed store, hash-verified

103}
104
105function initUrlMode(pattern) {
106 const helper = getBrowserHelper()
107
108 if (!helper) {
109 output.error('pause:on=url requires a browser helper (Playwright, WebDriver, Puppeteer, Appium)')
110 return
111 }
112
113 let paused = false
114
115 event.dispatcher.on(event.step.after, () => {
116 if (paused) return
117
118 recorder.add('pause:url check', async () => {
119 if (paused) return
120 try {
121 const currentUrl = await helper.grabCurrentUrl()
122 if (matchUrl(currentUrl, pattern)) {
123 paused = true
124 return pause()
125 }
126 } catch (err) {
127 // page may not be loaded yet
128 }
129 })
130 })
131}

Callers 1

pause.jsFile · 0.85

Calls 5

getBrowserHelperFunction · 0.90
matchUrlFunction · 0.90
pauseFunction · 0.85
addMethod · 0.45
grabCurrentUrlMethod · 0.45

Tested by

no test coverage detected