(page)
| 723 | } |
| 724 | |
| 725 | async function k10(page) { |
| 726 | await open(page, PROJECT, 'galaxy'); |
| 727 | await galaxyReady(page); |
| 728 | const loaded = await loadModel(page); |
| 729 | await page.reload({ waitUntil: 'domcontentloaded' }); |
| 730 | await page.waitForSelector('.atlas-shell'); |
| 731 | await wait(2500); |
| 732 | const lampAfterReload = await agentLabel(page); |
| 733 | await openConfig(page); |
| 734 | await wait(800); |
| 735 | const buttons = await page.locator('dialog.cbm-agent-settings .cbm-chat-model-actions button').allInnerTexts(); |
| 736 | const option = await page.locator('#cbm-chat-model option:checked').innerText().catch(() => ''); |
| 737 | const cache = await page.evaluate(async () => { const name = (await caches.keys()).find((key) => key.startsWith('cbm-browser-ai-qwen25')); return name ? (await (await caches.open(name)).keys()).length : 0; }); |
| 738 | await shot(page, 'K10', 'config-after-reload', 'After a reload the configuration says "Cached" and offers "Load model (cached, no download)".'); |
| 739 | // Optional automatic loading, off by default. |
| 740 | const autoLoad = page.getByLabel('Load the chosen model on start when it is cached'); |
| 741 | const autoDefault = await autoLoad.isChecked().catch(() => null); |
| 742 | await autoLoad.check(); |
| 743 | await closeConfig(page); |
| 744 | const requestsBefore = modelRequests.length; |
| 745 | const t0 = Date.now(); |
| 746 | await page.reload({ waitUntil: 'domcontentloaded' }); |
| 747 | await page.waitForSelector('.atlas-shell'); |
| 748 | await shot(page, 'K10', 'auto-load-0ms', 'Right after the reload with automatic loading on: the lamp is loading, no click.'); |
| 749 | const active = await agentActive(page, 120000); |
| 750 | const seconds = (Date.now() - t0) / 1000; |
| 751 | await shot(page, 'K10', 'auto-load-active', 'The agent is active again without any click.'); |
| 752 | const network = modelRequests.length - requestsBefore; |
| 753 | await openConfig(page); |
| 754 | await page.getByLabel('Load the chosen model on start when it is cached').uncheck(); |
| 755 | await closeConfig(page); |
| 756 | check('K10', 'After reload: cached state shown, no download offered; optional automatic loading works (default off)', loaded && /Load model \(cached, no download\)/.test(buttons.join(' ')) |
| 757 | && !/Download & load/.test(buttons.join(' ')) && /Cached/.test(option) && autoDefault === false && active && network === 0, |
| 758 | { lampAfterReload, buttons, option, cacheEntries: cache, autoDefault, autoLoadActiveAfterSeconds: active ? seconds : null, modelNetworkRequests: network }); |
| 759 | } |
| 760 | |
| 761 | /* K24: what each workspace shows of a project, after a switch in the page. */ |
| 762 | const K24_VIEWS = [ |
nothing calls this directly
no test coverage detected