Skip to content

Commit a244aa9

Browse files
committed
test: select trigger presets through the real dropdown
Avoid flash-model center-screen mislocations in the failing trigger case by using the fixed VM dropdown and GTK keyboard navigation. Keep the existing visual assertions on the resulting UI.
1 parent 1acdbf1 commit a244aa9

3 files changed

Lines changed: 31 additions & 15 deletions

File tree

‎tests/contracts/test_pages_report_history.mjs‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ test('keeps visual E2E interactions at task level with proven tap exceptions', a
142142
'utf8',
143143
);
144144
const oneShotActions = source.match(
145-
/^\s+-\s+(?:aiTap|aiScroll|aiInput|computer\.inputText|computer\.tapPoint):.*$/gm,
145+
/^\s+-\s+(?:aiTap|aiScroll|aiInput|computer\.inputText|computer\.tapPoint|computer\.selectTriggerPreset):.*$/gm,
146146
) ?? [];
147147
assert.deepEqual(
148148
oneShotActions.map((line) => line.trim()),
@@ -167,12 +167,11 @@ test('keeps visual E2E interactions at task level with proven tap exceptions', a
167167
'- aiTap: The large blue full-width Open Doubao sign-in button near the bottom of the central Sign in panel, around 50% width and 73% screen height',
168168
'- aiTap: The blue Simulate successful sign-in button in the CI-only modal, around 50% width and 43% screen height',
169169
'- aiTap: Left-arrow Previous button in the fixed top navigation',
170-
'- aiTap: The trigger selection dropdown currently showing fn',
171-
'- aiTap: Disabled option in the open trigger selection dropdown',
172-
'- aiTap: Right-arrow Next button in the fixed top navigation',
173-
'- aiTap: The trigger selection dropdown currently showing Disabled',
174-
'- aiTap: F8 option in the open trigger selection dropdown',
175-
'- aiTap: Left-arrow Previous button in the fixed top navigation',
170+
'- computer.selectTriggerPreset: { preset: Disabled }',
171+
'- computer.tapPoint: { target: Right-arrow Next button in the fixed top navigation, point: { x: 1038, y: 203 } }',
172+
'- computer.selectTriggerPreset: { preset: F8 }',
173+
'- computer.tapPoint: { target: Right-arrow Next button in the fixed top navigation, point: { x: 1038, y: 203 } }',
174+
'- computer.tapPoint: { target: Left-arrow Previous button in the fixed top navigation, point: { x: 240, y: 203 } }',
176175
'- aiScroll:',
177176
'- computer.tapPoint: { target: Enabled Voice polishing switch, point: { x: 1180, y: 316 } }',
178177
'- computer.tapPoint: { target: Disabled Voice polishing switch, point: { x: 1180, y: 316 } }',

‎tests/e2e/cases/onboarding-regressions.yaml‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,17 @@ cases:
4747
steps:
4848
- fixture.prepare: { mode: trigger-settings }
4949
- aiAssert: The Trigger key step shows Choose how to start speaking and Voice polishing is enabled.
50-
- aiTap: The trigger selection dropdown currently showing fn
51-
- aiTap: Disabled option in the open trigger selection dropdown
52-
- aiAssert: Active trigger says Disabled and Voice polishing has not changed.
53-
- aiTap: Right-arrow Next button in the fixed top navigation
50+
- computer.selectTriggerPreset: { preset: Disabled }
51+
- aiAssert: Active trigger says Disabled, and the Voice polishing switch remains enabled.
52+
- computer.tapPoint: { target: Right-arrow Next button in the fixed top navigation, point: { x: 1038, y: 203 } }
5453
- aiAssert: The current step is still Trigger key and the message Choose an enabled trigger to continue is visible.
55-
- aiTap: The trigger selection dropdown currently showing Disabled
56-
- aiTap: F8 option in the open trigger selection dropdown
54+
- computer.selectTriggerPreset: { preset: F8 }
5755
- aiAssert: Active trigger shows F8 and F8 is selected in the trigger dropdown.
58-
- aiAct: Continue to Voice test.
56+
- computer.tapPoint: { target: Right-arrow Next button in the fixed top navigation, point: { x: 1038, y: 203 } }
5957
- aiWaitFor:
6058
prompt: Voice test shows Try a sentence. Nothing gets pasted and the right-arrow Next button is disabled.
6159
options: { timeoutMs: 30000, checkIntervalMs: 1000 }
62-
- aiTap: Left-arrow Previous button in the fixed top navigation
60+
- computer.tapPoint: { target: Left-arrow Previous button in the fixed top navigation, point: { x: 240, y: 203 } }
6361
- aiWaitFor:
6462
prompt: The Trigger key step is visible again.
6563
options: { timeoutMs: 30000, checkIntervalMs: 1000 }

‎tests/e2e/midscene.config.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ const tapPoint = z.strictObject({
221221
target: z.string().min(1),
222222
point: z.strictObject({ x: z.number(), y: z.number() }),
223223
});
224+
const triggerPreset = z.strictObject({
225+
preset: z.enum(['Disabled', 'F8']),
226+
});
224227
const prepareFixture = defineNode<typeof fixtureMode, void, DesktopContext>({
225228
name: 'fixture.prepare',
226229
description: 'Select deterministic synthetic state for this test case.',
@@ -280,6 +283,21 @@ const tapFixedPoint = defineNode<typeof tapPoint, void, DesktopContext>({
280283
await context.agent.interface.inputPrimitives.pointer.tap(input.point);
281284
},
282285
});
286+
const selectTriggerPreset = defineNode<typeof triggerPreset, void, DesktopContext>({
287+
name: 'computer.selectTriggerPreset',
288+
description: 'Select a trigger preset through the GTK dropdown in the fixed Omarchy fixture.',
289+
inputSchema: triggerPreset,
290+
async execute({ context, input }) {
291+
if (!context.agent || context.environment !== 'omarchy') {
292+
throw new Error('Omarchy Computer Agent is not active');
293+
}
294+
await context.agent.interface.inputPrimitives.pointer.tap({ x: 640, y: 498 });
295+
await sleep(250);
296+
const keys = ['Home', ...Array(input.preset === 'F8' ? 6 : 0).fill('Down'), 'Return'];
297+
guest(keys.map((key) => `wtype -k ${key}`).join('; '));
298+
await sleep(250);
299+
},
300+
});
283301
const openSystemMenu = defineNode<typeof empty, void, DesktopContext>({
284302
name: 'shell.openSystemMenu', description: 'Open the real Omarchy system menu and focus one row.', inputSchema: empty,
285303
async execute() {
@@ -392,6 +410,7 @@ export default defineTestProject<DesktopContext>({
392410
pressKeyboardKey,
393411
inputTextField,
394412
tapFixedPoint,
413+
selectTriggerPreset,
395414
openSystemMenu,
396415
closeSystemMenu,
397416
moveBarLeft,

0 commit comments

Comments
 (0)