Skip to content

Commit 818cddb

Browse files
committed
test(e2e): render smoke assertion as native Midscene step
1 parent c5f9712 commit 818cddb

5 files changed

Lines changed: 22 additions & 12 deletions

File tree

‎.github/workflows/midscene-omarchy-4.0.3.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ on:
2525
- "tests/e2e/cases/**"
2626
- "tests/e2e/midscene.config.ts"
2727
- "tests/e2e/model-rate-gate.mjs"
28+
- "tests/e2e/render-omarchy-plugin-smoke.mjs"
2829
- "tests/e2e/run-omarchy-midscene.sh"
2930
- "tests/e2e/restore-omarchy-vm.sh"
3031
- "tests/e2e/omarchy-vm.env"

‎tests/e2e/cases/omarchy-plugin-smoke.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ cases:
22
- name: Review a pinned community plugin on the real Omarchy desktop
33
steps:
44
- review.openConfigured: {}
5-
- review.assertConfiguredVisual: {}
5+
- aiAssert: __REVIEW_VISIBLE_ASSERTION__

‎tests/e2e/midscene.config.ts‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -387,15 +387,6 @@ const openConfiguredReviewPlugin = defineNode<typeof empty, void, DesktopContext
387387
throw new Error(`Plugin IPC did not become ready: ${String(lastError)}`);
388388
},
389389
});
390-
const assertConfiguredReviewPlugin = defineNode<typeof empty, void, DesktopContext>({
391-
name: 'review.assertConfiguredVisual', description: 'Assert the caller-provided visible behavior on the real Omarchy desktop.', inputSchema: empty,
392-
async execute({ context }) {
393-
const assertion = process.env.REVIEW_VISIBLE_ASSERTION;
394-
if (!assertion || assertion.length > 500) throw new Error('REVIEW_VISIBLE_ASSERTION must be 1–500 characters');
395-
if (!context.agent) throw new Error('Midscene Computer Agent is not active');
396-
await context.agent.aiAssert(assertion);
397-
},
398-
});
399390

400391
const productCaseFiles = [
401392
'cases/onboarding.yaml',
@@ -510,6 +501,5 @@ export default defineTestProject<DesktopContext>({
510501
openReviewPlugin,
511502
assertReviewPluginEmpty,
512503
openConfiguredReviewPlugin,
513-
assertConfiguredReviewPlugin,
514504
],
515505
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { readFileSync, writeFileSync } from 'node:fs';
2+
import { fileURLToPath } from 'node:url';
3+
4+
const assertion = process.env.REVIEW_VISIBLE_ASSERTION;
5+
if (!assertion || assertion.length > 500) {
6+
throw new Error('REVIEW_VISIBLE_ASSERTION must be 1–500 characters');
7+
}
8+
9+
const casePath = fileURLToPath(new URL('./cases/omarchy-plugin-smoke.yaml', import.meta.url));
10+
const source = readFileSync(casePath, 'utf8');
11+
const placeholder = '__REVIEW_VISIBLE_ASSERTION__';
12+
if (source.split(placeholder).length !== 2) {
13+
throw new Error('Plugin smoke case must contain one assertion placeholder');
14+
}
15+
writeFileSync(casePath, source.replace(placeholder, JSON.stringify(assertion)));

‎tests/e2e/run-omarchy-midscene.sh‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,11 @@ case "$MIDSCENE_PROJECT" in
281281
omarchy-shard-[1-4])
282282
npm --prefix tests/e2e test -- --project "$MIDSCENE_PROJECT"
283283
;;
284-
omarchy-shell|omarchy-plugin-review|omarchy-plugin-smoke)
284+
omarchy-plugin-smoke)
285+
node tests/e2e/render-omarchy-plugin-smoke.mjs
286+
npm --prefix tests/e2e test -- --project "$MIDSCENE_PROJECT"
287+
;;
288+
omarchy-shell|omarchy-plugin-review)
285289
npm --prefix tests/e2e test -- --project "$MIDSCENE_PROJECT"
286290
;;
287291
*)

0 commit comments

Comments
 (0)