Appium 2

Capture a screenshot on failure

Medium70 pts~25 min
  • Debugging
  • Test reporting
Practice app · Acme Mobile

A mobile app in a device frame. Elements expose data-accessibility-id (= aria-label) for AppiumBy.accessibilityId.

Test URL
/lab/appium-capture-a-screenshot-on-failure

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Attach a screenshot automatically whenever a test fails, without cluttering passing runs.

Your task

  1. 1Log in as qa@target.dev / Test@123 via the accessibility ids "username", "password" and "login".
  2. 2Assert the inbox is displayed.
  3. 3Add a failure hook (try/catch, TestWatcher, pytest hook, afterEach state check or NUnit result check) that saves a screenshot.
  4. 4Name the file after the test and a timestamp.

Acceptance criteria

  • The inbox is shown
  • A screenshot is taken on failure
  • At least 1 assertion passes

Fixtures

username
qa@target.dev
password
Test@123

Appium 2 · Appium · Architecture & CI