(pageState)
| 102 | } |
| 103 | |
| 104 | function 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 | |
| 129 | function getBrowserErrors(logs, type = ['error']) { |
| 130 | // Accepts Playwright ConsoleMessage objects, normalized {type, text}, or strings |
no test coverage detected