(page)
| 244 | const now = (page) => page.evaluate(() => Math.round(performance.now())); |
| 245 | |
| 246 | async function k15(page) { |
| 247 | await galaxyWithJsonb(page); |
| 248 | await explanationDone(page); |
| 249 | const toggle = page.locator('.cbm-chat-explanation .cbm-chat-response-source > summary'); |
| 250 | await shot(page, 'K15', 'before-expand', 'The explanation with its collapsed Source toggle.'); |
| 251 | await toggle.click(); |
| 252 | await wait(500); |
| 253 | const blocks = await page.evaluate(() => [...document.querySelectorAll('.cbm-chat-explanation .cbm-chat-source-content pre')].map((pre) => ({ |
| 254 | scrollWidth: pre.scrollWidth, clientWidth: pre.clientWidth, whiteSpace: getComputedStyle(pre).whiteSpace, text: pre.textContent.slice(0, 80) }))); |
| 255 | const panel = await page.locator('.cbm-chat-explanation .cbm-chat-source-content').boundingBox(); |
| 256 | await shot(page, 'K15', 'after-expand', 'The expanded Source block: every fact and code line wraps inside the panel, nothing is cut at the right edge.'); |
| 257 | if (panel) await shot(page, 'K15', 'after-expand-crop', 'Crop of the expanded Source block.', { clip: { x: panel.x - 8, y: panel.y - 8, width: panel.width + 16, height: Math.min(panel.height + 16, 700) } }); |
| 258 | // The facts of the hand test (17:45): long caller lists and paths, here under a listed answer. |
| 259 | await ask(page, 'Who calls JSONBAgg?'); |
| 260 | const turn = page.locator('.cbm-chat-turn').last(); |
| 261 | await turn.locator('.cbm-chat-response-source > summary').click(); |
| 262 | await wait(500); |
| 263 | const facts = await turn.evaluate((element) => [...element.querySelectorAll('.cbm-chat-source-content pre')].map((pre) => ({ |
| 264 | scrollWidth: pre.scrollWidth, clientWidth: pre.clientWidth, whiteSpace: getComputedStyle(pre).whiteSpace, text: pre.textContent.slice(0, 80) }))); |
| 265 | const factsBox = await turn.locator('.cbm-chat-source-content').boundingBox(); |
| 266 | if (factsBox) await shot(page, 'K15', 'facts-expanded-crop', 'The expanded Source of a listed answer: the long CALLS/TESTS lines and paths wrap, "test_empty_result_set" and "django/contrib/postgres/..." are complete.', |
| 267 | { clip: { x: factsBox.x - 8, y: Math.max(0, factsBox.y - 8), width: factsBox.width + 16, height: Math.min(factsBox.height + 16, 700) } }); |
| 268 | const all = [...blocks, ...facts]; |
| 269 | const clipped = all.filter((block) => block.scrollWidth > block.clientWidth + 1); |
| 270 | check('K15', 'Expanded Source blocks wrap long lines (no horizontal overflow)', blocks.length > 0 && facts.length > 0 && clipped.length === 0 && all.every((block) => block.whiteSpace === 'pre-wrap'), |
| 271 | { explanationBlocks: blocks.length, factBlocks: facts.length, clipped, whiteSpace: [...new Set(all.map((block) => block.whiteSpace))], factsStart: facts.map((block) => block.text) }); |
| 272 | } |
| 273 | |
| 274 | async function k16(page) { |
| 275 | await galaxyWithJsonb(page); |
nothing calls this directly
no test coverage detected