Software QA / Intermediate: integrated product evidence / Lesson 9
Web journeys, sessions, and asynchronous behavior
Design browser evidence around user outcomes while controlling navigation, account state, and asynchronous updates. Investigate stale results and session boundaries instead of relying on arbitrary delays.
On this page
Lesson goals
- Write observable journey steps and resilient locators.
- Test asynchronous ordering and navigation recovery.
- Keep browser state isolated between cases.
Start from the user’s task
A useful journey has a purpose such as finding an Arabic workshop, enrolling, and confirming that it appears in the learner’s schedule. Establish a fresh account, deterministic course data, and the starting route. Assert meaningful milestones rather than every layout detail: selected language, correct course identity, confirmation, and persisted schedule entry. Use accessible roles and labels when they express the control’s purpose. A CSS class chosen for styling may change without any behavior change, while an unlabelled control reveals a usability problem even before automation is considered.
Worked case: stale search results
Search for “data,” then immediately replace it with “design.” In a controlled local response setup, delay the first result so it arrives after the second. The final page should show results for “design” under the agreed latest-query rule, not an older result replacing them. Assert the query label, result identifiers, and loading state. A fixed wait of two seconds may pass on one machine and fail on another without testing the ordering risk. Explicitly control completion order and wait for the relevant visible condition.
Action/arrival | Expected visible state
Send Q1=data | loading for data
Send Q2=design | loading for design
Receive Q2 | design results
Receive Q1 late | still design results; no stale overwrite
This is a controlled application scenario, not a claim that every browser event sequence has been tested.
Sessions are part of the test precondition
A test that inherits authentication from a previous test can pass for the wrong reason. Isolate cookies, storage, and account data between cases; create the required role deliberately. Test expired and signed-out states with explicit expected outcomes. Verify that a protected action cannot succeed merely because an old page still displays a button. Session expiry should preserve or discard unsaved work according to the agreed policy, and the user should receive a useful route to recovery. Observe server acceptance as well as visible navigation.
Keep browser evidence interpretable
Capture failure screenshots or traces when they answer the test question, and redact sensitive content. Record browser version, viewport, locale, and relevant server build. Compare a small supported browser matrix based on users and known rendering risks rather than multiplying every test across every option. Distinguish a product defect from a locator failure by examining what the user could actually do. When a test fails, preserve the first failure evidence before retrying; a later pass does not erase the original observation or explain its cause.
Common errors and fixes
Adding sleeps until the browser test passes
- Why it happens
- Time substitutes for observing readiness.
- How to fix it
- Wait for a meaningful state or response under a bounded timeout.
- Prevent it next time
- Control asynchronous scenarios and document their oracle.
Tests share a logged-in browser
- Why it happens
- Cookies and local state leak between cases.
- How to fix it
- Create isolated browser contexts and explicit roles.
- Prevent it next time
- Run cases independently and in varied order when diagnosing leaks.
A screenshot is accepted as persistence evidence
- Why it happens
- Visible state may be optimistic or stale.
- How to fix it
- Reload or read the relevant resource and assert stable identity.
- Prevent it next time
- Include a persistence observation in critical journeys.
Check your understanding
1. A test clicks Enroll then immediately checks a confirmation. How should it wait?
Show worked solution
Use the framework’s bounded assertion waiting for the confirmation tied to the requested course, then verify the enrollment identity. Avoid a fixed sleep. If confirmation can be optimistic, add a persisted-state observation or reload check according to the journey’s purpose.
2. A search test passes when run after login but fails alone. What do you investigate?
Show worked solution
Inspect inherited authentication, locale, storage, and data created by the preceding case. Recreate needed preconditions in this test and isolate its browser state. Confirm that the chosen account can legitimately search; do not hide the dependency by enforcing a permanent test order.
Key takeaways
- Browser tests should observe meaningful user outcomes under explicit state.
- Control ordering and readiness instead of guessing delays.