fix(e2e): explicit Cargo feature + stage fixtures into Tauri $TEMP scope#29
Merged
Merged
Conversation
Two adjacent fixes that together unblock `npm run test:e2e` on macOS:
1. Replace `[target.'cfg(debug_assertions)'.dependencies]` (which Cargo
evaluates against target spec triples, not rustc's debug_assertions
flag, producing an unexpected-cfg warning and non-deterministic plugin
inclusion) with an opt-in `e2e` Cargo feature. The
tauri-plugin-webdriver-automation plugin now compiles in only when
built with --features e2e. Release builds are unaffected.
2. Stage e2e fixtures into ${os.tmpdir()}/papercut-e2e/{real,error,output}/
so they fall inside Tauri's $TEMP fs capability scope. Without this,
every test fails at handleFileSelected → getFileSizeBytes → scope
denied → corrupt-file branch, and the step bar never advances past 0.
Real fixtures are mirrored at the top of wdio.conf.ts; generated
error-path fixtures (large-sparse, corrupt) go to the same staging
area via generate-e2e-fixtures.mjs.
After this change, the success-case PDF compression tests
(PDF-Q-WEB / SCREEN / PRINT) all pass. A separate upstream issue in
tauri-plugin-webdriver-automation 0.1.3 (lock poisoned: PoisonError on
cross-test transitions) prevents the rest of the suite from completing
and is tracked upstream.
New build command: `npm run e2e:build` (alias for
`tauri build --debug --features e2e --bundles app`).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Owner
Author
|
Upstream issue filed: danielraffel/tauri-webdriver#4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two adjacent fixes that together unblock
npm run test:e2eon macOS, addressing the long-standing E2E breakage flagged in yesterday's security-hardening session.1. Cargo
debug_assertionspredicate → explicite2efeatureThe previous
[target.'cfg(debug_assertions)'.dependencies]form was incorrect: Cargo evaluates[target.<cfg>.dependencies]against target spec triples and target features, not against rustc'sdebug_assertionsflag. This produced an unexpected-cfg warning and made plugin inclusion non-deterministic.Replaced with an opt-in
e2eCargo feature.tauri-plugin-webdriver-automationnow compiles in only when built with--features e2e; release builds are unaffected.2. Stage e2e fixtures into Tauri's
$TEMPcapability scopeTauri's fs capability scope (
src-tauri/capabilities/default.json) only permits reads from$DOCUMENT / $DOWNLOAD / $DESKTOP / $TEMP. Real fixtures live in~/papercut/test-fixtures/, which is outside every allowed scope. Every PDF/Image E2E test was failing withTimed out waiting for step 1because:src/e2e/helpers/driver.tsalready documented the intended fix ("CI can place [fixtures] inside/tmp(within Tauri's$TEMPfs scope)"), but the staging wiring was missing.Now: at the top of
wdio.conf.tswe copy real fixtures into${os.tmpdir()}/papercut-e2e/real/, andgenerate-e2e-fixtures.mjswrites generated error-path fixtures (large-sparse.*,corrupt.*) into${os.tmpdir()}/papercut-e2e/error/. The driver helper picks both up viaE2E_*_DIRenv vars set by the same code (CI overrides still win via??=).Result
Timed out waiting for step 1.PDF-Q-WEB / SCREEN / PRINT) all pass in ~21s.lock poisoned: PoisonErrorintauri-plugin-webdriver-automation 0.1.3across test transitions) blocks the remaining tests. Tracked upstream — out of scope for this PR.New build command
The previous command (
npm run tauri -- build --debug --bundles app) no longer compiles the plugin in. The--bundles appflag is still required because the default DMG bundling step deletes the.appthat wdio expects.Files changed
src-tauri/Cargo.toml—[features]+optional = truedepsrc-tauri/src/lib.rs—#[cfg(feature = "e2e")]src/e2e/wdio.conf.ts— top-of-file fixture stagingsrc/e2e/fixtures/generate-e2e-fixtures.mjs— write to$TMPDIR/papercut-e2e/error/package.json— newe2e:buildscriptSecurity notes (R015)
$TEMPallowlist already indefault.json.e2eCargo feature is opt-in; never set in any production/release build path. Renderer→Rust trust boundary (P014) unchanged.--features e2eto a packaged build, it would expose the WebDriver automation port (4444) to whoever runs the resulting.app. Suggest a follow-up note in.claude/project_rules_decisions.mdunder P013 reinforcing thate2emust remain off in any release-path build.Test plan
cargo check --manifest-path src-tauri/Cargo.toml— clean (no e2e feature)cargo check --manifest-path src-tauri/Cargo.toml --features e2e— clean (with e2e feature)npm run test— 503/503 passingnpx tsc --noEmit(main) — cleannpm run e2e:buildthennpm run test:e2e:pdf— PDF-Q-WEB/SCREEN/PRINT pass; further tests blocked by the upstream PoisonError noted abovenpm audit --omit=dev— 0 advisories (per P015)🤖 Generated with Claude Code