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

Function saveTraceForContext

lib/helper/Playwright.js:4836–4851  ·  view source on GitHub ↗
(context, name)

Source from the content-addressed store, hash-verified

4834 return fileName
4835}
4836async function saveTraceForContext(context, name) {
4837 if (!context) return
4838 if (!context.tracing) return
4839 try {
4840 const fileName = `${`${store.outputDir}${pathSeparator}trace${pathSeparator}${uuidv4()}_${clearString(name)}`.slice(0, 245)}.zip`
4841 await context.tracing.stop({ path: fileName })
4842 return fileName
4843 } catch (err) {
4844 // Handle the case where tracing was not started or context is invalid
4845 if (err.message && err.message.includes('Must start tracing before stopping')) {
4846 // Tracing was never started on this context, silently skip
4847 return null
4848 }
4849 throw err
4850 }
4851}
4852
4853async function highlightActiveElement(element) {
4854 if ((this.options.highlightElement || store.onPause) && store.debugMode) {

Callers 2

_failedMethod · 0.85
_passedMethod · 0.85

Calls 3

clearStringFunction · 0.90
stopMethod · 0.80
includesMethod · 0.80

Tested by

no test coverage detected