Repository navigation
feat(e2e): reuse the running app between tests through a reset link - #1258
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
A critical active finding remains because the invalid detached wait state throws before the app relaunch fallback can run.
1 open issue
What changed in this PR
This pull request reduces mobile E2E runtime by reusing the running example app between successful tests, resetting navigation in place through a deep link, and relaunching when app state cannot be trusted.
Changes:
- Adds reset-link handling, keyboard dismissal, animation suppression, and mount markers to the example app.
- Tracks E2E session state and conditionally reuses or relaunches the app.
- Removes redundant RTL cleanup hooks and updates E2E documentation and configuration.
| File | Description |
|---|---|
| example/src/App.tsx | Adds reset-link handling, navigation-stack resets, keyboard dismissal, animation suppression, and mount markers to the example app. |
| e2e/tests/support/test.ts | Tracks test success and app-session trust to control reuse after failures or timeouts. |
| e2e/tests/support/app.ts | Reuses the running app through reset links and falls back to relaunching when reuse is unsafe. |
| e2e/tests/set-page-animation.e2e.ts | Removes the previous RTL restoration cleanup hook. |
| e2e/tests/issues/issue-1154-page-change-focus.e2e.ts | Removes the previous RTL restoration cleanup hook. |
| e2e/tests/issues/issue-1050-back-gesture.e2e.ts | Removes the previous RTL restoration cleanup hook. |
| e2e/tests/basic-pager.e2e.ts | Removes the previous RTL restoration cleanup hook. |
| e2e/README.md | Documents app reuse, reset-link behavior, session tracking, and the updated test lifecycle. |
| e2e/e2e.config.ts | Removes the cleanup timeout that was required by the previous relaunch-based hooks. |
Review effort: Lite
🟢 e2e: 68 passedAll 68 tests in 27 files
Tested by e2e 0.23.1 · 4m 16s · android · run artifacts |
Apex Sentinel · ✅ Approve · review of
|
| Where | Finding |
|---|---|
e2e/tests/support/test.ts:29 |
A test.skip inside a body marks the next test's app as dirty |
1 finding below minor hidden (user_settings.min_severity).
Reviewed with this repository's own Sentinel configuration (9ed912f7fb58).
💬 Talking to Sentinel
In a finding's thread, reply with:
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 6cd49d1. The verdict and the full list are in the summary comment.
| apply(target, thisArg, args: unknown[]) { | ||
| const body = args.at(-1) as (fixtures: unknown) => Promise<void>; | ||
| args[args.length - 1] = async (fixtures: unknown) => { | ||
| if (!appSession.lastTestPassed) appSession.state = undefined; | ||
| appSession.lastTestPassed = false; | ||
| await body(fixtures); | ||
| appSession.lastTestPassed = true; | ||
| }; | ||
| return Reflect.apply(target, thisArg, args); | ||
| }, |
There was a problem hiding this comment.
🟡 Minor · A test.skip inside a body marks the next test's app as dirty
skipWithoutContentPop aborts the body with the engine's skip signal, so await body(fixtures) never resolves normally and lastTestPassed stays false. Every test following a skip then relaunches the app; on iOS without the content pop, all four issue-1050 tests take the slow path, cancelling the speed-up this PR targets on those devices.
Details
Also raised here
Also raised at this location by persona maintainability: test wrapper assumes the last argument is the test body — The Proxy apply trap casts whatever is last in args to the test function and replaces it, so any declaration whose last argument is not a body — the body-less form vitest accepts for a todo/skipped scenario, or a call written as test(name, options) — gets a string or options object turned into an async function that is then called as body(fixtures), and a todo silently becomes a failing implemented test. Add the pass/fail bookkeeping only when the last argument is a function, so the wrapper stays correct for every declaration form vitest supports.
persona: senior-developer, maintainability
Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.
Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if it is wrong — I will re-check the cited code.
🟢 e2e ios: 51 passedAll 51 tests in 20 files
Tested by e2e 0.23.1 · 5m 41s · ios · run artifacts |
🟢 e2e ios-spm: 51 passedAll 51 tests in 20 files
Tested by e2e 0.23.1 · 7m 47s · ios · run artifacts |

No description provided.