(page)
| 376 | /* Chat */ |
| 377 | |
| 378 | async function chatChecks(page) { |
| 379 | await open(page, PROJECT, 'galaxy'); |
| 380 | await galaxyReady(page); |
| 381 | |
| 382 | // C6: Roboter und Lampe in der Kopfzeile, Klick oeffnet die Konfiguration. |
| 383 | const action = page.locator('.atlas-browser-ai-action').first(); |
| 384 | const header = await action.boundingBox().catch(() => null); |
| 385 | const headerInfo = await action.evaluate((el) => ({ svg: Boolean(el.querySelector('svg')), text: el.textContent?.trim() ?? '', title: el.getAttribute('title') ?? '', label: el.getAttribute('aria-label') ?? '' })).catch(() => null); |
| 386 | const headerImage = header ? `${String(++shotIndex).padStart(3, '0')}-kopfzeile.png` : null; |
| 387 | if (header) await page.screenshot({ path: join(OUT, 'bilder', headerImage), clip: { x: Math.max(0, header.x - 300), y: Math.max(0, header.y - 10), width: Math.min(VIEWPORT.width - Math.max(0, header.x - 300), header.width + 360), height: header.height + 20 } }); |
| 388 | await action.click(); |
| 389 | await wait(700); |
| 390 | const dialogOpen = await page.getByRole('dialog').filter({ hasText: 'Agent configuration' }).isVisible().catch(() => false); |
| 391 | const configImage = await shot(page, 'agent-konfiguration'); |
| 392 | check('C6', 'Kopfzeile zeigt Roboter und Lampe, Modellname im Tooltip, Klick oeffnet die Konfiguration', |
| 393 | Boolean(headerInfo?.svg) && /Qwen2\.5 Coder 0\.5B/.test(`${headerInfo?.title} ${headerInfo?.label}`) && !/Qwen2\.5/.test(headerInfo?.text ?? '') && dialogOpen, |
| 394 | { ...headerInfo, dialogOpen }, [headerImage, configImage].filter(Boolean)); |
| 395 | |
| 396 | // C5: Token-Grenzen einstellen, nach dem Neuladen noch da. |
| 397 | const hasFields = (await page.locator('#cbm-chat-input-tokens').count()) > 0 && (await page.locator('#cbm-chat-output-tokens').count()) > 0; |
| 398 | let persisted = null; |
| 399 | if (hasFields) { |
| 400 | await page.locator('#cbm-chat-output-tokens').fill('384'); |
| 401 | await page.locator('#cbm-chat-output-tokens').press('Tab'); |
| 402 | await wait(400); |
| 403 | await page.reload({ waitUntil: 'domcontentloaded' }); |
| 404 | await page.waitForSelector('.atlas-shell'); |
| 405 | await galaxyReady(page); |
| 406 | await page.locator('.atlas-browser-ai-action').first().click(); |
| 407 | await wait(700); |
| 408 | persisted = { set: '384', afterReload: await page.locator('#cbm-chat-output-tokens').inputValue().catch(() => null), input: await page.locator('#cbm-chat-input-tokens').inputValue().catch(() => null) }; |
| 409 | } |
| 410 | check('C5', 'Eingabe- und Ausgabe-Token einstellbar und nach dem Neuladen gespeichert', hasFields && persisted?.afterReload === '384', persisted, [await shot(page, 'token-grenzen')]); |
| 411 | if (hasFields) { await page.locator('#cbm-chat-output-tokens').fill('512'); await page.locator('#cbm-chat-output-tokens').press('Tab'); await wait(300); } |
| 412 | |
| 413 | // Modell in DIESER Seite laden; ab hier wird nicht mehr neu geladen. |
| 414 | let modelReady = false; |
| 415 | if (MODEL) { |
| 416 | const load = page.getByRole('button', { name: /Download & load|Load model|Reload model/ }); |
| 417 | if (await load.count()) await load.first().click(); |
| 418 | modelReady = await page.waitForFunction(() => /Agent active/.test(`${document.querySelector('.atlas-browser-ai-action')?.getAttribute('aria-label') ?? ''}`), null, { timeout: 900000 }).then(() => true).catch(() => false); |
| 419 | } |
| 420 | await page.keyboard.press('Escape').catch(() => {}); |
| 421 | await wait(600); |
| 422 | await select(page, 'JSONBAgg'); |
| 423 | await scopeSettled(page); |
| 424 | const toggle = page.getByRole('button', { name: 'Open chat' }); |
| 425 | if (await toggle.count()) { await toggle.click(); await wait(1200); } |
| 426 | |
| 427 | // C3: Selection details liegt nicht auf der Eingabe, und ueber Senden liegt nichts. |
| 428 | const prompt = page.locator('#cbm-chat-prompt'); |
| 429 | const composer = await page.locator('.cbm-chat-input-row').first().boundingBox().catch(() => null); |
| 430 | const details = await page.locator('.atlas-galaxy-selection-details').first().boundingBox().catch(() => null); |
| 431 | await prompt.fill('x'); |
| 432 | await wait(200); |
| 433 | const sendBox = await page.locator('.cbm-chat-send').first().boundingBox().catch(() => null); |
| 434 | const topAtSend = sendBox ? await page.evaluate(({ x, y }) => { |
| 435 | const el = document.elementFromPoint(x, y); |
no test coverage detected