---
title: "Verify Android drafts after Back navigation"
description: "Test whether an Android form keeps its unsaved draft through Back navigation, distinguishes discard from save, and prevents accidental record creation."
canonical_url: "https://vostride.com/agent-library/android-flows/draft-after-back-navigation.md"
md_url: "https://vostride.com/agent-library/android-flows/draft-after-back-navigation.md"
content_kind: "recipe"
topic: "android-flows"
---

# Verify Android drafts after Back navigation

Test whether an Android form keeps its unsaved draft through Back navigation, distinguishes discard from save, and prevents accidental record creation.

## Risk

Navigation changes often preserve what is visible while dropping the underlying draft. This recipe separates dismissing the keyboard, leaving a form, and explicitly discarding data so a reassuring screen cannot conceal data loss.

## Fixtures

- An owned Android sandbox build configured with its appPackage, device profile, and explicit use.mobile.appState: reset.
- A disposable signed-in user with permission to create notes and an empty notes collection verified through a project-owned read endpoint.
- A note draft containing a unique title, a multiline body, and a nondefault category; document the intended draft retention policy before running.

## Steps

1. Open the new-note form, fill all three draft values, and verify each entered value remains visible before navigating.
2. Use the app-supported Back navigation while the keyboard is visible and verify the form stays open if the first action only dismisses the keyboard.
3. Leave the editor using its Back control and verify the documented keep-or-discard prompt appears with unambiguous choices.
4. Choose the keep-draft option, reopen the editor, and verify title, line breaks, and category all match the original unsaved values.
5. Explicitly discard the draft, reopen a new note, and verify the fields reset; inspect the prepared read oracle and verify no saved note carries the unique title.

## Expected results

- The returned editor contains every draft field, including the category selected after text entry.
- The final new-note form contains the documented defaults rather than the discarded draft.
- The independent collection query reports zero committed notes with the run-specific title.

## False-pass traps

- A title retained by autofill can mask loss of the body and category.
- A toast saying draft saved does not prove that reopening restores it or that no final record was created.

## Cleanup

- Remove any unexpected test note and reset the disposable account draft state.

## Use with agent-qa

Adapt this test design to your application's acceptance criteria and configured target using the [recipe execution guide](/agent-library/software-factory/turn-a-recipe-into-an-agent-qa-test.md). External fixture setup and non-UI checks require your own supported hooks or test tooling. Validate the authored test, execute it, and inspect the completed evidence; this recipe is not a recorded test result.

## References

- [agent-qa mobile testing](/docs/agent-qa/guides/mobile-testing.md)
- [agent-qa test](/docs/agent-qa/configuration/test.md)
- [agent-qa hooks](/docs/agent-qa/guides/hooks.md)

- [Android application QA recipes](/agent-library/android-flows.md)
- [Software factory QA library](/agent-library.md)
