Automation lab Aú State & Session Management (STATE_SESSION)

Lab 046: Optimistic update and rollback on failure

Practice optimistic update and rollback on failure in a real web app context as part of the State & Session Management module.

intermediate intermediate
intermediate

Objectives

Use for test scripts
  • Understand the purpose and business flow of optimistic update and rollback on failure.
  • Design stable locators for key UI elements.
  • Automate user interactions and verify the resulting UI state.

Sandbox

State & Session / state / intermediate / active

Optimistic update and rollback on failure

Apply optimistic UI then rollback if server fails.

Reading and understanding requirements Choosing stable locators Designing assertions based on business rules

Learning objectives

  • Show immediate optimistic UI change.
  • Revert state on failure.
  • Confirm success state when server responds 200.

Steps

  1. Toggle like then see optimistic increment.
  2. Simulate failure then rollback.
  3. Simulate success to persist increment.

Practice sandbox

Optimistic like with possible rollback.

Likes: 10

Idle

Assertions to practice

  • Optimistic increment shown immediately after like.
  • Failure rolls count back and shows error.
  • Success keeps increment and shows success status.