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

Function pauseSession

lib/pause.js:65–116  ·  view source on GitHub ↗
(passedObject = {})

Source from the content-addressed store, hash-verified

63}
64
65function pauseSession(passedObject = {}) {
66 registeredVariables = passedObject
67 recorder.session.start('pause')
68 pauseSessionOpen = true
69
70 if (externalHandler) {
71 store.onPause = true
72 return externalHandler({ registeredVariables }).then(() => {
73 store.onPause = false
74 recorder.session.restore('pause')
75 pauseSessionOpen = false
76 })
77 }
78
79 if (!next) {
80 let vars = Object.keys(registeredVariables).join(', ')
81 if (vars) vars = `(vars: ${vars})`
82
83 output.print(colors.yellow(' Interactive shell started'))
84 output.print(colors.yellow(' Use JavaScript syntax to try steps in action'))
85 output.print(colors.yellow(` - Press ${colors.bold('ENTER')} to run the next step`))
86 output.print(colors.yellow(` - Press ${colors.bold('TAB')} twice to see all available commands`))
87 output.print(colors.yellow(` - Type ${colors.bold('exit')} + Enter to exit the interactive shell`))
88 output.print(colors.yellow(` - Prefix ${colors.bold('=>')} to run js commands ${colors.bold(vars)}`))
89
90 if (aiAssistant.isEnabled) {
91 output.print(colors.blue(` ${colors.bold('AI is enabled! (experimental)')} Write what you want and make AI run it`))
92 output.print(colors.blue(' Please note, only HTML fragments with interactive elements are sent to AI provider'))
93 output.print(colors.blue(' Ideas: ask it to fill forms for you or to click'))
94 }
95 }
96
97 rl = readline.createInterface({
98 input: process.stdin,
99 output: process.stdout,
100 terminal: true,
101 completer,
102 history: history.load(),
103 historySize: 50, // Adjust the history size as needed
104 })
105
106 store.onPause = true
107 rl.on('line', parseInput)
108 rl.on('close', () => {
109 if (!next) console.log('Exiting interactive shell....')
110 store.onPause = false
111 })
112 return new Promise(resolve => {
113 finish = resolve
114 return askForStep()
115 })
116}
117
118async function parseInput(cmd) {
119 rl.pause()

Callers 3

onStepAfterFunction · 0.85
pauseFunction · 0.85
pauseNowFunction · 0.85

Calls 4

askForStepFunction · 0.85
logMethod · 0.80
startMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected