All posts

Automate Android App First-Run Checks with Phoma

Automate Android App First-Run Checks with Phoma

Why first-run flows deserve their own test

The first launch of an Android app is a special state. There is no cache, no saved preference, and often no user session. A flow that works after the app has been used for weeks can fail immediately after a fresh install because a permission dialog, coach mark, or empty-state screen appears for the first time.

For QA testers and app developers, first-run checks catch problems that normal regression flows miss: a broken onboarding carousel, a permission prompt that blocks the main screen, a blank home screen, or a call to action that leads nowhere. For operations teams, the same flow can verify that a newly provisioned phone opens the right app state before it is handed to a user.

This guide shows how to build one focused Phoma flow for first-run validation. Phoma runs on your Windows PC and controls your own Android phones visually, so the flow is built from steps and selectors rather than written code.

Define the first-run starting point

Before adding steps, decide what fresh means for the app.

  • App data has been cleared, or the app has been uninstalled and reinstalled.
  • The app is not signed in, unless your test intentionally uses a preconfigured test account.
  • No onboarding flag has been set in local storage.
  • The phone has a stable network connection if the app needs one for first-run content.

Write this definition into the flow name or team notes. A first-run flow is only useful if everyone agrees on the starting state.

If your team already has a clean-state procedure, use it before this flow starts. The goal here is not to rebuild device cleanup, but to validate what the user sees immediately after the app opens in a fresh state.

Map the screens you expect to see

Run the app manually once and record the sequence. A simple first-run path might look like this:

  1. Splash screen appears for a moment.
  2. Welcome screen shows a primary button such as Get Started.
  3. Optional permissions dialog appears.
  4. Three onboarding pages appear with Next and Skip controls.
  5. Home screen appears with an empty-state message.

Turn each screen into a checkpoint. The more concrete the checkpoint, the easier it is to debug when the flow fails.

Build a checkpoint list

  • Launch completes and a known element appears.
  • Splash screen is gone.
  • Permission prompt is handled.
  • Onboarding can be advanced or skipped.
  • Final destination screen shows expected text.
  • Screenshot evidence is captured at key moments.

Create the Phoma flow

Step 1: Launch from a known state

Start the flow by opening the target app. If your team uses a reset step before the flow, place it here. Then wait for the first reliable element instead of relying on a fixed delay.

Open app
  package: com.example.app

Wait for element
  selector: text=Get Started
  timeout: 10 seconds

A fixed delay is tempting, but first-run screens can be slower on low-end phones or when the app downloads remote configuration. Waiting for an element makes the flow more stable.

Step 2: Handle the splash screen with a condition

Some apps show a splash screen only on cold start. Others show it every time. Use a condition so the flow does not fail when the splash is absent.

If element exists
  selector: content-desc=Splash screen
Then
  Wait for element to disappear
    selector: content-desc=Splash screen
    timeout: 8 seconds

If the splash has no useful text or content description, wait for the next known screen instead. For example, wait for Get Started or the first onboarding page title.

Step 3: Accept or dismiss first-run permissions

Android permission dialogs are system screens, so they can look different across phone makers and Android versions. Do not assume one exact label. Use a small set of acceptable selectors.

If element exists
  selector: text=While using the app
Then
  Tap element
    selector: text=While using the app

Else if element exists
  selector: text=Allow
Then
  Tap element
    selector: text=Allow

If the app does not request permissions on first run, the condition simply skips this block. That makes the same flow reusable across builds.

Step 4: Walk the onboarding carousel

Onboarding screens often use a Next button, page dots, or swipe gestures. Prefer a loop with a maximum count so the flow cannot run forever if the app changes.

Repeat up to 5 times
  If element exists
    selector: text=Next
  Then
    Tap element
      selector: text=Next
  Else
    Break loop

If the button uses an icon instead of text, use a content description or resource id when available.

selector: resource-id=com.example.app:id/onboarding_next

After the loop, verify that the expected final screen appears.

Step 5: Verify the destination screen

The final screen should prove that onboarding actually completed. A good check is a stable piece of text, such as a home tab label or an empty-state message.

Wait for element
  selector: text=No items yet
  timeout: 10 seconds

Read text
  selector: text=No items yet
  save as: first_run_empty_state

If the app sends the user to a login screen instead of the home screen, decide whether that is expected. For a guest-first app, reaching login may be a failure. For an account-first app, reaching login may be the correct endpoint.

Step 6: Capture evidence

Add screenshots at meaningful points, not after every tap.

  • After launch, before any interaction.
  • After permissions are handled.
  • On the final onboarding page.
  • On the destination screen.

Screenshots help reviewers see whether a failure came from timing, layout, or an unexpected dialog.

Choose selectors that survive small app updates

First-run screens change often because they are tied to product messaging. Prefer selectors that describe meaning rather than position.

Good choices:

text=Continue
text=Skip
content-desc=Close
resource-id=com.example.app:id/btn_primary

Avoid choices like the third child of a layout unless there is no alternative. If you must use a structural selector, combine it with text or a resource id so it is less likely to break.

For repeated onboarding pages, a content description such as Next page is often more stable than the visible page title, because titles may change with localization or marketing copy.

Make the flow tolerant of optional screens

First-run experiences are full of optional branches:

  • A review prompt may appear after a few pages.
  • A network permission dialog may appear only on Wi-Fi.
  • A personalization screen may appear only for new installs.
  • A dark-mode suggestion may appear only once.

Use conditions for each optional screen. If the element is not present, continue. This keeps the flow focused on the main path while still handling common variations.

Run the flow on more than one phone

First-run behavior can vary by Android version, screen size, and device manufacturer. Run the same flow on at least two phones: one clean test device and one older or lower-memory device if your users have them.

If the flow fails only on one phone, inspect the screenshot. The usual causes are:

  • A permission dialog with different wording.
  • A splash screen that lasts longer.
  • An onboarding button below the visible area.
  • A remote first-run screen that failed to load.

Add alternate selectors or an extra wait for the affected screen, then rerun the flow.

What to hand off to the team

When the flow is stable, share it with the team along with a short note:

  • What fresh state means.
  • Which screens are expected.
  • Which selectors are intentionally used.
  • Which failures require a human review.

A first-run flow is most valuable when it gives the team a repeatable answer to a simple question: does the app open into a usable state for a new user? With a small Phoma flow, you can answer that question on every build without writing code.