/** * @license * Copyright 2026 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import assert from 'node:assert'; import type {TestScenario} from '../eval_gemini.ts'; export const scenario: TestScenario = { prompt: 'Go to , fill the form with size = 2 CPUs and components = [docker, nginx].', maxTurns: 5, // allow for at least one extra turn to verify there are no extra clicks after fill_form htmlRoute: { path: '/input_test.html', htmlContent: `

Pre-installed components:




`, }, expectations: result => { const pageId = result.consumePageNavigation(); assert.ok(result.remainingCalls.length >= 2, 'Not enough calls made'); result.assertNextCall( 'take_snapshot', result.hasPageIdRouting ? {pageId} : undefined, ); const fillFormCall = result.assertNextCall( 'fill_form', result.hasPageIdRouting ? {pageId} : undefined, ); const elements = fillFormCall.args.elements; assert.ok(Array.isArray(elements), 'elements should be an array'); assert.strictEqual( elements.length, 3, 'fill_form should be used with all form elements at once', ); const typedElements = elements.map(e => { assert.ok(e && typeof e === 'object' && 'uid' in e && 'value' in e); return { uid: String(e.uid), value: String(e.value), }; }); const uids = new Set(typedElements.map(e => e.uid)); assert.strictEqual( uids.size, 3, 'fill_form should target three distinct elements', ); const values = typedElements.map(e => e.value).sort(); assert.deepStrictEqual( values, ['2 vCPU, 4GB RAM', 'true', 'true'], 'fill_form should be used with correct values', ); const submitUid = '1_15'; const extraFormInteractions = result.remainingCalls.filter( c => ['fill', 'click'].includes(c.name) && c.args.uid !== submitUid, ); assert.deepEqual( extraFormInteractions.length, 0, 'No extra clicks and fills after fill_form', ); }, };