Skip to content

Doubao-powered voice input for Linux, Wayland and Omarchy

test(midscene): verify Omarchy shell visuals with AI

Leyangee31a53dc0c3
diff --git a/.github/workflows/deploy-midscene-report.yml b/.github/workflows/deploy-midscene-report.yml
index e2448ec..259eaa5 100644
--- a/.github/workflows/deploy-midscene-report.yml
+++ b/.github/workflows/deploy-midscene-report.yml
@@ -99,6 +99,19 @@ jobs:
env:
HISTORY_URL: ${{ steps.pages.outputs.base_url }}/
REPORT_URL: ${{ steps.pages.outputs.base_url }}/reports/${{ github.run_id }}/index.html
+ MENU_IMAGE_URL: ${{ steps.pages.outputs.base_url }}/reports/${{ github.run_id }}/menu.jpg
run: |
- echo "- [Open this run's report]($REPORT_URL)" >> "$GITHUB_STEP_SUMMARY"
- echo "- [Browse report history]($HISTORY_URL)" >> "$GITHUB_STEP_SUMMARY"
+ if [[ "${{ inputs.report-label }}" == Omarchy* ]]; then
+ cat >> "$GITHUB_STEP_SUMMARY" <<EOF
+ ## Omarchy × Midscene · visual report
+
+ [**Open the interactive HTML showcase →**]($REPORT_URL) · [Report history]($HISTORY_URL)
+
+ [![Real Omarchy system menu tested by Midscene]($MENU_IMAGE_URL)]($REPORT_URL)
+
+ The showcase embeds the complete Midscene replay and includes the menu and vertical bar screenshots.
+ EOF
+ else
+ echo "- [Open this run's report]($REPORT_URL)" >> "$GITHUB_STEP_SUMMARY"
+ echo "- [Browse report history]($HISTORY_URL)" >> "$GITHUB_STEP_SUMMARY"
+ fi
diff --git a/.github/workflows/midscene-omarchy-4.0.3.yml b/.github/workflows/midscene-omarchy-4.0.3.yml
index bd8a4a9..7ae6818 100644
--- a/.github/workflows/midscene-omarchy-4.0.3.yml
+++ b/.github/workflows/midscene-omarchy-4.0.3.yml
@@ -8,6 +8,8 @@ on:
- ".github/workflows/midscene-omarchy-4.0.3.yml"
- ".github/workflows/deploy-midscene-report.yml"
- "scripts/build-pages-report.mjs"
+ - "scripts/build-omarchy-summary.mjs"
+ - "scripts/omarchy-shell-evidence.mjs"
- "tests/test_pages_report_history.mjs"
- "tests/midscene/package.json"
- "tests/midscene/package-lock.json"
@@ -28,6 +30,8 @@ on:
- ".github/workflows/midscene-omarchy-4.0.3.yml"
- ".github/workflows/deploy-midscene-report.yml"
- "scripts/build-pages-report.mjs"
+ - "scripts/build-omarchy-summary.mjs"
+ - "scripts/omarchy-shell-evidence.mjs"
- "tests/test_pages_report_history.mjs"
- "tests/midscene/package.json"
- "tests/midscene/package-lock.json"
@@ -54,7 +58,7 @@ concurrency:
jobs:
omarchy-vm:
- name: Midscene onboarding
+ name: Midscene onboarding and shell visuals
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
timeout-minutes: 70
@@ -130,6 +134,7 @@ jobs:
retention-days: 3
- name: Upload Omarchy Midscene report
+ id: report
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
@@ -138,6 +143,12 @@ jobs:
if-no-files-found: warn
retention-days: 7
+ - name: Show visual results on the CI run page
+ if: success()
+ env:
+ REPORT_ARTIFACT_URL: ${{ steps.report.outputs.artifact-url }}
+ run: node scripts/build-omarchy-summary.mjs tests/midscene/midscene_run
+
pages-report:
name: GitHub Pages report
needs: omarchy-vm
diff --git a/scripts/build-omarchy-summary.mjs b/scripts/build-omarchy-summary.mjs
new file mode 100644
index 0000000..1c3f786
--- /dev/null
+++ b/scripts/build-omarchy-summary.mjs
@@ -0,0 +1,36 @@
+#!/usr/bin/env node
+
+import { appendFile } from 'node:fs/promises';
+import { findShellReport } from './omarchy-shell-evidence.mjs';
+
+const reportDirectory = process.argv[2];
+const summaryFile = process.env.GITHUB_STEP_SUMMARY;
+if (!reportDirectory || !summaryFile) {
+ throw new Error(
+ 'Usage: GITHUB_STEP_SUMMARY=... node scripts/build-omarchy-summary.mjs REPORT_DIR',
+ );
+}
+
+const { checks } = await findShellReport(reportDirectory);
+const passed = checks.filter((check) => check.passed).length;
+const runUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
+const artifactUrl = process.env.REPORT_ARTIFACT_URL || runUrl;
+
+await appendFile(
+ summaryFile,
+ `# Omarchy × Midscene · real desktop visual test
+
+### ${passed}/${checks.length} visual assertions passed in Omarchy 4.0.3 / Hyprland
+
+| Scene | Visible result | Midscene |
+| --- | --- | --- |
+${checks.map((check) => `| ${check.label} | ${check.passed ? '✅ Passed' : '❌ Failed'} | VLM screenshot assertion |`).join('\n')}
+
+**Real VM:** official Omarchy ISO → KVM → Hyprland/Wayland → VNC → Midscene on X11.
+**Evidence:** [Download the complete interactive HTML replay](${artifactUrl}) · [Open CI run](${runUrl}).
+
+The replay contains the actual desktop screenshots, model judgments, and step timeline. The GitHub Pages job publishes a browser-ready showcase for successful main-branch runs.
+`,
+);
+
+if (passed !== checks.length) process.exitCode = 1;
diff --git a/scripts/build-pages-report.mjs b/scripts/build-pages-report.mjs
index ffb082b..25df2ee 100644
--- a/scripts/build-pages-report.mjs
+++ b/scripts/build-pages-report.mjs
@@ -1,8 +1,19 @@
#!/usr/bin/env node
-import { copyFile, mkdir, readFile, readdir, writeFile } from 'node:fs/promises';
+import {
+ copyFile,
+ mkdir,
+ readFile,
+ readdir,
+ writeFile,
+} from 'node:fs/promises';
import path from 'node:path';
import process from 'node:process';
+import {
+ extractShellEvidence,
+ findHtmlFiles,
+ reportDumps,
+} from './omarchy-shell-evidence.mjs';
const MANIFEST_VERSION = 1;
@@ -53,27 +64,8 @@ function normalizeBaseUrl(value) {
return url;
}
-async function findHtmlFiles(directory) {
- const results = [];
- async function visit(current) {
- for (const entry of await readdir(current, { withFileTypes: true })) {
- const item = path.join(current, entry.name);
- if (entry.isDirectory()) {
- await visit(item);
- } else if (entry.isFile() && entry.name.endsWith('.html')) {
- results.push(item);
- }
- }
- }
- await visit(directory);
- return results;
-}
-
function collectModelUsage(reportHtml) {
const calls = new Map();
- const dumps = reportHtml.matchAll(
- /<script\s+type=["']midscene_web_dump["'][^>]*>\s*(\{[\s\S]*?)<\/script>/g,
- );
function visit(value) {
if (Array.isArray(value)) {
@@ -89,48 +81,16 @@ function collectModelUsage(reportHtml) {
if (typeof callId === 'string' && !calls.has(callId)) {
calls.set(callId, {
durationMs: Number.isFinite(usage.time_cost) ? usage.time_cost : null,
- tokens: Number.isFinite(usage.total_tokens) ? usage.total_tokens : null,
+ tokens: Number.isFinite(usage.total_tokens)
+ ? usage.total_tokens
+ : null,
});
}
}
Object.values(value).forEach(visit);
}
- function normalizeJsonControlCharacters(source) {
- let normalized = '';
- let insideString = false;
- let escaped = false;
- for (const character of source) {
- if (!insideString) {
- normalized += character;
- if (character === '"') insideString = true;
- continue;
- }
- if (escaped) {
- normalized += character;
- escaped = false;
- } else if (character === '\\') {
- normalized += character;
- escaped = true;
- } else if (character === '"') {
- normalized += character;
- insideString = false;
- } else if (character.charCodeAt(0) <= 0x1f) {
- normalized += `\\u${character.charCodeAt(0).toString(16).padStart(4, '0')}`;
- } else {
- normalized += character;
- }
- }
- return normalized;
- }
-
- for (const match of dumps) {
- try {
- visit(JSON.parse(normalizeJsonControlCharacters(match[1])));
- } catch (error) {
- throw new Error(`Cannot parse embedded Midscene report data: ${error.message}`);
- }
- }
+ for (const dump of reportDumps(reportHtml)) visit(dump);
const durations = [...calls.values()]
.map((call) => call.durationMs)
@@ -141,7 +101,10 @@ function collectModelUsage(reportHtml) {
return {
modelCallCount: calls.size,
averageDurationMs: durations.length
- ? Math.round(durations.reduce((sum, duration) => sum + duration, 0) / durations.length)
+ ? Math.round(
+ durations.reduce((sum, duration) => sum + duration, 0) /
+ durations.length,
+ )
: null,
tokenUsage: tokens.length
? tokens.reduce((sum, tokenCount) => sum + tokenCount, 0)
@@ -162,9 +125,19 @@ function validateHistoryManifest(manifest) {
typeof report.runId !== 'string' ||
!/^\d+$/.test(report.runId) ||
report.reportPath !== `reports/${report.runId}/index.html` ||
- typeof report.workflowUrl !== 'string'
+ typeof report.workflowUrl !== 'string' ||
+ (report.files !== undefined &&
+ (!Array.isArray(report.files) ||
+ report.files.some(
+ (file) =>
+ typeof file !== 'string' ||
+ !/^reports\/\d+\/[a-z0-9.-]+$/.test(file) ||
+ !file.startsWith(`reports/${report.runId}/`),
+ )))
) {
- throw new Error('Existing Pages manifest contains an invalid report entry');
+ throw new Error(
+ 'Existing Pages manifest contains an invalid report entry',
+ );
}
}
return manifest;
@@ -177,7 +150,9 @@ async function fetchHistory(baseUrl) {
return [];
}
if (!response.ok) {
- throw new Error(`Cannot download existing manifest: HTTP ${response.status}`);
+ throw new Error(
+ `Cannot download existing manifest: HTTP ${response.status}`,
+ );
}
let manifest;
try {
@@ -189,23 +164,28 @@ async function fetchHistory(baseUrl) {
}
async function restoreReport(baseUrl, siteDirectory, report) {
- const response = await fetch(new URL(report.reportPath, baseUrl), {
- redirect: 'follow',
- });
- if (!response.ok) {
- throw new Error(
- `Cannot restore report for run ${report.runId}: HTTP ${response.status}`,
- );
- }
- const contentType = response.headers.get('content-type') ?? '';
- if (!contentType.toLowerCase().includes('text/html')) {
- throw new Error(
- `Cannot restore report for run ${report.runId}: expected text/html, got ${contentType || 'no Content-Type'}`,
- );
+ for (const file of report.files ?? [report.reportPath]) {
+ const response = await fetch(new URL(file, baseUrl), {
+ redirect: 'follow',
+ });
+ if (!response.ok) {
+ throw new Error(
+ `Cannot restore report for run ${report.runId}: HTTP ${response.status}`,
+ );
+ }
+ const contentType = response.headers.get('content-type') ?? '';
+ if (
+ file.endsWith('.html') &&
+ !contentType.toLowerCase().includes('text/html')
+ ) {
+ throw new Error(
+ `Cannot restore report for run ${report.runId}: expected text/html, got ${contentType || 'no Content-Type'}`,
+ );
+ }
+ const destination = path.join(siteDirectory, file);
+ await mkdir(path.dirname(destination), { recursive: true });
+ await writeFile(destination, Buffer.from(await response.arrayBuffer()));
}
- const destination = path.join(siteDirectory, report.reportPath);
- await mkdir(path.dirname(destination), { recursive: true });
- await writeFile(destination, Buffer.from(await response.arrayBuffer()));
}
function escapeHtml(value) {
@@ -222,6 +202,64 @@ function formatDuration(durationMs) {
return `${(durationMs / 1000).toFixed(2)} s`;
}
+function buildOmarchyShowcase(checks, workflowUrl) {
+ const rows = checks
+ .map(
+ (check) => `
+ <div class="check"><span class="check-mark">✓</span><span>${escapeHtml(check.label)}</span><strong>PASS</strong></div>`,
+ )
+ .join('');
+ return `<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>Omarchy × Midscene — Visual acceptance</title>
+ <style>
+ :root { font-family: Inter, ui-sans-serif, system-ui, sans-serif; color: #eef2ff; background: #080b16; }
+ * { box-sizing: border-box; } body { margin: 0; } a { color: inherit; }
+ main { max-width: 1360px; padding: 44px 28px 100px; margin: auto; }
+ .eyebrow { color: #a6a9ff; letter-spacing: .18em; font-size: 12px; font-weight: 800; text-transform: uppercase; }
+ h1 { font-size: clamp(42px, 6vw, 84px); letter-spacing: -.065em; line-height: 1.02; margin: 18px 0; }
+ h1 em { color: #a7f3d0; font-style: normal; } .lead { color: #a9b3c9; font-size: 20px; max-width: 760px; line-height: 1.6; }
+ .hero { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 40px; margin-bottom: 34px; }
+ .score { padding: 24px 32px; background: #152b29; border: 1px solid #3b8a72; border-radius: 20px; min-width: 210px; }
+ .score b { display: block; font-size: 58px; letter-spacing: -.06em; color: #a7f3d0; line-height: 1; }
+ .score span { color: #c5ded3; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
+ .pipeline { display: flex; flex-wrap: wrap; gap: 8px; margin: 34px 0; }
+ .pipeline span { padding: 10px 14px; border-radius: 999px; background: #151b2c; border: 1px solid #343c54; color: #c8d0e2; font-size: 13px; }
+ .grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(290px, 1fr); gap: 18px; }
+ .panel { overflow: hidden; border: 1px solid #303953; background: #111727; border-radius: 20px; }
+ .panel img { width: 100%; display: block; object-fit: contain; background: #080b16; }
+ .panel .caption { padding: 18px 20px; color: #b8c4d9; } .caption b { color: white; display: block; margin-bottom: 4px; }
+ .checks { margin-top: 18px; padding: 20px 24px; } .check { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid #293248; }
+ .check:last-child { border: 0; }.check-mark { color: #a7f3d0; font-size: 22px; }.check strong { margin-left: auto; color: #a7f3d0; font-size: 12px; letter-spacing: .12em; }
+ h2 { margin: 70px 0 16px; font-size: 30px; letter-spacing: -.035em; } .muted { color: #a9b3c9; line-height: 1.6; }
+ .button { display: inline-block; text-decoration: none; background: #b4a7ff; color: #0b0c18; border-radius: 10px; padding: 12px 18px; font-weight: 800; margin: 12px 12px 16px 0; }
+ .button.secondary { background: #25304a; color: #e5e9ff; }
+ iframe { width: 100%; height: 820px; border: 1px solid #3f4960; border-radius: 16px; background: white; }
+ @media (max-width: 800px) { .hero, .grid { grid-template-columns: 1fr; } main { padding: 26px 16px 70px; } }
+ </style>
+</head>
+<body><main>
+ <div class="eyebrow">Real desktop · Visual acceptance · Omarchy 4.0.3</div>
+ <div class="hero"><div><h1>Omarchy <em>×</em> Midscene</h1>
+ <p class="lead">Midscene judged the pixels of a real Hyprland desktop: readable menu text, clean focus styling, and a correctly placed vertical bar.</p></div>
+ <div class="score"><b>3 / 3</b><span>visual assertions passed</span></div></div>
+ <div class="pipeline"><span>Official Omarchy ISO</span><span>→ KVM guest</span><span>→ Hyprland / Wayland</span><span>→ VNC bridge</span><span>→ Midscene VLM</span><span>→ HTML replay</span></div>
+ <div class="grid">
+ <div class="panel"><img src="menu.jpg" alt="Real Omarchy system menu with Shutdown visible and one focused row"><div class="caption"><b>System menu · real VM screenshot</b>Shutdown is legible; one menu row has a visible focus highlight.</div></div>
+ <div><div class="panel"><img src="bar.jpg" alt="Omarchy bar docked vertically on the left edge"><div class="caption"><b>Bar position · real VM screenshot</b>The bar is vertical and docked to the left edge.</div></div>
+ <div class="panel checks">${rows}</div></div>
+ </div>
+ <h2>Watch the actual Midscene replay</h2>
+ <p class="muted">The embedded report below includes each screenshot, the assertion prompt, the model result, and the execution timeline. The onboarding run is available separately.</p>
+ <a class="button" href="shell-report.html" target="_blank" rel="noopener">Open full shell report ↗</a>
+ <a class="button secondary" href="onboarding-report.html" target="_blank" rel="noopener">Open onboarding report ↗</a>
+ <a class="button secondary" href="${escapeHtml(workflowUrl)}">View CI run ↗</a>
+ <iframe src="shell-report.html" title="Interactive Midscene shell report" loading="lazy"></iframe>
+</main></body></html>`;
+}
+
function buildIndex(reports) {
const rows = reports
.map(
@@ -294,20 +332,57 @@ export async function buildPagesReport(options) {
}
const htmlFiles = await findHtmlFiles(reportDirectory);
- if (htmlFiles.length !== 1) {
- throw new Error(`Expected exactly one report HTML file, found ${htmlFiles.length}`);
+ if (htmlFiles.length < 1 || htmlFiles.length > 2) {
+ throw new Error(
+ `Expected one or two report HTML files, found ${htmlFiles.length}`,
+ );
}
- const reportHtml = await readFile(htmlFiles[0], 'utf8');
- const usage = collectModelUsage(reportHtml);
+ const htmlReports = await Promise.all(
+ htmlFiles.map(async (file) => ({
+ file,
+ html: await readFile(file, 'utf8'),
+ })),
+ );
+ const shellReport = htmlReports.find((report) =>
+ report.html.includes('The Omarchy system menu is open'),
+ );
+ if (htmlFiles.length === 2 && !shellReport) {
+ throw new Error(
+ 'Two reports were found but the Omarchy shell report is missing',
+ );
+ }
+ const checks =
+ shellReport && htmlFiles.length === 2
+ ? extractShellEvidence(shellReport.html)
+ : null;
+ if (checks?.some((check) => !check.passed)) {
+ throw new Error(
+ 'Cannot publish a passing showcase with failed visual assertions',
+ );
+ }
+ const usage = collectModelUsage(
+ htmlReports.map((report) => report.html).join('\n'),
+ );
+ const reportPrefix = `reports/${runId}`;
+ const files = checks
+ ? [
+ 'index.html',
+ 'shell-report.html',
+ 'onboarding-report.html',
+ 'menu.jpg',
+ 'bar.jpg',
+ ].map((name) => `${reportPrefix}/${name}`)
+ : [`${reportPrefix}/index.html`];
const current = {
runId,
generatedAt,
label,
successRate: 100,
- testCount: 1,
+ testCount: checks ? 3 : 1,
...usage,
workflowUrl,
reportPath: `reports/${runId}/index.html`,
+ files,
};
const history = (await fetchHistory(baseUrl))
@@ -319,9 +394,35 @@ export async function buildPagesReport(options) {
await restoreReport(baseUrl, siteDirectory, report);
}
- const currentDestination = path.join(siteDirectory, current.reportPath);
- await mkdir(path.dirname(currentDestination), { recursive: true });
- await copyFile(htmlFiles[0], currentDestination);
+ const currentDirectory = path.join(siteDirectory, reportPrefix);
+ await mkdir(currentDirectory, { recursive: true });
+ if (checks) {
+ const onboardingReport = htmlReports.find(
+ (report) => report !== shellReport,
+ );
+ await copyFile(
+ shellReport.file,
+ path.join(currentDirectory, 'shell-report.html'),
+ );
+ await copyFile(
+ onboardingReport.file,
+ path.join(currentDirectory, 'onboarding-report.html'),
+ );
+ await writeFile(
+ path.join(currentDirectory, 'menu.jpg'),
+ checks[1].screenshot.bytes,
+ );
+ await writeFile(
+ path.join(currentDirectory, 'bar.jpg'),
+ checks[2].screenshot.bytes,
+ );
+ await writeFile(
+ path.join(currentDirectory, 'index.html'),
+ buildOmarchyShowcase(checks, workflowUrl),
+ );
+ } else {
+ await copyFile(htmlFiles[0], path.join(currentDirectory, 'index.html'));
+ }
const reports = [current, ...history];
const manifest = {
diff --git a/scripts/omarchy-shell-evidence.mjs b/scripts/omarchy-shell-evidence.mjs
new file mode 100644
index 0000000..50dddb1
--- /dev/null
+++ b/scripts/omarchy-shell-evidence.mjs
@@ -0,0 +1,120 @@
+import { readFile, readdir } from 'node:fs/promises';
+import path from 'node:path';
+
+export const SHELL_CHECKS = [
+ {
+ key: 'shutdown',
+ label: 'Shutdown is readable',
+ marker: 'The Omarchy system menu is open',
+ },
+ {
+ key: 'focus',
+ label: 'Menu focus highlight is clean',
+ marker: 'Exactly one row in the open system menu',
+ },
+ {
+ key: 'bar',
+ label: 'Bar is vertical on the left',
+ marker: 'The Omarchy bar is visible',
+ },
+];
+
+export async function findHtmlFiles(directory) {
+ const results = [];
+ async function visit(current) {
+ for (const entry of await readdir(current, { withFileTypes: true })) {
+ const item = path.join(current, entry.name);
+ if (entry.isDirectory()) await visit(item);
+ else if (entry.isFile() && entry.name.endsWith('.html'))
+ results.push(item);
+ }
+ }
+ await visit(directory);
+ return results.sort();
+}
+
+// Some report versions put raw control characters inside JSON strings.
+export function normalizeJsonControlCharacters(source) {
+ let normalized = '';
+ let insideString = false;
+ let escaped = false;
+ for (const character of source) {
+ if (!insideString) {
+ normalized += character;
+ if (character === '"') insideString = true;
+ continue;
+ }
+ if (escaped) {
+ normalized += character;
+ escaped = false;
+ } else if (character === '\\') {
+ normalized += character;
+ escaped = true;
+ } else if (character === '"') {
+ normalized += character;
+ insideString = false;
+ } else if (character.charCodeAt(0) <= 0x1f) {
+ normalized += `\\u${character.charCodeAt(0).toString(16).padStart(4, '0')}`;
+ } else {
+ normalized += character;
+ }
+ }
+ return normalized;
+}
+
+export function reportDumps(html) {
+ return [
+ ...html.matchAll(
+ /<script\s+type=["']midscene_web_dump["'][^>]*>\s*(\{[\s\S]*?)<\/script>/g,
+ ),
+ ].map((match) => JSON.parse(normalizeJsonControlCharacters(match[1])));
+}
+
+export function extractShellEvidence(html) {
+ const images = new Map();
+ for (const match of html.matchAll(
+ /<script\s+type=["']midscene-image["']\s+data-id=["']([^"']+)["'][^>]*>\s*data:image\/(png|jpeg);base64,([A-Za-z0-9+/=]+)\s*<\/script>/g,
+ )) {
+ images.set(match[1], {
+ extension: match[2] === 'jpeg' ? 'jpg' : 'png',
+ bytes: Buffer.from(match[3], 'base64'),
+ });
+ }
+
+ const finished = new Map();
+ for (const dump of reportDumps(html)) {
+ for (const execution of dump.executions ?? []) {
+ for (const task of execution.tasks ?? []) {
+ if (task.status !== 'finished' || task.subType !== 'Assert') continue;
+ const demand = task.param?.dataDemand;
+ if (typeof demand === 'string') finished.set(demand, task);
+ }
+ }
+ }
+
+ return SHELL_CHECKS.map((check) => {
+ const entry = [...finished.entries()].find(([demand]) =>
+ demand.startsWith(check.marker),
+ );
+ if (!entry)
+ throw new Error(`Missing finished Omarchy assertion: ${check.label}`);
+ const task = entry[1];
+ const screenshot = images.get(task.uiContext?.screenshot?.id);
+ if (!screenshot)
+ throw new Error(`Missing Omarchy screenshot: ${check.label}`);
+ return { ...check, passed: task.output === true, screenshot };
+ });
+}
+
+export async function findShellReport(directory) {
+ for (const file of await findHtmlFiles(directory)) {
+ const html = await readFile(file, 'utf8');
+ if (
+ html.includes(SHELL_CHECKS[0].marker) &&
+ html.includes(SHELL_CHECKS[2].marker)
+ ) {
+ return { file, html, checks: extractShellEvidence(html) };
+ }
+ }
+ throw new Error('No Omarchy shell Midscene HTML report found');
+}
diff --git a/tests/midscene/README.md b/tests/midscene/README.md
index f5501e9..ae6ed17 100644
--- a/tests/midscene/README.md
+++ b/tests/midscene/README.md
@@ -2,7 +2,7 @@
GitHub Actions exposes two distribution-named suites: `Ubuntu 22.04` and
`Omarchy 4.0.3`. Both run for trusted pull requests and relevant pushes to
-`main`, and both execute the same shared onboarding acceptance flow.
+`main`. The Omarchy suite also checks the real desktop shell visually.
The image-builder CI proves that a GitHub-hosted runner can install the exact
official Omarchy ISO in a headless QEMU/KVM VM. It reuses Omarchy's own ISO
@@ -61,3 +61,26 @@ uploaded as a private workflow artifact for every run.
The AI stage needs a multimodal model credential. Its `MIDSCENE_MODEL_*`
configuration is stored only as GitHub Actions Secrets; tests contain only
synthetic data.
+
+## Omarchy shell visual PoC
+
+After onboarding, the Omarchy job opens the real system menu through Omarchy's
+shell IPC and uses Midscene's VNC view to assert that **Shutdown** is readable
+and one menu row has a clean focus highlight. It then sets the bar to the left,
+asserts that the rendered bar is vertical and docked to the left edge, and
+restores the original bar configuration. The HTML replay is included in the
+`omarchy-midscene-e2e-report` artifact. The Actions run summary shows the
+three visual verdicts directly. Successful runs on `main` publish a Pages
+showcase with the actual screenshots and an embedded interactive shell replay;
+the full onboarding replay remains available from the same page.
+
+| Omarchy acceptance test today | Midscene visual check |
+| --- | --- |
+| `screen_contains "Shutdown"`: enlarge a `grim` image, run Tesseract, and grep for text | `agent.aiAssert` checks that Shutdown is legible in the rendered system menu |
+| `hyprctl -j layers` and `bar_is_vertical`: compare layer dimensions | `agent.aiAssert` checks the visible bar's shape and left-edge placement |
+| Standalone `grim` PNGs | Step-by-step HTML replay with assertions and screenshots |
+
+The SSH and `hyprctl` calls in this PoC set up the scene and wait for the menu;
+the three user-visible conclusions come from Midscene's image assertions. The
+guest runs Hyprland/Wayland; Midscene operates an X11 VNC viewer on the host.
+This demonstrates visual testing of a Wayland desktop through a VM bridge.
diff --git a/tests/midscene/e2e/omarchy-system-menu.test.ts b/tests/midscene/e2e/omarchy-system-menu.test.ts
new file mode 100644
index 0000000..1bce7f4
--- /dev/null
+++ b/tests/midscene/e2e/omarchy-system-menu.test.ts
@@ -0,0 +1,156 @@
+import { type ChildProcess, execFileSync, spawn } from 'node:child_process';
+import { type ComputerAgent, agentFromComputer } from '@midscene/computer';
+import { afterAll, beforeAll, describe, it } from '@rstest/core';
+
+const sleep = (milliseconds: number) =>
+ new Promise((resolvePromise) => setTimeout(resolvePromise, milliseconds));
+
+const stopProcessGroup = (child?: ChildProcess) => {
+ if (!child?.pid) return;
+ try {
+ process.kill(-child.pid, 'SIGTERM');
+ } catch {
+ // The process may already have exited after a test failure.
+ }
+};
+
+const guest = (command: string) => {
+ const key = process.env.OMARCHY_SSH_KEY;
+ if (!key) throw new Error('OMARCHY_SSH_KEY is required for the Omarchy E2E');
+ const sessionEnvironment = [
+ 'export XDG_RUNTIME_DIR=/run/user/$(id -u);',
+ 'export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus;',
+ 'export HYPRLAND_INSTANCE_SIGNATURE=$(ls -t "$XDG_RUNTIME_DIR/hypr" | head -1);',
+ 'export WAYLAND_DISPLAY=$(find "$XDG_RUNTIME_DIR" -maxdepth 1 -name "wayland-*" ! -name "*.lock" -printf "%f\\n" | head -1);',
+ 'export OMARCHY_PATH=/usr/share/omarchy;',
+ 'export PATH="$OMARCHY_PATH/bin:$PATH";',
+ ].join(' ');
+
+ return execFileSync(
+ 'ssh',
+ [
+ '-i',
+ key,
+ '-p',
+ '2222',
+ '-o',
+ 'BatchMode=yes',
+ '-o',
+ 'IdentitiesOnly=yes',
+ '-o',
+ 'StrictHostKeyChecking=no',
+ '-o',
+ 'UserKnownHostsFile=/dev/null',
+ '-o',
+ 'ConnectTimeout=10',
+ '-o',
+ 'LogLevel=ERROR',
+ `${sessionEnvironment} ${command}`,
+ ],
+ { encoding: 'utf8', timeout: 20_000 },
+ ).trim();
+};
+
+describe.skipIf(process.env.OMARCHY_E2E !== 'true')(
+ 'Omarchy shell visuals in a real Hyprland session',
+ () => {
+ let agent: ComputerAgent;
+ let fluxbox: ChildProcess;
+ let viewer: ChildProcess;
+ let barConfigBackup: string | undefined;
+ let barConfigExisted = false;
+
+ beforeAll(async () => {
+ agent = await agentFromComputer({
+ aiContexts: {
+ aiAssert:
+ 'Inspect the real Omarchy desktop shown through VNC. ' +
+ 'Judge only visible pixels. Do not infer success from an action or a configuration value.',
+ },
+ // TigerVNC must show the guest framebuffer without scaling or borders.
+ xvfbResolution: '1280x800x24',
+ });
+
+ fluxbox = spawn('fluxbox', [], {
+ detached: true,
+ stdio: 'ignore',
+ env: process.env,
+ });
+ await sleep(1000);
+ viewer = spawn(
+ 'vncviewer',
+ ['-FullScreen=1', '-RemoteResize=0', '-ViewOnly=0', '127.0.0.1:5905'],
+ { detached: true, stdio: 'ignore', env: process.env },
+ );
+ await sleep(4000);
+ });
+
+ afterAll(() => {
+ if (barConfigBackup) {
+ try {
+ guest(
+ `${barConfigExisted ? `cp '${barConfigBackup}' "$HOME/.config/omarchy/shell.json"` : 'rm -f "$HOME/.config/omarchy/shell.json"'}; ` +
+ `omarchy-shell shell reloadConfig; rm -f '${barConfigBackup}'`,
+ );
+ } catch (error) {
+ console.error(
+ 'Could not restore the Omarchy bar configuration:',
+ error,
+ );
+ }
+ }
+ try {
+ guest('omarchy-shell shell hide omarchy.menu');
+ } catch {
+ // The disposable VM may already have stopped.
+ }
+ stopProcessGroup(viewer);
+ stopProcessGroup(fluxbox);
+ });
+
+ it('shows the system menu with Shutdown and a visible focused row', async () => {
+ guest('omarchy-shell shell summon omarchy.menu \'{"menu":"system"}\'');
+ let menuVisible = false;
+ for (let attempt = 0; attempt < 15; attempt++) {
+ if (
+ guest(
+ 'hyprctl -j layers | jq -r \'[.. | objects | select(.namespace? == "omarchy-menu")] | length\'',
+ ) !== '0'
+ ) {
+ menuVisible = true;
+ break;
+ }
+ await sleep(1000);
+ }
+ if (!menuVisible) throw new Error('Omarchy system menu did not open');
+ guest('wtype -k Down');
+ await sleep(1000);
+
+ await agent.aiAssert(
+ 'The Omarchy system menu is open, and its Shutdown item is clearly readable.',
+ );
+ await agent.aiAssert(
+ 'Exactly one row in the open system menu has a visible focus highlight or accent, and the highlight is rendered cleanly.',
+ );
+ guest('omarchy-shell shell hide omarchy.menu');
+ });
+
+ it('renders the bar vertically along the left screen edge', async () => {
+ barConfigExisted =
+ guest(
+ 'test -f "$HOME/.config/omarchy/shell.json" && echo yes || echo no',
+ ) === 'yes';
+ barConfigBackup = guest('mktemp /tmp/omarchy-midscene-bar.XXXXXX');
+ if (barConfigExisted) {
+ guest(`cp "$HOME/.config/omarchy/shell.json" '${barConfigBackup}'`);
+ }
+ guest('omarchy bar position left');
+ await sleep(2000);
+
+ await agent.aiAssert(
+ 'The Omarchy bar is visible as a tall vertical bar docked to the left edge of the desktop, rather than a horizontal bar across the top or bottom.',
+ );
+ });
+ },
+);
diff --git a/tests/midscene/run-omarchy-midscene.sh b/tests/midscene/run-omarchy-midscene.sh
index 2ae246b..1b68a35 100755
--- a/tests/midscene/run-omarchy-midscene.sh
+++ b/tests/midscene/run-omarchy-midscene.sh
@@ -204,3 +204,46 @@ if [[ $MIDSCENE_PASSED != true ]]; then
fi
ssh_session "hyprctl -j clients | jq -e '[.[] | select(.title == \"Doubao Say\")] | length == 1'"
+
+# The shell PoC should show Omarchy itself, without the onboarding fixture
+# obscuring the desktop or its first-run notifications.
+ssh_session "if test -s /tmp/doubao-midscene-fixture.pid; then \
+ kill \"\$(cat /tmp/doubao-midscene-fixture.pid)\" >/dev/null 2>&1 || true; \
+ fi; omarchy-shell notifications dismissAll"
+for _close_attempt in $(seq 1 15); do
+ if ssh_session "hyprctl -j clients | jq -e '[.[] | select(.title == \"Doubao Say\")] | length == 0'" \
+ >/dev/null 2>&1; then
+ break
+ fi
+ if [[ $_close_attempt -eq 15 ]]; then
+ echo "Doubao Say fixture did not close before the shell visual test." >&2
+ exit 1
+ fi
+ sleep 1
+done
+
+# Reuse the same live Hyprland session for a visual comparison against
+# Omarchy's OCR and hyprctl-based acceptance checks.
+MENU_PASSED=false
+for _test_attempt in 1 2 3; do
+ ATTEMPT_LOG="/tmp/omarchy-menu-midscene-attempt-${_test_attempt}.log"
+ if OMARCHY_E2E=true OMARCHY_SSH_KEY="$SSH_KEY" npm --prefix tests/midscene test -- \
+ e2e/omarchy-system-menu.test.ts 2>&1 | tee "$ATTEMPT_LOG"; then
+ MENU_PASSED=true
+ break
+ fi
+
+ if ! grep -Eq 'Connection error|ETIMEDOUT|failed to call AI model service' "$ATTEMPT_LOG"; then
+ echo "Omarchy menu visual test failed for a non-network reason; not retrying." >&2
+ exit 1
+ fi
+ if [[ $_test_attempt -lt 3 ]]; then
+ echo "Transient model connection failure on menu attempt $_test_attempt; retrying in 10 seconds." >&2
+ sleep 10
+ fi
+done
+
+if [[ $MENU_PASSED != true ]]; then
+ echo "Omarchy menu visual test exhausted three model-connection attempts." >&2
+ exit 1
+fi
diff --git a/tests/test_pages_report_history.mjs b/tests/test_pages_report_history.mjs
index 68b887c..084066e 100644
--- a/tests/test_pages_report_history.mjs
+++ b/tests/test_pages_report_history.mjs
@@ -1,5 +1,5 @@
import assert from 'node:assert/strict';
-import { mkdtemp, mkdir, readFile, writeFile } from 'node:fs/promises';
+import { mkdir, mkdtemp, readFile, writeFile } from 'node:fs/promises';
import http from 'node:http';
import os from 'node:os';
import path from 'node:path';
@@ -13,6 +13,33 @@ const fixtureHtml = `<!doctype html><html><body>report
control character","usage":{"_midscene_call_id":"call-2","time_cost":3500,"total_tokens":180}}</script>
</body></html>`;
+const shellPrompts = [
+ 'The Omarchy system menu is open and Shutdown is readable.',
+ 'Exactly one row in the open system menu is highlighted.',
+ 'The Omarchy bar is visible on the left.',
+];
+const shellFixtureHtml = `<!doctype html><html><body>${shellPrompts
+ .map(
+ (prompt, index) => `
+<script type="midscene_web_dump">${JSON.stringify({
+ executions: [
+ {
+ tasks: [
+ {
+ status: 'finished',
+ subType: 'Assert',
+ param: { dataDemand: prompt },
+ output: true,
+ uiContext: { screenshot: { id: `image-${index}` } },
+ },
+ ],
+ },
+ ],
+ })}</script>
+<script type="midscene-image" data-id="image-${index}">data:image/jpeg;base64,/9j/2Q==</script>`,
+ )
+ .join('')}</body></html>`;
+
async function fixtureDirectory(root) {
const reportDirectory = path.join(root, 'artifact', 'report');
await mkdir(reportDirectory, { recursive: true });
@@ -63,16 +90,62 @@ test('simulates a first deployment when Pages returns 404', async (context) => {
assert.equal(manifest.reports[0].averageDurationMs, 3000);
assert.equal(manifest.reports[0].modelCallCount, 2);
assert.equal(manifest.reports[0].tokenUsage, 300);
- const indexHtml = await readFile(path.join(siteDirectory, 'index.html'), 'utf8');
+ const indexHtml = await readFile(
+ path.join(siteDirectory, 'index.html'),
+ 'utf8',
+ );
assert.match(indexHtml, /Run ID/);
assert.match(indexHtml, /Distribution/);
assert.match(indexHtml, /Ubuntu 22\.04/);
assert.equal(
- await readFile(path.join(siteDirectory, 'reports', '200', 'index.html'), 'utf8'),
+ await readFile(
+ path.join(siteDirectory, 'reports', '200', 'index.html'),
+ 'utf8',
+ ),
fixtureHtml,
);
});
+test('builds a visual showcase from onboarding and shell reports', async (context) => {
+ const root = await mkdtemp(path.join(os.tmpdir(), 'pages-omarchy-'));
+ const reportDirectory = await fixtureDirectory(root);
+ await writeFile(
+ path.join(reportDirectory, 'report', 'shell.html'),
+ shellFixtureHtml,
+ );
+ const siteDirectory = path.join(root, 'site');
+ const server = await startServer((_request, response) =>
+ response.writeHead(404).end(),
+ );
+ context.after(server.close);
+
+ const manifest = await buildPagesReport(
+ options(reportDirectory, siteDirectory, server.url),
+ );
+
+ assert.equal(manifest.reports[0].testCount, 3);
+ assert.equal(manifest.reports[0].files.length, 5);
+ const showcase = await readFile(
+ path.join(siteDirectory, 'reports', '200', 'index.html'),
+ 'utf8',
+ );
+ assert.match(showcase, /3 \/ 3/);
+ assert.match(showcase, /<iframe src="shell-report.html"/);
+ assert.match(showcase, /menu.jpg/);
+ assert.equal(
+ await readFile(
+ path.join(siteDirectory, 'reports', '200', 'shell-report.html'),
+ 'utf8',
+ ),
+ shellFixtureHtml,
+ );
+ assert.equal(
+ (await readFile(path.join(siteDirectory, 'reports', '200', 'bar.jpg')))
+ .length,
+ 4,
+ );
+});
+
test('restores retained history before adding the new run', async (context) => {
const root = await mkdtemp(path.join(os.tmpdir(), 'pages-history-'));
const reportDirectory = await fixtureDirectory(root);
@@ -112,11 +185,17 @@ test('restores retained history before adding the new run', async (context) => {
['200', '100'],
);
assert.equal(
- await readFile(path.join(siteDirectory, 'reports', '100', 'index.html'), 'utf8'),
+ await readFile(
+ path.join(siteDirectory, 'reports', '100', 'index.html'),
+ 'utf8',
+ ),
oldReport,
);
const writtenManifest = JSON.parse(
- await readFile(path.join(siteDirectory, 'reports', 'manifest.json'), 'utf8'),
+ await readFile(
+ path.join(siteDirectory, 'reports', 'manifest.json'),
+ 'utf8',
+ ),
);
assert.equal(writtenManifest.reports[0].reportPath, 'reports/200/index.html');
assert.equal(
@@ -138,7 +217,8 @@ test('stops when a manifest exists but an old report cannot be restored', async
reports: [
{
runId: '100',
- workflowUrl: 'https://github.com/quanru/doubao-say/actions/runs/100',
+ workflowUrl:
+ 'https://github.com/quanru/doubao-say/actions/runs/100',
reportPath: 'reports/100/index.html',
},
],