Packages
ark_navigation_test
Install the testing companion and choose between an owned driver, borrowed observer, typed waits and exact matchers.
A development companion for testing your application's actual Ark Navigation configuration. Core remains independent of the companion and its assertion library.
ark_navigation_test1.0.0dependencies:
ark_navigation: ^2.4.1
dev_dependencies:
ark_navigation_test: ^1.0.0
flutter_test:
sdk: flutter
Start with one complete test. It contains every import, route, Graph declaration and assertion.
API map
| Tool | Responsibility |
|---|---|
| NavigationTestDriver | Own a real Controller and close it explicitly |
| NavigationTestObserver | Observe an externally owned Controller/Session through distinct event/failure views and lifecycle callbacks |
| NavigationTestWait | Bound commit, Entry completion or operation waits without cancellation |
| NavigationTestMatchers | Compare exact Snapshot stacks/active child and exact observed lifecycle exits/failures |
| NavigationTestEntryExpectation | Require Route identity, optionally exact Mount and Entry identity |
Register driver.close immediately. For a borrowed Session, unmount consumers, dispose the actual owner and then stop recording. Driver close does not await business resources; existing raw Controller references cannot be revoked.
Metadata history is finite and never retains Destination values, concrete URI values or raw error/StackTrace objects. Application-defined IDs and Type names can still reveal application structure. A truncated or incorrectly wired log is not complete evidence.
Timeout does not cancel navigation or advance fake clocks. Use WidgetTester for actual rendering and a separately awaited acknowledgement for asynchronous resources.
Complete examples
- First test: commit, typed result and exact exit.
- Account flow: guest/private Mounts, retained tabs and logout.
- Flutter host: real nested rendering, Guard permission and fake time.