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

Function pageStateToMarkdown

lib/plugin/pageInfo.js:104–127  ·  view source on GitHub ↗
(pageState)

Source from the content-addressed store, hash-verified

102}
103
104function pageStateToMarkdown(pageState) {
105 let markdown = ''
106
107 for (const [key, value] of Object.entries(pageState)) {
108 if (!value) continue
109 let result = ''
110
111 if (Array.isArray(value)) {
112 result = value.map(v => `- ${JSON.stringify(v, null, 2)}`).join('\n')
113 } else if (typeof value === 'string') {
114 result = `${value}`
115 } else {
116 result = JSON.stringify(value, null, 2)
117 }
118
119 if (!result.trim()) continue
120
121 markdown += `### ${ucfirst(humanizeString(key))}\n\n`
122 markdown += result
123 markdown += '\n\n'
124 }
125
126 return markdown
127}
128
129function getBrowserErrors(logs, type = ['error']) {
130 // Accepts Playwright ConsoleMessage objects, normalized {type, text}, or strings

Callers 1

pageInfo.jsFile · 0.85

Calls 3

ucfirstFunction · 0.90
humanizeStringFunction · 0.90
entriesMethod · 0.80

Tested by

no test coverage detected