Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

test(ui-tests): real assertions for benchmark config dropdowns + start button (dead-field audit PR 6) (#4637)

LearningCircuit9a937741a5de
diff --git a/tests/ui_tests/test_benchmark_ci.js b/tests/ui_tests/test_benchmark_ci.js
index b99cacd955..b97b9f6ed4 100644
--- a/tests/ui_tests/test_benchmark_ci.js
+++ b/tests/ui_tests/test_benchmark_ci.js
@@ -65,79 +65,84 @@ const BenchmarkDashboardTests = {
},
async configDropdowns(page, baseUrl) {
+ // The benchmark form (benchmark.html) has #evaluation_provider (a <select>)
+ // and #evaluation_model (a custom-dropdown input). On load,
+ // populateEvaluationProviders() (benchmark.html) fills the select with the
+ // built-in provider list (ollama/openai/anthropic/...), which renders
+ // client-side with no LLM — the async /settings/api/available-models call
+ // only *replaces* that list if it returns providers. So this asserts the
+ // select is actually populated with non-empty options (a render/contract
+ // check that catches the script not running), not that discovery succeeded.
+ // The old test scanned all <select>s and passed if any name contained
+ // "provider" — true for #evaluation_provider regardless of its options.
await navigateTo(page, `${baseUrl}/benchmark/`);
+ await page.waitForSelector('#evaluation_provider', { timeout: 15000 });
+ // Providers populate synchronously on DOMContentLoaded; wait briefly for a
+ // real (non-stub) option in case the inline script hasn't finished when we
+ // first query. 5s is ample for a synchronous fill, so a genuine "script
+ // never ran" failure surfaces fast rather than after a long timeout.
+ await page.waitForFunction(
+ () => {
+ const sel = document.querySelector('#evaluation_provider');
+ return sel && Array.from(sel.options).some(o => o.value && o.value.length > 0);
+ },
+ { timeout: 5000 }
+ ).catch(() => {});
const result = await page.evaluate(() => {
- const selects = document.querySelectorAll('select');
- const selectInfo = Array.from(selects).map(s => ({
- name: s.name || s.id || 'unnamed',
- optionCount: s.options.length,
- options: Array.from(s.options).slice(0, 5).map(o => o.text)
- }));
-
- const hasProviderSelect = selectInfo.some(s =>
- s.name.includes('provider') || s.name.includes('llm') ||
- s.options.some(o => o.toLowerCase().includes('ollama') || o.toLowerCase().includes('openai'))
- );
-
- const hasModelSelect = selectInfo.some(s =>
- s.name.includes('model') ||
- s.options.some(o => o.toLowerCase().includes('gpt') || o.toLowerCase().includes('llama'))
- );
-
- const hasSearchSelect = selectInfo.some(s =>
- s.name.includes('search') || s.name.includes('engine') ||
- s.options.some(o => o.toLowerCase().includes('duckduckgo') || o.toLowerCase().includes('searxng'))
- );
-
+ const provider = document.querySelector('#evaluation_provider');
+ const model = document.querySelector('#evaluation_model');
+ const opts = provider ? Array.from(provider.options).map(o => o.value).filter(Boolean) : [];
return {
- selectCount: selects.length,
- hasProviderSelect,
- hasModelSelect,
- hasSearchSelect,
- selects: selectInfo.slice(0, 5)
+ hasProvider: !!provider,
+ providerOptionCount: opts.length,
+ providerOptions: opts.slice(0, 6),
+ // #evaluation_model is a custom-dropdown <input> (render_dropdown),
+ // not a <select>; assert the type and that it lives in the form.
+ modelIsInput: model?.tagName === 'INPUT',
+ modelInForm: !!model?.closest('form#benchmark-form'),
};
});
- if (result.selectCount === 0) {
- return { passed: null, skipped: true, message: 'No dropdown selects found' };
- }
-
+ const passed = result.hasProvider && result.providerOptionCount > 0
+ && result.modelIsInput && result.modelInForm;
return {
- passed: result.hasProviderSelect || result.hasModelSelect || result.hasSearchSelect,
- message: `Config dropdowns: ${result.selectCount} found (provider=${result.hasProviderSelect}, model=${result.hasModelSelect}, search=${result.hasSearchSelect})`
+ passed,
+ message: passed
+ ? `Benchmark config: #evaluation_provider has ${result.providerOptionCount} options (${result.providerOptions.join(', ')}) + #evaluation_model is an input inside #benchmark-form`
+ : `Benchmark config incomplete (provider=${result.hasProvider}, providerOptions=${result.providerOptionCount}, modelIsInput=${result.modelIsInput}, modelInForm=${result.modelInForm})`
};
},
async startBenchmarkButton(page, baseUrl) {
+ // The real start control is #start-benchmark-btn: a submit button inside
+ // form#benchmark-form labelled "Start Benchmark" (benchmark.html:296). The
+ // old test fuzzy-matched any button whose text contained start/run/begin.
await navigateTo(page, `${baseUrl}/benchmark/`);
+ await page.waitForSelector('#start-benchmark-btn', { timeout: 15000 });
const result = await page.evaluate(() => {
- const buttons = Array.from(document.querySelectorAll('button, input[type="submit"], a.btn'));
- const startBtn = buttons.find(b => {
- const text = b.textContent?.toLowerCase() || '';
- return text.includes('start') || text.includes('run') || text.includes('begin');
- });
-
- if (startBtn) {
- return {
- found: true,
- text: startBtn.textContent?.trim(),
- disabled: startBtn.disabled,
- type: startBtn.tagName.toLowerCase()
- };
- }
-
- return { found: false };
+ const btn = document.querySelector('#start-benchmark-btn');
+ if (!btn) return { found: false };
+ return {
+ found: true,
+ tag: btn.tagName.toLowerCase(),
+ type: btn.type,
+ text: btn.textContent?.trim() || '',
+ inForm: !!btn.closest('form#benchmark-form'),
+ };
});
if (!result.found) {
- return { passed: null, skipped: true, message: 'No start benchmark button found' };
+ return { passed: false, message: '#start-benchmark-btn not found' };
}
-
+ const passed = result.tag === 'button' && result.type === 'submit'
+ && /start benchmark/i.test(result.text) && result.inForm;
return {
- passed: true,
- message: `Start button found: "${result.text}" (disabled=${result.disabled})`
+ passed,
+ message: passed
+ ? `Start button is a submit button in #benchmark-form ("${result.text}")`
+ : `Start button contract failed (tag=${result.tag}, type=${result.type}, text="${result.text}", inForm=${result.inForm})`
};
},