Skip to content

Doubao-powered voice input for Linux, Wayland and Omarchy

test: organize suites and upgrade Midscene to 1.12.9 (#24)

Leyang4bac41cb17b0
diff --git a/.github/workflows/midscene-omarchy-4.0.3.yml b/.github/workflows/midscene-omarchy-4.0.3.yml
index 6c63e5e..2389f95 100644
--- a/.github/workflows/midscene-omarchy-4.0.3.yml
+++ b/.github/workflows/midscene-omarchy-4.0.3.yml
@@ -10,16 +10,16 @@ on:
- "scripts/build-pages-report.mjs"
- "scripts/verify-omarchy-evidence.mjs"
- "scripts/omarchy-shell-evidence.mjs"
- - "tests/test_pages_report_history.mjs"
- - "tests/midscene/package.json"
- - "tests/midscene/package-lock.json"
- - "tests/midscene/gtk_fixture.py"
- - "tests/midscene/capture-report-preview.mjs"
- - "tests/midscene/cases/**"
- - "tests/midscene/midscene.config.ts"
- - "tests/midscene/run-omarchy-midscene.sh"
- - "tests/midscene/restore-omarchy-vm.sh"
- - "tests/midscene/omarchy-vm.env"
+ - "tests/contracts/test_pages_report_history.mjs"
+ - "tests/e2e/package.json"
+ - "tests/e2e/package-lock.json"
+ - "tests/e2e/gtk_fixture.py"
+ - "tests/e2e/capture-report-preview.mjs"
+ - "tests/e2e/cases/**"
+ - "tests/e2e/midscene.config.ts"
+ - "tests/e2e/run-omarchy-midscene.sh"
+ - "tests/e2e/restore-omarchy-vm.sh"
+ - "tests/e2e/omarchy-vm.env"
- "src/**"
- "manifest.json"
- "install.sh"
@@ -34,16 +34,16 @@ on:
- "scripts/build-pages-report.mjs"
- "scripts/verify-omarchy-evidence.mjs"
- "scripts/omarchy-shell-evidence.mjs"
- - "tests/test_pages_report_history.mjs"
- - "tests/midscene/package.json"
- - "tests/midscene/package-lock.json"
- - "tests/midscene/gtk_fixture.py"
- - "tests/midscene/capture-report-preview.mjs"
- - "tests/midscene/cases/**"
- - "tests/midscene/midscene.config.ts"
- - "tests/midscene/run-omarchy-midscene.sh"
- - "tests/midscene/restore-omarchy-vm.sh"
- - "tests/midscene/omarchy-vm.env"
+ - "tests/contracts/test_pages_report_history.mjs"
+ - "tests/e2e/package.json"
+ - "tests/e2e/package-lock.json"
+ - "tests/e2e/gtk_fixture.py"
+ - "tests/e2e/capture-report-preview.mjs"
+ - "tests/e2e/cases/**"
+ - "tests/e2e/midscene.config.ts"
+ - "tests/e2e/run-omarchy-midscene.sh"
+ - "tests/e2e/restore-omarchy-vm.sh"
+ - "tests/e2e/omarchy-vm.env"
- "src/**"
- "manifest.json"
- "install.sh"
@@ -113,20 +113,20 @@ jobs:
GHCR_TOKEN: ${{ github.token }}
- name: Restore prebuilt Omarchy VM
- run: tests/midscene/restore-omarchy-vm.sh
+ run: tests/e2e/restore-omarchy-vm.sh
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: "22"
cache: npm
- cache-dependency-path: tests/midscene/package-lock.json
+ cache-dependency-path: tests/e2e/package-lock.json
- name: Install Midscene and VNC bridge
run: |
sudo apt-get install -y --no-install-recommends \
fluxbox tigervnc-viewer x11-xserver-utils xvfb
for attempt in 1 2 3; do
- if npm --prefix tests/midscene ci --include=optional --ignore-scripts; then
+ if npm --prefix tests/e2e ci --include=optional --ignore-scripts; then
exit 0
fi
echo "npm install attempt $attempt failed; retrying." >&2
@@ -135,11 +135,11 @@ jobs:
exit 1
- name: Run real Omarchy Midscene E2E
- run: tests/midscene/run-omarchy-midscene.sh
+ run: tests/e2e/run-omarchy-midscene.sh
- name: Capture the final report node for the CI summary
if: always()
- run: node tests/midscene/capture-report-preview.mjs
+ run: node tests/e2e/capture-report-preview.mjs
- name: Upload installer evidence
if: always()
@@ -156,13 +156,13 @@ jobs:
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: omarchy-midscene-e2e-report
- path: tests/midscene/midscene_run/
+ path: tests/e2e/midscene_run/
if-no-files-found: warn
retention-days: 7
- name: Verify visual evidence before publishing
if: success()
- run: node scripts/verify-omarchy-evidence.mjs tests/midscene/midscene_run
+ run: node scripts/verify-omarchy-evidence.mjs tests/e2e/midscene_run
pages-report:
name: GitHub Pages report
diff --git a/.github/workflows/midscene-ubuntu-22.04.yml b/.github/workflows/midscene-ubuntu-22.04.yml
index 38f20c8..77b9a94 100644
--- a/.github/workflows/midscene-ubuntu-22.04.yml
+++ b/.github/workflows/midscene-ubuntu-22.04.yml
@@ -8,12 +8,12 @@ on:
- ".github/workflows/midscene-ubuntu-22.04.yml"
- ".github/workflows/deploy-midscene-report.yml"
- "scripts/build-pages-report.mjs"
- - "tests/test_pages_report_history.mjs"
- - "tests/midscene/package.json"
- - "tests/midscene/package-lock.json"
- - "tests/midscene/gtk_fixture.py"
- - "tests/midscene/cases/**"
- - "tests/midscene/midscene.config.ts"
+ - "tests/contracts/test_pages_report_history.mjs"
+ - "tests/e2e/package.json"
+ - "tests/e2e/package-lock.json"
+ - "tests/e2e/gtk_fixture.py"
+ - "tests/e2e/cases/**"
+ - "tests/e2e/midscene.config.ts"
- "src/**"
pull_request:
branches: [main]
@@ -21,12 +21,12 @@ on:
- ".github/workflows/midscene-ubuntu-22.04.yml"
- ".github/workflows/deploy-midscene-report.yml"
- "scripts/build-pages-report.mjs"
- - "tests/test_pages_report_history.mjs"
- - "tests/midscene/package.json"
- - "tests/midscene/package-lock.json"
- - "tests/midscene/gtk_fixture.py"
- - "tests/midscene/cases/**"
- - "tests/midscene/midscene.config.ts"
+ - "tests/contracts/test_pages_report_history.mjs"
+ - "tests/e2e/package.json"
+ - "tests/e2e/package-lock.json"
+ - "tests/e2e/gtk_fixture.py"
+ - "tests/e2e/cases/**"
+ - "tests/e2e/midscene.config.ts"
- "src/**"
workflow_dispatch:
@@ -63,7 +63,7 @@ jobs:
with:
node-version: "22"
cache: npm
- cache-dependency-path: tests/midscene/package-lock.json
+ cache-dependency-path: tests/e2e/package-lock.json
- name: Require Midscene model configuration
run: |
@@ -107,7 +107,7 @@ jobs:
python3-cairo python3-gi x11-xserver-utils xdg-utils xvfb
- name: Install pinned Midscene dependencies
- working-directory: tests/midscene
+ working-directory: tests/e2e
# sharp's platform packages are pinned explicitly. Skipping lifecycle
# scripts avoids an npm ordering bug that tries to build sharp before
# those prebuilt packages are linked.
@@ -122,7 +122,7 @@ jobs:
exit 1
- name: Run Ubuntu 22.04 Midscene E2E
- working-directory: tests/midscene
+ working-directory: tests/e2e
env:
NODE_OPTIONS: --dns-result-order=ipv4first --no-network-family-autoselection --require=./node_modules/@computer-use/libnut/dist/import_libnut.js
run: |
@@ -155,7 +155,7 @@ jobs:
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: midscene-ubuntu-22.04-e2e-report
- path: tests/midscene/midscene_run/
+ path: tests/e2e/midscene_run/
if-no-files-found: warn
retention-days: 7
diff --git a/.github/workflows/omarchy-vm-image.yml b/.github/workflows/omarchy-vm-image.yml
index 2159a8c..9d9738a 100644
--- a/.github/workflows/omarchy-vm-image.yml
+++ b/.github/workflows/omarchy-vm-image.yml
@@ -5,11 +5,11 @@ on:
push:
branches: [ci/midscene-e2e]
paths:
- - "tests/midscene/.rebuild-omarchy-vm"
- - "tests/midscene/install-omarchy-vm.sh"
- - "tests/midscene/prepare-omarchy-host.sh"
- - "tests/midscene/publish-omarchy-vm.sh"
- - "tests/midscene/omarchy-vm.env"
+ - "tests/e2e/.rebuild-omarchy-vm"
+ - "tests/e2e/install-omarchy-vm.sh"
+ - "tests/e2e/prepare-omarchy-host.sh"
+ - "tests/e2e/publish-omarchy-vm.sh"
+ - "tests/e2e/omarchy-vm.env"
permissions:
contents: read
@@ -32,7 +32,7 @@ jobs:
- uses: oras-project/setup-oras@1d808f7d7f6995cc68b7bf507bfe5c5446e1dc9d # v2.0.1
- name: Install Omarchy from the verified official ISO
- run: tests/midscene/install-omarchy-vm.sh
+ run: tests/e2e/install-omarchy-vm.sh
- name: Sign in to GitHub Container Registry
run: echo "$GHCR_TOKEN" | oras login ghcr.io --username "$GITHUB_ACTOR" --password-stdin
@@ -40,7 +40,7 @@ jobs:
GHCR_TOKEN: ${{ github.token }}
- name: Publish versioned Omarchy base VM
- run: tests/midscene/publish-omarchy-vm.sh
+ run: tests/e2e/publish-omarchy-vm.sh
- name: Upload installer evidence
if: always()
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 101e9a8..52f7510 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -116,7 +116,7 @@ jobs:
run: |
app_archive=(doubao-say-*-app-linux-*.tar.gz)
test "${#app_archive[@]}" -eq 1
- /usr/bin/python3 ../tests/manual_clean_install.py "${app_archive[0]}"
+ /usr/bin/python3 ../tests/manual/clean_install.py "${app_archive[0]}"
publish:
name: Publish GitHub release
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index d4f8244..7b7b03a 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -24,8 +24,8 @@ jobs:
- name: Statically check and test Pages history builder
run: |
node --check scripts/build-pages-report.mjs
- node --check tests/test_pages_report_history.mjs
- node --test tests/test_pages_report_history.mjs
+ node --check tests/contracts/test_pages_report_history.mjs
+ node --test tests/contracts/test_pages_report_history.mjs
core-compatibility:
name: Core / Python ${{ matrix.python }}
@@ -47,13 +47,13 @@ jobs:
run: python -m pip install -r packaging/runtime-requirements.txt
- name: Test platform-independent behavior
env:
- PYTHONPATH: src:tests
+ PYTHONPATH: src:.
run: |
python -m unittest -v \
- tests.test_delivery tests.test_gesture tests.test_input_worker \
- tests.test_manual_safety tests.test_plugin_launch tests.test_polish \
- tests.test_polish_preview tests.test_reasoning tests.test_settings \
- tests.test_updates tests.test_version_check tests.test_voice_motion
+ tests.unit.test_delivery tests.unit.test_gesture tests.unit.test_input_worker \
+ tests.unit.test_manual_safety tests.unit.test_plugin_launch tests.unit.test_polish \
+ tests.unit.test_polish_preview tests.unit.test_reasoning tests.unit.test_settings \
+ tests.unit.test_updates tests.contracts.test_version_check tests.unit.test_voice_motion
python -m compileall -q src/doubao_input packaging
full-suite:
@@ -97,7 +97,7 @@ jobs:
python-version: "3.11"
- name: Validate version and package tests
env:
- PYTHONPATH: src:packaging
+ PYTHONPATH: src:.
run: |
python packaging/version_check.py
- python -m unittest -v tests.test_release tests.test_marketplace tests.test_version_check
+ python -m unittest -v tests.contracts.test_release tests.contracts.test_marketplace tests.contracts.test_version_check
diff --git a/.gitignore b/.gitignore
index 8313730..bb54a46 100644
--- a/.gitignore
+++ b/.gitignore
@@ -94,8 +94,8 @@ settings.json
/backups/
/.midscene-omarchy/
/.midscene-config/
-/tests/midscene/midscene_run/
-/tests/midscene/node_modules/
+/tests/e2e/midscene_run/
+/tests/e2e/node_modules/
*.bak
*.orig
*.rej
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index fa850ae..f27393c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -20,10 +20,11 @@ make check
```
Tests use temporary fake credentials. Unit tests must not record audio, access
-Doubao, send keyboard events or alter desktop configuration. Files named
-`manual_*.py` are opt-in live tests, never normal CI. Stop recording before any
-lifecycle test. Stop the normal app/plugin before fresh-login/onboarding tests;
-they share the production application ID to prevent duplicate overlays.
+Doubao, send keyboard events or alter desktop configuration. Files under
+`tests/manual/` are opt-in live checks, never normal CI. The complete test
+layout is documented in `tests/README.md`. Stop recording before any lifecycle
+test. Stop the normal app/plugin before fresh-login/onboarding tests; they share
+the production application ID to prevent duplicate overlays.
## Change boundaries
@@ -66,11 +67,11 @@ Always run opt-in desktop tests with a process-level timeout, for example:
```sh
GTK_A11Y=none PYTHONPATH=src timeout --signal=TERM --kill-after=5s 35s \
- dbus-run-session -- .venv/bin/python tests/manual_refactor_smoke.py
+ dbus-run-session -- .venv/bin/python tests/manual/refactor_smoke.py
```
The smoke test also bounds event draining and has a 30-second kernel alarm.
Do not drain GTK with an unbounded `while context.pending()` loop: recurring
-sources may keep the queue ready forever. Use `tests/manual_safety.py` and register
+sources may keep the queue ready forever. Use `tests/manual/safety.py` and register
cleanup before assertions. Confirm the test process has exited after every run;
a passing message alone is insufficient. A hard timeout is a failed test.
diff --git a/Makefile b/Makefile
index dd99416..7fd63cc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,19 @@
PYTHON ?= .venv/bin/python
-.PHONY: check test coverage lint compile shell whitespace release marketplace-check
+.PHONY: check test test-unit test-contracts coverage lint compile shell whitespace release marketplace-check
check: lint test compile shell whitespace
-test:
- PYTHONPATH=src $(PYTHON) -m unittest discover -s tests -v
+test: test-unit test-contracts
+
+test-unit:
+ PYTHONPATH=src:. $(PYTHON) -m unittest discover -s tests/unit -t . -v
+
+test-contracts:
+ PYTHONPATH=src:. $(PYTHON) -m unittest discover -s tests/contracts -t . -v
+ node --test tests/contracts/test_pages_report_history.mjs
coverage:
- PYTHONPATH=src $(PYTHON) -m coverage run -m unittest discover -s tests
+ PYTHONPATH=src:. $(PYTHON) -m coverage run -m unittest discover -s tests -t .
$(PYTHON) -m coverage report
$(PYTHON) -m coverage xml
diff --git a/README.md b/README.md
index ee43838..f9f5f18 100644
--- a/README.md
+++ b/README.md
@@ -330,7 +330,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for `make check`,
this candidate and have not passed the new installer acceptance.
```sh
-PYTHONPATH=src .venv/bin/python -m unittest discover -s tests -v
+make test
.venv/bin/python -m compileall -q src/doubao_input packaging
.venv/bin/python -m pip wheel -w dist/wheelhouse -r packaging/runtime-requirements.txt
python3 packaging/build-release.py
@@ -342,7 +342,7 @@ and overlay focus. It uses a separate clipboard without CopyQ; optional PyQt6 an
Electron fixtures extend toolkit coverage. Avoid typing during the test:
```sh
-timeout --kill-after=5s 50s env PYTHONPATH=src python3 tests/manual_x11.py --run
+timeout --kill-after=5s 50s env PYTHONPATH=src python3 tests/manual/x11.py --run
```
This requires Xephyr, xfwm4, xfce4-terminal, xdotool, xclip and `/dev/uinput` access.
diff --git a/README.zh-CN.md b/README.zh-CN.md
index a63183f..c2e4486 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -256,7 +256,7 @@ cd "${XDG_CONFIG_HOME:-$HOME/.config}/omarchy/plugins/md.lifeos.doubao-say"
旧 Debian 打包脚本不属于本次候选版的发布路径,尚未完成新版安装验收。
```sh
-PYTHONPATH=src .venv/bin/python -m unittest discover -s tests -v
+make test
.venv/bin/python -m compileall -q src/doubao_input packaging
.venv/bin/python -m pip wheel -w dist/wheelhouse -r packaging/runtime-requirements.txt
python3 packaging/build-release.py
@@ -267,7 +267,7 @@ python3 packaging/build-release.py
还会检查这两种界面。运行期间请勿打字:
```sh
-timeout --kill-after=5s 50s env PYTHONPATH=src python3 tests/manual_x11.py --run
+timeout --kill-after=5s 50s env PYTHONPATH=src python3 tests/manual/x11.py --run
```
需要 Xephyr、xfwm4、xfce4-terminal、xdotool、xclip 和 `/dev/uinput` 权限。
diff --git a/packaging/MARKETPLACE.md b/packaging/MARKETPLACE.md
index c438d4b..60c1927 100644
--- a/packaging/MARKETPLACE.md
+++ b/packaging/MARKETPLACE.md
@@ -14,9 +14,9 @@ Suggested category: **Productivity**. Tags: **ai, hyprland**.
Git refs plus source. Redacted reports remain in ignored `artifacts/marketplace/`.
2. Build the pinned offline wheel set and run `make release`. Keep installers,
checksums and dependency notices together. Checksums are not signatures.
-3. Run `tests/manual_clean_install.py` against the app archive. This tests a fresh
+3. Run `tests/manual/clean_install.py` against the app archive. This tests a fresh
XDG directory/runtime on the host, **not** a fresh OS or desktop.
- Run `.venv/bin/python tests/manual_source_install.py` for an isolated source
+ Run `.venv/bin/python tests/manual/source_install.py` for an isolated source
snapshot, runtime check and launcher registration (also host-library based).
4. On a separate clean Omarchy session, follow both documented installation routes
separately. For Git installation, run `./install.sh` before enabling.
diff --git a/tests/README.md b/tests/README.md
new file mode 100644
index 0000000..48738f0
--- /dev/null
+++ b/tests/README.md
@@ -0,0 +1,13 @@
+# Tests
+
+- [`unit/`](unit/) contains fast Python behavior and component tests.
+- [`contracts/`](contracts/) verifies packaging, releases, version alignment,
+ Marketplace rules, and the Pages report builder.
+- [`e2e/`](e2e/) exercises complete desktop flows on Ubuntu and Omarchy with
+ Midscene and publishes HTML reports from GitHub Actions.
+- [`manual/`](manual/) contains opt-in checks that require a real desktop,
+ devices, credentials, or human observation.
+
+`make test-unit` and `make test-contracts` run the two local automated layers.
+`make test` runs both. See `CONTRIBUTING.md` before running anything under
+`manual/`.
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/contracts/__init__.py b/tests/contracts/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/test_marketplace.py b/tests/contracts/test_marketplace.py
similarity index 98%
rename from tests/test_marketplace.py
rename to tests/contracts/test_marketplace.py
index 7bec354..bd68b87 100644
--- a/tests/test_marketplace.py
+++ b/tests/contracts/test_marketplace.py
@@ -7,7 +7,7 @@ from unittest.mock import patch
from doubao_input.preflight import check_runtime
-ROOT = Path(__file__).resolve().parents[1]
+ROOT = Path(__file__).resolve().parents[2]
spec = importlib.util.spec_from_file_location("source_snapshot", ROOT / "packaging/source_snapshot.py")
snapshot = importlib.util.module_from_spec(spec)
spec.loader.exec_module(snapshot)
diff --git a/tests/test_pages_report_history.mjs b/tests/contracts/test_pages_report_history.mjs
similarity index 99%
rename from tests/test_pages_report_history.mjs
rename to tests/contracts/test_pages_report_history.mjs
index ff51d75..7208856 100644
--- a/tests/test_pages_report_history.mjs
+++ b/tests/contracts/test_pages_report_history.mjs
@@ -5,7 +5,7 @@ import os from 'node:os';
import path from 'node:path';
import test from 'node:test';
-import { buildPagesReport } from '../scripts/build-pages-report.mjs';
+import { buildPagesReport } from '../../scripts/build-pages-report.mjs';
function runnerScript({ project, status = 'success', startedAt }) {
return `<script type="midscene_test_run_dump">${JSON.stringify({
diff --git a/tests/test_release.py b/tests/contracts/test_release.py
similarity index 99%
rename from tests/test_release.py
rename to tests/contracts/test_release.py
index d1d381b..f2929cf 100644
--- a/tests/test_release.py
+++ b/tests/contracts/test_release.py
@@ -9,7 +9,7 @@ import sys
import tarfile
from unittest.mock import patch
-ROOT = Path(__file__).resolve().parents[1]
+ROOT = Path(__file__).resolve().parents[2]
spec = importlib.util.spec_from_file_location("release_installer", ROOT / "packaging/install-release.py")
installer = importlib.util.module_from_spec(spec)
spec.loader.exec_module(installer)
diff --git a/tests/test_version_check.py b/tests/contracts/test_version_check.py
similarity index 94%
rename from tests/test_version_check.py
rename to tests/contracts/test_version_check.py
index 9b7b279..8c3c9e0 100644
--- a/tests/test_version_check.py
+++ b/tests/contracts/test_version_check.py
@@ -3,7 +3,7 @@ import unittest
from pathlib import Path
-ROOT = Path(__file__).resolve().parents[1]
+ROOT = Path(__file__).resolve().parents[2]
SPEC = importlib.util.spec_from_file_location("version_check", ROOT / "packaging/version_check.py")
VERSION_CHECK = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(VERSION_CHECK)
diff --git a/tests/midscene/.npmrc b/tests/e2e/.npmrc
similarity index 100%
rename from tests/midscene/.npmrc
rename to tests/e2e/.npmrc
diff --git a/tests/midscene/README.md b/tests/e2e/README.md
similarity index 100%
rename from tests/midscene/README.md
rename to tests/e2e/README.md
diff --git a/tests/midscene/capture-report-preview.mjs b/tests/e2e/capture-report-preview.mjs
similarity index 62%
rename from tests/midscene/capture-report-preview.mjs
rename to tests/e2e/capture-report-preview.mjs
index 122583d..7524f1d 100644
--- a/tests/midscene/capture-report-preview.mjs
+++ b/tests/e2e/capture-report-preview.mjs
@@ -9,7 +9,7 @@ import {
} from '../../scripts/omarchy-shell-evidence.mjs';
const reportDirectory = path.resolve(
- process.argv[2] || 'tests/midscene/midscene_run',
+ process.argv[2] || 'tests/e2e/midscene_run',
);
const outputFile = path.resolve(
process.argv[3] || path.join(reportDirectory, 'report-preview.png'),
@@ -38,22 +38,11 @@ if (!executablePath) {
const report = await findLatestTestReport(reportDirectory);
const runnerDump = report.run;
if (!runnerDump) throw new Error('Midscene Test runner dump was not found');
-const executedSteps = (runnerDump.projects ?? []).flatMap((project) =>
- (project.documents ?? []).flatMap((document) =>
- (document.cases ?? []).flatMap((testCase) =>
- (testCase.attempts ?? []).flatMap((attempt) =>
- (attempt.steps ?? []).filter((step) => step.startedAt),
- ),
- ),
- ),
-);
-const finalStep = executedSteps.at(-1);
const previewUrl = new URL(pathToFileURL(report.file));
-if (finalStep) {
- const previewHash = new URLSearchParams({ 'runner-step': finalStep.id });
- if (finalStep.agentDetails?.length) previewHash.set('runner-trace', 'page');
- previewUrl.hash = previewHash.toString();
-}
+previewUrl.hash = new URLSearchParams({
+ 'runner-step': 'last',
+ 'runner-trace': 'page',
+}).toString();
await mkdir(path.dirname(outputFile), { recursive: true });
const browser = await puppeteer.launch({
@@ -68,18 +57,14 @@ try {
await page.goto(previewUrl.href, {
waitUntil: 'networkidle0',
});
- if (finalStep?.agentDetails?.length) {
- await page.waitForFunction(() => document.body.innerText.includes('AI TRACE'));
- await page.evaluate(() => window.scrollTo(0, 0));
- } else if (finalStep) {
- await page.waitForSelector('[aria-label="Execution steps"]');
- }
+ await page.waitForFunction(() => document.body.innerText.includes('AI TRACE'));
+ await page.evaluate(() => window.scrollTo(0, 0));
await page.waitForFunction(() =>
/Passed|Failed|Error/.test(document.body.innerText),
);
await page.screenshot({ path: outputFile, type: 'png' });
console.log(
- `Captured final Midscene report node (${finalStep?.status ?? runnerDump.status}): ${outputFile}`,
+ `Captured final Midscene report node (${runnerDump.status}): ${outputFile}`,
);
} finally {
await browser.close();
diff --git a/tests/midscene/cases/omarchy-shell.yaml b/tests/e2e/cases/omarchy-shell.yaml
similarity index 100%
rename from tests/midscene/cases/omarchy-shell.yaml
rename to tests/e2e/cases/omarchy-shell.yaml
diff --git a/tests/midscene/cases/onboarding.yaml b/tests/e2e/cases/onboarding.yaml
similarity index 100%
rename from tests/midscene/cases/onboarding.yaml
rename to tests/e2e/cases/onboarding.yaml
diff --git a/tests/midscene/gtk_fixture.py b/tests/e2e/gtk_fixture.py
similarity index 100%
rename from tests/midscene/gtk_fixture.py
rename to tests/e2e/gtk_fixture.py
diff --git a/tests/midscene/install-omarchy-vm.sh b/tests/e2e/install-omarchy-vm.sh
similarity index 93%
rename from tests/midscene/install-omarchy-vm.sh
rename to tests/e2e/install-omarchy-vm.sh
index 63ea023..d94f77a 100755
--- a/tests/midscene/install-omarchy-vm.sh
+++ b/tests/e2e/install-omarchy-vm.sh
@@ -5,11 +5,11 @@ set -euo pipefail
# dressed up with a few Omarchy files. The official ISO acceptance harness
# drives the installer through QEMU screenshots, OCR and virtual keystrokes.
readonly WORK_DIR="$PWD/.midscene-omarchy"
-source "$PWD/tests/midscene/omarchy-vm.env"
+source "$PWD/tests/e2e/omarchy-vm.env"
readonly ISO_PATH="$WORK_DIR/omarchy-${OMARCHY_ISO_VERSION}.iso"
readonly HARNESS_DIR="$WORK_DIR/omarchy-iso"
-tests/midscene/prepare-omarchy-host.sh
+tests/e2e/prepare-omarchy-host.sh
df -h "$WORK_DIR"
curl --fail --location --retry 5 --retry-all-errors \
diff --git a/tests/midscene/midscene-node-reference.md b/tests/e2e/midscene-node-reference.md
similarity index 100%
rename from tests/midscene/midscene-node-reference.md
rename to tests/e2e/midscene-node-reference.md
diff --git a/tests/midscene/midscene.config.ts b/tests/e2e/midscene.config.ts
similarity index 98%
rename from tests/midscene/midscene.config.ts
rename to tests/e2e/midscene.config.ts
index 582df29..fc9bc5f 100644
--- a/tests/midscene/midscene.config.ts
+++ b/tests/e2e/midscene.config.ts
@@ -83,7 +83,7 @@ const setup = defineProjectSetup<DesktopContext>({
await sleep(4000);
} else {
const root = resolve(import.meta.dirname, '../..');
- const fixture = spawn('/usr/bin/python3', ['tests/midscene/gtk_fixture.py'], {
+ const fixture = spawn('/usr/bin/python3', ['tests/e2e/gtk_fixture.py'], {
cwd: root, detached: true, stdio: ['ignore', 'pipe', 'pipe'],
env: {
...process.env, GDK_BACKEND: 'x11', GSK_RENDERER: 'cairo', GTK_A11Y: 'none',
diff --git a/tests/midscene/omarchy-vm.env b/tests/e2e/omarchy-vm.env
similarity index 100%
rename from tests/midscene/omarchy-vm.env
rename to tests/e2e/omarchy-vm.env
diff --git a/tests/midscene/package-lock.json b/tests/e2e/package-lock.json
similarity index 99%
rename from tests/midscene/package-lock.json
rename to tests/e2e/package-lock.json
index 862673f..e0ba9e2 100644
--- a/tests/midscene/package-lock.json
+++ b/tests/e2e/package-lock.json
@@ -8,8 +8,8 @@
"name": "doubao-say-midscene-e2e",
"version": "1.0.0",
"devDependencies": {
- "@midscene/computer": "1.12.8",
- "@midscene/test": "1.12.8",
+ "@midscene/computer": "1.12.9",
+ "@midscene/test": "1.12.9",
"@types/node": "^22.0.0",
"puppeteer-core": "^25.11.0",
"typescript": "^5.8.3"
@@ -2230,15 +2230,15 @@
}
},
"node_modules/@midscene/computer": {
- "version": "1.12.8",
- "resolved": "https://registry.npmjs.org/@midscene/computer/-/computer-1.12.8.tgz",
- "integrity": "sha512-b0haZC1/XasS5FLbdEmln8dDbZPqhna1DjCoxvwhIj8eoISDfuKhAwAvdXaSPpvU8NHgV7cpywo8UiaTXkd4xQ==",
+ "version": "1.12.9",
+ "resolved": "https://registry.npmjs.org/@midscene/computer/-/computer-1.12.9.tgz",
+ "integrity": "sha512-AHoO2rM+81U4yDGD2kadKJ3ShAGbxmLBkcVd5VT6jgUsSOqJNgyAC5Y2S5OtY201pk0B4476kh0CZR/dyH+Aog==",
"dev": true,
"license": "MIT",
"dependencies": {
"@computer-use/libnut": "^4.2.0",
- "@midscene/core": "1.12.8",
- "@midscene/shared": "1.12.8",
+ "@midscene/core": "1.12.9",
+ "@midscene/shared": "1.12.9",
"clipboardy": "^4.0.0",
"screenshot-desktop": "^1.15.3"
},
@@ -2250,13 +2250,13 @@
}
},
"node_modules/@midscene/core": {
- "version": "1.12.8",
- "resolved": "https://registry.npmjs.org/@midscene/core/-/core-1.12.8.tgz",
- "integrity": "sha512-dHiiJUPIgvVkuLFYDsn12+W0DkOGymG6YGm22RHFVKMWXjGd40zURWhgCOb3hxVEHzlVAWbhhfs32tgCrJp0zQ==",
+ "version": "1.12.9",
+ "resolved": "https://registry.npmjs.org/@midscene/core/-/core-1.12.9.tgz",
+ "integrity": "sha512-37nbhwOuOfSa6mcpf3BtdNKiEm/lWUnYHXUw8OJbI3WoTX1tPv0h004kqLjcAODpFNytXIAipiy7o/fSrPrb7w==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@midscene/shared": "1.12.8",
+ "@midscene/shared": "1.12.9",
"@ui-tars/action-parser": "1.2.3",
"dayjs": "^1.11.11",
"dotenv": "^16.4.5",
@@ -2275,9 +2275,9 @@
}
},
"node_modules/@midscene/shared": {
- "version": "1.12.8",
- "resolved": "https://registry.npmjs.org/@midscene/shared/-/shared-1.12.8.tgz",
- "integrity": "sha512-uCfLFik0/lMZlK02kALz3+8zsttlXZ8Ptw4XIHQ1e75Dt3Y4oyFw9jA0O/jkx3ceJLAdxK8Ja1lsOOOjuFZ3jA==",
+ "version": "1.12.9",
+ "resolved": "https://registry.npmjs.org/@midscene/shared/-/shared-1.12.9.tgz",
+ "integrity": "sha512-e4Dw346bpRcCCLr487P0WkHqqLbqoFEUgknZuEIJfnjReA3ydpzDBmJRInWNV/Y2jGIZs5qA2sxakYlLqWK4VQ==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -2291,15 +2291,15 @@
}
},
"node_modules/@midscene/test": {
- "version": "1.12.8",
- "resolved": "https://registry.npmjs.org/@midscene/test/-/test-1.12.8.tgz",
- "integrity": "sha512-yQzIZax8csm2rHfIOfVdEcPQ3JBeQW4I5RvfiIEC1x9//K4/RFaGe58GZk9OXK0jfv+YgcZYN7FPCPgPNOqZLA==",
+ "version": "1.12.9",
+ "resolved": "https://registry.npmjs.org/@midscene/test/-/test-1.12.9.tgz",
+ "integrity": "sha512-3vlZ/zQTRTk3t76Bbx7yInxEz1UwkfmBG9Vy/aWmdc+HpEJKgjN6bQcANPbCnNKoaR87t9zCZrJTLzb0eaap6g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@inquirer/prompts": "^7.8.6",
- "@midscene/core": "1.12.8",
- "@midscene/shared": "1.12.8",
+ "@midscene/core": "1.12.9",
+ "@midscene/shared": "1.12.9",
"execa": "9.3.0",
"js-yaml": "4.1.0",
"tinyglobby": "0.2.15",
diff --git a/tests/midscene/package.json b/tests/e2e/package.json
similarity index 86%
rename from tests/midscene/package.json
rename to tests/e2e/package.json
index f47e688..2acb564 100644
--- a/tests/midscene/package.json
+++ b/tests/e2e/package.json
@@ -13,8 +13,8 @@
"@img/sharp-linux-x64": "0.34.5"
},
"devDependencies": {
- "@midscene/computer": "1.12.8",
- "@midscene/test": "1.12.8",
+ "@midscene/computer": "1.12.9",
+ "@midscene/test": "1.12.9",
"@types/node": "^22.0.0",
"puppeteer-core": "^25.11.0",
"typescript": "^5.8.3"
diff --git a/tests/midscene/prepare-omarchy-host.sh b/tests/e2e/prepare-omarchy-host.sh
similarity index 96%
rename from tests/midscene/prepare-omarchy-host.sh
rename to tests/e2e/prepare-omarchy-host.sh
index 60aef8b..9fe2fd4 100755
--- a/tests/midscene/prepare-omarchy-host.sh
+++ b/tests/e2e/prepare-omarchy-host.sh
@@ -6,7 +6,7 @@ readonly WORK_DIR="$ROOT_DIR/.midscene-omarchy"
readonly HARNESS_DIR="$WORK_DIR/omarchy-iso"
# shellcheck source=omarchy-vm.env
-source "$ROOT_DIR/tests/midscene/omarchy-vm.env"
+source "$ROOT_DIR/tests/e2e/omarchy-vm.env"
if [[ ! -c /dev/kvm ]]; then
echo "::error::This GitHub runner does not expose /dev/kvm; a real Omarchy VM cannot be started."
diff --git a/tests/midscene/publish-omarchy-vm.sh b/tests/e2e/publish-omarchy-vm.sh
similarity index 96%
rename from tests/midscene/publish-omarchy-vm.sh
rename to tests/e2e/publish-omarchy-vm.sh
index 7e024d4..e23e591 100755
--- a/tests/midscene/publish-omarchy-vm.sh
+++ b/tests/e2e/publish-omarchy-vm.sh
@@ -5,7 +5,7 @@ readonly ROOT_DIR="$PWD"
readonly WORK_DIR="$ROOT_DIR/.midscene-omarchy"
# shellcheck source=omarchy-vm.env
-source "$ROOT_DIR/tests/midscene/omarchy-vm.env"
+source "$ROOT_DIR/tests/e2e/omarchy-vm.env"
readonly BASE_DIR="$WORK_DIR/omarchy-iso/test-runs/omarchy-${OMARCHY_ISO_VERSION}"
readonly BUNDLE_DIR="$WORK_DIR/registry"
diff --git a/tests/midscene/restore-omarchy-vm.sh b/tests/e2e/restore-omarchy-vm.sh
similarity index 92%
rename from tests/midscene/restore-omarchy-vm.sh
rename to tests/e2e/restore-omarchy-vm.sh
index 6082b20..bb338fc 100755
--- a/tests/midscene/restore-omarchy-vm.sh
+++ b/tests/e2e/restore-omarchy-vm.sh
@@ -5,14 +5,14 @@ readonly ROOT_DIR="$PWD"
readonly WORK_DIR="$ROOT_DIR/.midscene-omarchy"
# shellcheck source=omarchy-vm.env
-source "$ROOT_DIR/tests/midscene/omarchy-vm.env"
+source "$ROOT_DIR/tests/e2e/omarchy-vm.env"
readonly BASE_DIR="$WORK_DIR/omarchy-iso/test-runs/omarchy-${OMARCHY_ISO_VERSION}"
readonly BUNDLE_DIR="$WORK_DIR/registry"
readonly IMAGE_TAG="${OMARCHY_ISO_VERSION}-${OMARCHY_ISO_SHA256:0:12}-${OMARCHY_ISO_HARNESS_SHA:0:12}"
readonly IMAGE="ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/doubao-say-omarchy-ci-base:${IMAGE_TAG}"
-tests/midscene/prepare-omarchy-host.sh
+tests/e2e/prepare-omarchy-host.sh
mkdir -p "$BASE_DIR" "$BUNDLE_DIR"
oras pull --output "$BUNDLE_DIR" "$IMAGE"
(cd "$BUNDLE_DIR" && sha256sum --check --strict SHA256SUMS)
diff --git a/tests/midscene/run-omarchy-midscene.sh b/tests/e2e/run-omarchy-midscene.sh
similarity index 96%
rename from tests/midscene/run-omarchy-midscene.sh
rename to tests/e2e/run-omarchy-midscene.sh
index 13d6595..f59ad9b 100755
--- a/tests/midscene/run-omarchy-midscene.sh
+++ b/tests/e2e/run-omarchy-midscene.sh
@@ -5,7 +5,7 @@ readonly ROOT_DIR="$PWD"
readonly WORK_DIR="$ROOT_DIR/.midscene-omarchy"
readonly HARNESS_DIR="$WORK_DIR/omarchy-iso"
# shellcheck source=omarchy-vm.env
-source "$ROOT_DIR/tests/midscene/omarchy-vm.env"
+source "$ROOT_DIR/tests/e2e/omarchy-vm.env"
readonly ISO_PATH="$WORK_DIR/omarchy-${OMARCHY_ISO_VERSION}.iso"
readonly BASE_DIR="$HARNESS_DIR/test-runs/omarchy-${OMARCHY_ISO_VERSION}"
readonly SSH_KEY="$BASE_DIR/id_ed25519"
@@ -13,7 +13,7 @@ readonly SSH_PORT=2222
readonly PLUGIN_DIR="/home/omarchy/.config/omarchy/plugins/md.lifeos.doubao-say"
readonly SHIM_DIR="$(mktemp -d)"
readonly PLUGIN_ARCHIVE="$(mktemp /tmp/doubao-say-omarchy-plugin-XXXXXX.tar)"
-export NODE_OPTIONS="${NODE_OPTIONS:-} --require=$ROOT_DIR/tests/midscene/node_modules/@computer-use/libnut/dist/import_libnut.js"
+export NODE_OPTIONS="${NODE_OPTIONS:-} --require=$ROOT_DIR/tests/e2e/node_modules/@computer-use/libnut/dist/import_libnut.js"
VM_PID=""
@@ -112,7 +112,7 @@ ssh_guest true
echo "Creating the Omarchy plugin test payload."
tar -C "$ROOT_DIR" --exclude='__pycache__' -cf "$PLUGIN_ARCHIVE" \
LICENSE README.md manifest.json install.sh setup-omarchy.sh start.sh \
- omarchy src tests/midscene/gtk_fixture.py
+ omarchy src tests/e2e/gtk_fixture.py
for _copy_attempt in 1 2 3 4 5; do
if scp -i "$SSH_KEY" -P "$SSH_PORT" \
@@ -161,7 +161,7 @@ start_guest_fixture() {
export PYTHONPATH='$PLUGIN_DIR/src'; \
export XDG_CONFIG_HOME=/tmp/doubao-midscene-config; \
export PYTHONDONTWRITEBYTECODE=1; \
- nohup setsid python3 '$PLUGIN_DIR/tests/midscene/gtk_fixture.py' \
+ nohup setsid python3 '$PLUGIN_DIR/tests/e2e/gtk_fixture.py' \
>/tmp/doubao-midscene-fixture.log 2>&1 </dev/null & \
echo \$! >/tmp/doubao-midscene-fixture.pid"
@@ -183,7 +183,7 @@ ATTEMPT_LOG=""
for _test_attempt in 1 2 3; do
start_guest_fixture
ATTEMPT_LOG="/tmp/omarchy-midscene-attempt-${_test_attempt}.log"
- if npm --prefix tests/midscene test -- \
+ if npm --prefix tests/e2e test -- \
--project omarchy-onboarding 2>&1 | tee "$ATTEMPT_LOG"; then
MIDSCENE_PASSED=true
break
@@ -228,7 +228,7 @@ done
MENU_PASSED=false
for _test_attempt in 1 2 3; do
ATTEMPT_LOG="/tmp/omarchy-menu-midscene-attempt-${_test_attempt}.log"
- if OMARCHY_SSH_KEY="$SSH_KEY" npm --prefix tests/midscene test -- \
+ if OMARCHY_SSH_KEY="$SSH_KEY" npm --prefix tests/e2e test -- \
--project omarchy-shell 2>&1 | tee "$ATTEMPT_LOG"; then
MENU_PASSED=true
break
diff --git a/tests/midscene/tsconfig.json b/tests/e2e/tsconfig.json
similarity index 100%
rename from tests/midscene/tsconfig.json
rename to tests/e2e/tsconfig.json
diff --git a/tests/manual/__init__.py b/tests/manual/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/manual_clean_install.py b/tests/manual/clean_install.py
similarity index 100%
rename from tests/manual_clean_install.py
rename to tests/manual/clean_install.py
diff --git a/tests/manual_control_layout.py b/tests/manual/control_layout.py
similarity index 97%
rename from tests/manual_control_layout.py
rename to tests/manual/control_layout.py
index 553a742..0885239 100644
--- a/tests/manual_control_layout.py
+++ b/tests/manual/control_layout.py
@@ -1,6 +1,6 @@
"""Opt-in GTK layout regression; no recording, login, input or settings writes.
-PYTHONPATH=src .venv/bin/python tests/manual_control_layout.py
+PYTHONPATH=src .venv/bin/python tests/manual/control_layout.py
"""
import gi
diff --git a/tests/manual_control_mapped.py b/tests/manual/control_mapped.py
similarity index 100%
rename from tests/manual_control_mapped.py
rename to tests/manual/control_mapped.py
diff --git a/tests/manual_direct_input.py b/tests/manual/direct_input.py
similarity index 99%
rename from tests/manual_direct_input.py
rename to tests/manual/direct_input.py
index ca726b3..cd919a3 100644
--- a/tests/manual_direct_input.py
+++ b/tests/manual/direct_input.py
@@ -14,7 +14,7 @@ import gi
gi.require_version('Gtk', '4.0')
from gi.repository import Gtk, GLib
-from manual_safety import hard_deadline
+from safety import hard_deadline
from doubao_input.inject.injector import Injector
from doubao_input.inject.target import focused_target
diff --git a/tests/manual_escape_guard.py b/tests/manual/escape_guard.py
similarity index 98%
rename from tests/manual_escape_guard.py
rename to tests/manual/escape_guard.py
index f220f35..9444a2e 100644
--- a/tests/manual_escape_guard.py
+++ b/tests/manual/escape_guard.py
@@ -9,7 +9,7 @@ gi.require_version("Gdk", "4.0")
from gi.repository import Gdk, GLib, Gtk
from doubao_input.trigger.escape_guard import EscapeGuard
-from manual_safety import hard_deadline
+from safety import hard_deadline
def main():
diff --git a/tests/manual_fresh_login.py b/tests/manual/fresh_login.py
similarity index 100%
rename from tests/manual_fresh_login.py
rename to tests/manual/fresh_login.py
diff --git a/tests/manual_onboarding_acceptance.py b/tests/manual/onboarding_acceptance.py
similarity index 100%
rename from tests/manual_onboarding_acceptance.py
rename to tests/manual/onboarding_acceptance.py
diff --git a/tests/manual_plugin_lifecycle.py b/tests/manual/plugin_lifecycle.py
similarity index 100%
rename from tests/manual_plugin_lifecycle.py
rename to tests/manual/plugin_lifecycle.py
diff --git a/tests/manual_polish_delivery.py b/tests/manual/polish_delivery.py
similarity index 100%
rename from tests/manual_polish_delivery.py
rename to tests/manual/polish_delivery.py
diff --git a/tests/manual/probes/__init__.py b/tests/manual/probes/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/probe/P6_asr.py b/tests/manual/probes/asr.py
similarity index 95%
rename from tests/probe/P6_asr.py
rename to tests/manual/probes/asr.py
index 95c1a36..55f2dd3 100644
--- a/tests/probe/P6_asr.py
+++ b/tests/manual/probes/asr.py
@@ -1,9 +1,9 @@
"""P6 探针:用 P5 保存的凭证连 WSS,实时录音 5 秒,看是否返回 result.Text
-用法:.venv/bin/python tests/probe/P6_asr.py
+用法:.venv/bin/python tests/manual/probes/asr.py
通过标准:打印至少一条非空 text。
"""
import sys, os, time, threading
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "src"))
+sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "src"))
from doubao_input.doubao.params_store import ParamsStore
from doubao_input.doubao.asr_client import ASRClient
from doubao_input.doubao.audio_capture import AudioCapture
diff --git a/tests/probe/P5_login.py b/tests/manual/probes/login.py
similarity index 90%
rename from tests/probe/P5_login.py
rename to tests/manual/probes/login.py
index 41482af..ece7551 100644
--- a/tests/probe/P5_login.py
+++ b/tests/manual/probes/login.py
@@ -1,9 +1,9 @@
"""P5 探针:用复用的豆包登录窗口,登录后提取凭证写 ~/.config/doubao-say/asr_params.json
-用法:.venv/bin/python tests/proprobe/P5_login.py (在仓库根)
+用法:.venv/bin/python tests/manual/probes/login.py (在仓库根)
通过标准:登录后窗口自动关闭,JSON 写出 cookies/device_id/web_id。
"""
import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "src"))
+sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "src"))
from doubao_input.doubao.login_window import LoginWindow # noqa
from doubao_input.doubao.params_store import ParamsStore
print("P5: 准备开登录窗口,请在 WebView 中扫码登录豆包…")
diff --git a/tests/manual_refactor_smoke.py b/tests/manual/refactor_smoke.py
similarity index 99%
rename from tests/manual_refactor_smoke.py
rename to tests/manual/refactor_smoke.py
index 77cc7b8..945b4c3 100644
--- a/tests/manual_refactor_smoke.py
+++ b/tests/manual/refactor_smoke.py
@@ -8,7 +8,7 @@ from contextlib import ExitStack
from pathlib import Path
import tempfile
from unittest.mock import Mock, patch
-from manual_safety import drain_events, hard_deadline
+from safety import drain_events, hard_deadline
import gi
gi.require_version("Gtk", "4.0")
diff --git a/tests/manual_safety.py b/tests/manual/safety.py
similarity index 100%
rename from tests/manual_safety.py
rename to tests/manual/safety.py
diff --git a/tests/manual_settings_preview.py b/tests/manual/settings_preview.py
similarity index 94%
rename from tests/manual_settings_preview.py
rename to tests/manual/settings_preview.py
index 4440b82..56ab66f 100644
--- a/tests/manual_settings_preview.py
+++ b/tests/manual/settings_preview.py
@@ -1,6 +1,6 @@
"""Opt-in GTK UI smoke test and screenshots; never runs in headless unit CI.
-Run: PYTHONPATH=src .venv/bin/python tests/manual_settings_preview.py
+Run: PYTHONPATH=src .venv/bin/python tests/manual/settings_preview.py
Saves are validated in memory; user settings and autostart are not modified.
"""
import json
@@ -13,7 +13,7 @@ from doubao_input.i18n import set_language
from doubao_input.settings import Settings
from doubao_input.ui.settings_window import SettingsWindow
-OUT = Path(__file__).resolve().parents[1] / "artifacts/acceptance/settings"
+OUT = Path(__file__).resolve().parents[2] / "artifacts/acceptance/settings"
class Preview(Gtk.Application):
diff --git a/tests/manual_source_install.py b/tests/manual/source_install.py
similarity index 98%
rename from tests/manual_source_install.py
rename to tests/manual/source_install.py
index 2ea5cd1..21289f9 100644
--- a/tests/manual_source_install.py
+++ b/tests/manual/source_install.py
@@ -10,7 +10,7 @@ import subprocess
import sys
import tempfile
-ROOT = Path(__file__).resolve().parents[1]
+ROOT = Path(__file__).resolve().parents[2]
spec = importlib.util.spec_from_file_location("source_snapshot", ROOT / "packaging/source_snapshot.py")
snapshot = importlib.util.module_from_spec(spec)
spec.loader.exec_module(snapshot)
diff --git a/tests/manual_update_overlay.py b/tests/manual/update_overlay.py
similarity index 100%
rename from tests/manual_update_overlay.py
rename to tests/manual/update_overlay.py
diff --git a/tests/manual_waveform_performance.py b/tests/manual/waveform_performance.py
similarity index 94%
rename from tests/manual_waveform_performance.py
rename to tests/manual/waveform_performance.py
index 3c34018..0f1f585 100644
--- a/tests/manual_waveform_performance.py
+++ b/tests/manual/waveform_performance.py
@@ -2,7 +2,7 @@
Run with LD_PRELOAD=libgtk4-layer-shell.so GTK_A11Y=none PYTHONPATH=src
timeout -k 5s 15s dbus-run-session --
-python tests/manual_waveform_performance.py. Requires a desktop display.
+python tests/manual/waveform_performance.py. Requires a desktop display.
"""
import math
import time
@@ -12,7 +12,7 @@ import gi
gi.require_version('Gtk', '4.0')
from gi.repository import GLib, Gtk
from doubao_input.ui.overlay import Overlay
-from manual_safety import hard_deadline
+from safety import hard_deadline
def main():
diff --git a/tests/manual_x11.py b/tests/manual/x11.py
similarity index 99%
rename from tests/manual_x11.py
rename to tests/manual/x11.py
index be21cd3..0f71ebd 100644
--- a/tests/manual_x11.py
+++ b/tests/manual/x11.py
@@ -1,6 +1,6 @@
"""Opt-in X11 delivery acceptance in a disposable Xephyr/XFWM desktop.
-Run: timeout --kill-after=5s 50s env PYTHONPATH=src python tests/manual_x11.py --run
+Run: timeout --kill-after=5s 50s env PYTHONPATH=src python tests/manual/x11.py --run
Requires Xephyr, xfwm4, xdotool, xclip, xfce4-terminal and uinput access.
PyQt6 and Electron add optional toolkit checks. Avoid typing/changing focus.
The host clipboard, settings and running app are untouched; no audio/network.
@@ -19,7 +19,7 @@ import time
import tty
import uuid
-from manual_safety import hard_deadline
+from safety import hard_deadline
def stop(process):
diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/test_app_edges.py b/tests/unit/test_app_edges.py
similarity index 100%
rename from tests/test_app_edges.py
rename to tests/unit/test_app_edges.py
diff --git a/tests/test_asr_sessions.py b/tests/unit/test_asr_sessions.py
similarity index 100%
rename from tests/test_asr_sessions.py
rename to tests/unit/test_asr_sessions.py
diff --git a/tests/test_au05.py b/tests/unit/test_au05.py
similarity index 100%
rename from tests/test_au05.py
rename to tests/unit/test_au05.py
diff --git a/tests/test_audio_capture.py b/tests/unit/test_audio_capture.py
similarity index 100%
rename from tests/test_audio_capture.py
rename to tests/unit/test_audio_capture.py
diff --git a/tests/test_basketball_motion.py b/tests/unit/test_basketball_motion.py
similarity index 100%
rename from tests/test_basketball_motion.py
rename to tests/unit/test_basketball_motion.py
diff --git a/tests/test_delivery.py b/tests/unit/test_delivery.py
similarity index 100%
rename from tests/test_delivery.py
rename to tests/unit/test_delivery.py
diff --git a/tests/test_desktop.py b/tests/unit/test_desktop.py
similarity index 99%
rename from tests/test_desktop.py
rename to tests/unit/test_desktop.py
index 96c78dc..6aea24b 100644
--- a/tests/test_desktop.py
+++ b/tests/unit/test_desktop.py
@@ -10,7 +10,7 @@ from unittest.mock import patch
from doubao_input import __main__ as entrypoint, preflight
from doubao_input.desktop import is_x11
-ROOT = Path(__file__).resolve().parents[1]
+ROOT = Path(__file__).resolve().parents[2]
SESSIONS = (
({"DISPLAY": ":99", "XDG_SESSION_TYPE": "x11"}, True),
({"DISPLAY": ":99"}, True),
diff --git a/tests/test_direct_input.py b/tests/unit/test_direct_input.py
similarity index 100%
rename from tests/test_direct_input.py
rename to tests/unit/test_direct_input.py
diff --git a/tests/test_escape_guard.py b/tests/unit/test_escape_guard.py
similarity index 100%
rename from tests/test_escape_guard.py
rename to tests/unit/test_escape_guard.py
diff --git a/tests/test_evdev_edges.py b/tests/unit/test_evdev_edges.py
similarity index 100%
rename from tests/test_evdev_edges.py
rename to tests/unit/test_evdev_edges.py
diff --git a/tests/test_gesture.py b/tests/unit/test_gesture.py
similarity index 100%
rename from tests/test_gesture.py
rename to tests/unit/test_gesture.py
diff --git a/tests/test_input_worker.py b/tests/unit/test_input_worker.py
similarity index 100%
rename from tests/test_input_worker.py
rename to tests/unit/test_input_worker.py
diff --git a/tests/test_language.py b/tests/unit/test_language.py
similarity index 100%
rename from tests/test_language.py
rename to tests/unit/test_language.py
diff --git a/tests/test_login_return.py b/tests/unit/test_login_return.py
similarity index 100%
rename from tests/test_login_return.py
rename to tests/unit/test_login_return.py
diff --git a/tests/test_manual_safety.py b/tests/unit/test_manual_safety.py
similarity index 83%
rename from tests/test_manual_safety.py
rename to tests/unit/test_manual_safety.py
index 8b10aed..eee12cc 100644
--- a/tests/test_manual_safety.py
+++ b/tests/unit/test_manual_safety.py
@@ -5,7 +5,7 @@ import unittest
from pathlib import Path
from unittest.mock import Mock
-from manual_safety import drain_events
+from tests.manual.safety import drain_events
class ManualSafetyTest(unittest.TestCase):
@@ -24,7 +24,7 @@ class ManualSafetyTest(unittest.TestCase):
def test_hard_timeout_kills_a_busy_loop(self):
result = subprocess.run([sys.executable, "-c",
- "from manual_safety import hard_deadline\n"
+ "from tests.manual.safety import hard_deadline\n"
"with hard_deadline(0.1):\n while True: pass\n"],
- cwd=Path(__file__).parent, timeout=3)
+ cwd=Path(__file__).resolve().parents[2], timeout=3)
self.assertEqual(result.returncode, -signal.SIGALRM)
diff --git a/tests/test_params_store.py b/tests/unit/test_params_store.py
similarity index 100%
rename from tests/test_params_store.py
rename to tests/unit/test_params_store.py
diff --git a/tests/test_plugin_launch.py b/tests/unit/test_plugin_launch.py
similarity index 100%
rename from tests/test_plugin_launch.py
rename to tests/unit/test_plugin_launch.py
diff --git a/tests/test_polish.py b/tests/unit/test_polish.py
similarity index 100%
rename from tests/test_polish.py
rename to tests/unit/test_polish.py
diff --git a/tests/test_polish_preview.py b/tests/unit/test_polish_preview.py
similarity index 100%
rename from tests/test_polish_preview.py
rename to tests/unit/test_polish_preview.py
diff --git a/tests/test_preferences.py b/tests/unit/test_preferences.py
similarity index 100%
rename from tests/test_preferences.py
rename to tests/unit/test_preferences.py
diff --git a/tests/test_product.py b/tests/unit/test_product.py
similarity index 99%
rename from tests/test_product.py
rename to tests/unit/test_product.py
index 5eaa507..bd01bfd 100644
--- a/tests/test_product.py
+++ b/tests/unit/test_product.py
@@ -25,7 +25,7 @@ def polishing_app(**values):
class ProductTest(TestCase):
def test_runtime_package_and_plugin_versions_match(self):
- root = Path(__file__).resolve().parents[1]
+ root = Path(__file__).resolve().parents[2]
package_version = tomllib.loads((root / "pyproject.toml").read_text())["project"]["version"]
plugin_version = json.loads((root / "manifest.json").read_text())["version"]
self.assertEqual((VERSION, package_version, plugin_version), (VERSION,) * 3)
diff --git a/tests/test_reasoning.py b/tests/unit/test_reasoning.py
similarity index 100%
rename from tests/test_reasoning.py
rename to tests/unit/test_reasoning.py
diff --git a/tests/test_runtime_edges.py b/tests/unit/test_runtime_edges.py
similarity index 100%
rename from tests/test_runtime_edges.py
rename to tests/unit/test_runtime_edges.py
diff --git a/tests/test_settings.py b/tests/unit/test_settings.py
similarity index 100%
rename from tests/test_settings.py
rename to tests/unit/test_settings.py
diff --git a/tests/test_setup_actions.py b/tests/unit/test_setup_actions.py
similarity index 100%
rename from tests/test_setup_actions.py
rename to tests/unit/test_setup_actions.py
diff --git a/tests/test_setup_session.py b/tests/unit/test_setup_session.py
similarity index 100%
rename from tests/test_setup_session.py
rename to tests/unit/test_setup_session.py
diff --git a/tests/test_transcription_sessions.py b/tests/unit/test_transcription_sessions.py
similarity index 100%
rename from tests/test_transcription_sessions.py
rename to tests/unit/test_transcription_sessions.py
diff --git a/tests/test_tray.py b/tests/unit/test_tray.py
similarity index 100%
rename from tests/test_tray.py
rename to tests/unit/test_tray.py
diff --git a/tests/test_tray_menu.py b/tests/unit/test_tray_menu.py
similarity index 100%
rename from tests/test_tray_menu.py
rename to tests/unit/test_tray_menu.py
diff --git a/tests/test_trigger_controller.py b/tests/unit/test_trigger_controller.py
similarity index 100%
rename from tests/test_trigger_controller.py
rename to tests/unit/test_trigger_controller.py
diff --git a/tests/test_trigger_picker.py b/tests/unit/test_trigger_picker.py
similarity index 100%
rename from tests/test_trigger_picker.py
rename to tests/unit/test_trigger_picker.py
diff --git a/tests/test_trigger_reader.py b/tests/unit/test_trigger_reader.py
similarity index 100%
rename from tests/test_trigger_reader.py
rename to tests/unit/test_trigger_reader.py
diff --git a/tests/test_updates.py b/tests/unit/test_updates.py
similarity index 100%
rename from tests/test_updates.py
rename to tests/unit/test_updates.py
diff --git a/tests/test_voice_motion.py b/tests/unit/test_voice_motion.py
similarity index 100%
rename from tests/test_voice_motion.py
rename to tests/unit/test_voice_motion.py
diff --git a/tests/test_volcengine_asr_client.py b/tests/unit/test_volcengine_asr_client.py
similarity index 100%
rename from tests/test_volcengine_asr_client.py
rename to tests/unit/test_volcengine_asr_client.py
diff --git a/tests/test_volcengine_protocol.py b/tests/unit/test_volcengine_protocol.py
similarity index 100%
rename from tests/test_volcengine_protocol.py
rename to tests/unit/test_volcengine_protocol.py
diff --git a/tests/test_waveform.py b/tests/unit/test_waveform.py
similarity index 100%
rename from tests/test_waveform.py
rename to tests/unit/test_waveform.py
diff --git a/tests/test_x11_input.py b/tests/unit/test_x11_input.py
similarity index 100%
rename from tests/test_x11_input.py
rename to tests/unit/test_x11_input.py