Add Text Assertions and Screenshot Checkpoints to Phoma Flows
Why a flow without a check is just a guess
Phoma lets you build Android automation visually: open an app, tap a button, type text, swipe, and so on. Those actions move the phone forward, but they do not prove the app behaved correctly. A flow can tap "Save" and still land on an error screen, save the wrong record, or silently fail because the network was slow.
For QA testers and teams running the same checks every day, the missing piece is usually verification: read something back from the screen and compare it to what you expected. This post shows how to add text assertions and screenshot checkpoints to Phoma flows, with a concrete expense-tracking example you can adapt to your own app.
Start with the thing you want to prove
Before opening Phoma, decide what "correct" looks like for the flow you are automating. Good checkpoints answer a yes/no question:
- Did the welcome screen appear after login?
- Did the confirmation message say "Expense saved" after tapping Save?
- Is the balance field showing the new total after a transaction?
Pick text that is stable and visible on the screen. Avoid text that changes every run, such as timestamps, random IDs, or greetings that include the current time. If the app copy changes between releases, update the expected text in Phoma when you release-test the new build.
Add a Read text step
Open your flow in Phoma and select the Android phone you want to check. Add a step after the action you want to verify. Choose Read text, then point at the element that holds the message. Phoma shows the app layout and element tree so you can pick the right element visually; no code is required.
Choosing a stable selector
Choose a selector that survives app updates. Prefer resource-id or content-desc over on-screen text when the text itself might change. Example selector for a confirmation message:
resource-id: com.example.expense:id/confirmation_text
content-desc: Confirmation message
If you must match visible text, use an attribute that does not include dynamic values. Do not build a selector around "Saved at 2:14 PM" because the minute changes every run.
Waiting for slow screens
Add a Wait for element step before Read text if the screen takes a moment to appear. This prevents the flow from reading an empty or old value while the app is still loading.
Compare the text to an expected value
After reading the text, add a Condition step. In Phoma’s visual builder, set the condition to compare the captured text with your expected string. For example:
Captured text: Expense saved
Expected text: Expense saved
Result: Pass
If the condition passes, continue to the next step or end the flow successfully. If it fails, branch to a failure path.
Real-world example: a daily check for an expense app.
- Open the expense app.
- Wait for the home screen.
- Tap New expense.
- Type 42.00 into the amount field.
- Tap Save.
- Wait for the confirmation element.
- Read text from the confirmation element.
- Condition: captured text equals "Expense saved".
If the app instead shows "Could not save," the condition fails and the flow can take the failure branch instead of continuing as if nothing happened.
Use screenshots as evidence
Text assertions tell you whether a step passed or failed. Screenshots tell you what the screen actually looked like. Add a Screenshot step in three places:
- At the end of every successful flow, so you have a baseline image for each device.
- Immediately before a condition check, so you can compare the pass image with the fail image.
- On the failure path, so you can see the error screen, missing element, or unexpected pop-up.
Screenshot naming for multiple devices
In Phoma, name screenshots with the device name and date so they do not overwrite each other when you run the same flow on many phones:
success_pixel_6_2024-06-12.png
fail_pixel_6_2024-06-12.png
Screenshots are stored on your PC, not on the phone, which makes them easy to attach to a bug report or review later with your team.
Build the failure path
When a condition fails, do not let the flow keep tapping blindly. Add steps to:
- Take a screenshot.
- Stop the flow or mark it as failed.
- Optionally write a short note in the flow run log describing which check failed.
This keeps your results honest. A flow that taps "Save" and then proceeds to the next screen even though the save failed is worse than no flow at all, because it creates false confidence.
Run the same check on many phones
Phoma flows run on your own computer and phones. Once the flow is built, you can run it on one phone or many phones in sequence, and schedule runs while the app is open. Because everything on your own phones is free with no limit on phones or flows, you can add this sanity check to every device your team uses for testing.
If you run the flow on several phones, use device-specific screenshot names and check that each phone is on the same app version. Different screen sizes can move elements, so verify your selector works on each form factor before relying on the result.
Keep the flow maintainable
- Name steps after what they check, not after where they sit in the flow. Use "Confirm expense saved" instead of "Step 7."
- Keep expected strings in one place if the same message appears in multiple flows. When the app copy changes, update it once rather than hunting through flows.
- Review failures weekly. If a check starts failing because the app redesigned a screen, update the selector and expected text in Phoma’s visual builder.
- Run checks at a polite pace within the app’s terms. Do not use flows to create accounts in bulk, scrape personal data, or bypass protections.
Example: end-to-end sanity check
Here is how the complete flow looks in practice for an expense-checking use case:
1. Open app: com.example.expense
2. Wait for element: home_screen_loaded
3. Tap: button_new_expense
4. Wait for element: amount_input
5. Type text: amount_input -> 42.00
6. Tap: button_save
7. Wait for element: confirmation_text
8. Read text: confirmation_text
9. Condition: text equals "Expense saved"
- Pass: Screenshot -> success_<device>_<date>.png
- Fail: Screenshot -> fail_<device>_<date>.png; Stop flow
The flow does not write code. Every line above is a step you add in Phoma’s visual builder, and the selector is chosen from the element tree on the phone’s screen.
Bottom line
A Phoma flow becomes a real quality check when it reads back from the screen and compares the result to an expectation. Pair text assertions with screenshots, handle failures explicitly, and run the same flow across your test phones. You will catch broken saves, missing messages, and failed logins before a human tester has to tap through the same steps by hand.
