(page)
| 272 | } |
| 273 | |
| 274 | async function k16(page) { |
| 275 | await galaxyWithJsonb(page); |
| 276 | await explanationDone(page); |
| 277 | const mark = await markWorker(page); |
| 278 | const last = () => page.locator('.cbm-chat-turn').last(); |
| 279 | const buttons = async () => (await last().locator('button.cbm-chat-retry').allInnerTexts()).map((text) => text.trim()); |
| 280 | const typo = await ask(page, 'wer ruf jsonbagg auf'); |
| 281 | await shot(page, 'K16', 'typo-listed', '"wer ruf jsonbagg auf" is answered with the listed callers from the graph.'); |
| 282 | const shortTypo = await ask(page, 'wer rft jsonbagg auf'); |
| 283 | const suggestion = await ask(page, 'jsonbagg aufrufe?'); |
| 284 | const germanButtons = await buttons(); |
| 285 | await shot(page, 'K16', 'suggestion', '"jsonbagg aufrufe?" gets "Meintest du: Aufrufer von JSONBAgg?" with the German choices "Liste anzeigen" and "Modell fragen".'); |
| 286 | const box = await last().boundingBox(); |
| 287 | if (box) await shot(page, 'K16', 'suggestion-crop', 'Crop of the German suggestion and its German buttons.', { clip: { x: box.x - 8, y: Math.max(0, box.y - 8), width: box.width + 16, height: Math.min(box.height + 16, 500) } }); |
| 288 | await last().getByRole('button', { name: 'Liste anzeigen' }).click(); |
| 289 | await wait(600); |
| 290 | const listed = await last().innerText(); |
| 291 | const listedButtons = await buttons(); |
| 292 | await shot(page, 'K16', 'suggestion-listed', 'After "Liste anzeigen" the suggestion is replaced by the complete listed answer; its button reads "Modell fragen".'); |
| 293 | // The direction is read after the whole selection phrase: "this class call" asks what it calls. |
| 294 | const direction = await ask(page, 'Does this class call super?'); |
| 295 | const englishButtons = await buttons(); |
| 296 | await shot(page, 'K16', 'direction', '"Does this class call super?" is offered as "what JSONBAgg calls", with the English choices.'); |
| 297 | const modelCalls = await sentSince(page, mark); |
| 298 | // A real word one edit from "ruft" is not corrected: "Luft" goes to the model, not to a suggestion. |
| 299 | const luftMark = await markWorker(page); |
| 300 | const luft = await ask(page, 'Hat diese Klasse Luft?'); |
| 301 | const luftCalls = await sentSince(page, luftMark); |
| 302 | await shot(page, 'K16', 'luft-to-model', '"Hat diese Klasse Luft?" is not read as a call question: the model answers it.'); |
| 303 | const callers = ['test_default_argument', 'test_empty_result_set', 'test_jsonb_agg', 'test_values_list']; |
| 304 | check('K16', 'Typo caller questions are listed; uncertain ones are suggested in the right direction and language; no model call', /Aufrufer \(CALLS\) von JSONBAgg im geladenen Graphen/.test(typo) |
| 305 | && callers.every((name) => typo.includes(name)) && /Aufrufer \(CALLS\) von JSONBAgg im geladenen Graphen/.test(shortTypo) && /Meintest du: Aufrufer von JSONBAgg\?/.test(suggestion) |
| 306 | && JSON.stringify(germanButtons) === JSON.stringify(['Liste anzeigen', 'Modell fragen']) && /Aufrufer \(CALLS\) von JSONBAgg im geladenen Graphen/.test(listed) |
| 307 | && JSON.stringify(listedButtons) === JSON.stringify(['Modell fragen']) && /Did you mean: what JSONBAgg calls\?/.test(direction) |
| 308 | && JSON.stringify(englishButtons) === JSON.stringify(['Show the list', 'Ask the model']) && modelCalls.length === 0 && luftCalls.length === 1 && !/Meintest du|Did you mean/.test(luft), |
| 309 | { typoAnswerStart: typo.slice(0, 120), shortTypo: shortTypo.slice(0, 120), suggestion: suggestion.slice(0, 200), germanButtons, afterShowList: listed.slice(0, 120), listedButtons, |
| 310 | direction: direction.slice(0, 200), englishButtons, modelCallsBeforeLuft: modelCalls.length, luftModelCalls: luftCalls.length, luft: luft.slice(0, 200) }); |
| 311 | // A typo of up to two letters in the selected name, any case, and "wo" anywhere in the question (completeness check of 2026-10-04). |
| 312 | const typoMark = await markWorker(page); |
| 313 | const orders = []; |
| 314 | for (const question of ['jsonbagg wird wo aufgerufen', 'wo wird jsonbagg aufgerufen', 'von wo wird jsonbagg aufgerufen']) orders.push({ question, answer: await ask(page, question) }); |
| 315 | await shot(page, 'K16', 'word-order-listed', '"jsonbagg wird wo aufgerufen", "wo wird ..." and "von wo wird ...": each lists the callers of JSONBAgg from the graph.'); |
| 316 | const typos = []; |
| 317 | for (const [question, language] of [['wer ruft JSONBAg auf', 'de'], ['wer ruft jsonbgg auf?', 'de'], ['who calls jsonbag', 'en'], ['callers of jsonbag', 'en']]) typos.push({ question, language, answer: await ask(page, question) }); |
| 318 | const typoBox = await last().boundingBox(); |
| 319 | await shot(page, 'K16', 'name-typo-suggested', '"callers of jsonbag" (and "wer ruft JSONBAg auf", "wer ruft jsonbgg auf?", "who calls jsonbag"): "Did you mean: callers of JSONBAgg?" with Show the list and Ask the model.'); |
| 320 | if (typoBox) await shot(page, 'K16', 'name-typo-crop', 'Crop of the suggestion for "callers of jsonbag".', { clip: { x: typoBox.x - 8, y: Math.max(0, typoBox.y - 8), width: typoBox.width + 16, height: Math.min(typoBox.height + 16, 400) } }); |
| 321 | await last().getByRole('button', { name: 'Show the list' }).click(); |
| 322 | await wait(600); |
| 323 | const typoListed = await last().innerText(); |
| 324 | await shot(page, 'K16', 'name-typo-listed', 'After "Show the list": the complete callers of JSONBAgg.'); |
| 325 | const typoModelCalls = (await sentSince(page, typoMark)).length; |
| 326 | check('K16', 'A typo in the selected name (up to two letters, any case) is offered for the selection, a free word order with "wo" is listed; none of them reach the model', |
| 327 | orders.every((item) => /Aufrufer \(CALLS\) von JSONBAgg im geladenen Graphen/.test(item.answer) && callers.every((name) => item.answer.includes(name))) |
| 328 | && typos.every((item) => item.language === 'de' ? /Meintest du: Aufrufer von JSONBAgg\?/.test(item.answer) && /entspricht nicht dem Namen der Auswahl \(JSONBAgg\)/.test(item.answer) |
| 329 | : /Did you mean: callers of JSONBAgg\?/.test(item.answer) && /does not match the name of the selection \(JSONBAgg\)/.test(item.answer)) |
| 330 | && /callers \(CALLS\) of JSONBAgg in the loaded graph/.test(typoListed) && typoModelCalls === 0, |
| 331 | { orders: orders.map((item) => `${item.question} => ${item.answer.replace(/\s+/g, ' ').slice(0, 140)}`), typos: typos.map((item) => `${item.question} => ${item.answer.replace(/\s+/g, ' ').slice(0, 160)}`), |
nothing calls this directly
no test coverage detected