[{"data":1,"prerenderedAt":20},["ShallowReactive",2],{"blog-post-en-text-assertions-and-screenshots-in-phoma-flows":3},{"slug":4,"lang":5,"title":6,"summary":7,"date":8,"tags":9,"tag_slugs":15,"thumbnail_url":16,"translations":17,"body":18,"asset_base":19},"text-assertions-and-screenshots-in-phoma-flows","en","Add Text Assertions and Screenshot Checkpoints to Phoma Flows","Learn how to verify Android app behavior in Phoma by reading screen text, comparing it to expected values, and capturing screenshots as evidence.","2026-11-09",[10,11,12,13,14],"phoma","android","qa","automation","visual-flows",[10,11,12,13,14],"https://blog-api.phomaapp.com/api/blog/posts/text-assertions-and-screenshots-in-phoma-flows/thumbnail.svg?lang=en",[5],"## Why a flow without a check is just a guess\n\nPhoma 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.\n\nFor 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.\n\n## Start with the thing you want to prove\n\nBefore opening Phoma, decide what \"correct\" looks like for the flow you are automating. Good checkpoints answer a yes/no question:\n\n- Did the welcome screen appear after login?\n- Did the confirmation message say \"Expense saved\" after tapping Save?\n- Is the balance field showing the new total after a transaction?\n\nPick 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.\n\n## Add a Read text step\n\nOpen 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.\n\n### Choosing a stable selector\n\nChoose 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:\n\n```\nresource-id: com.example.expense:id/confirmation_text\ncontent-desc: Confirmation message\n```\n\nIf 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.\n\n### Waiting for slow screens\n\nAdd 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.\n\n## Compare the text to an expected value\n\nAfter 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:\n\n```\nCaptured text: Expense saved\nExpected text: Expense saved\nResult: Pass\n```\n\nIf the condition passes, continue to the next step or end the flow successfully. If it fails, branch to a failure path.\n\nReal-world example: a daily check for an expense app.\n\n1. Open the expense app.\n2. Wait for the home screen.\n3. Tap New expense.\n4. Type 42.00 into the amount field.\n5. Tap Save.\n6. Wait for the confirmation element.\n7. Read text from the confirmation element.\n8. Condition: captured text equals \"Expense saved\".\n\nIf 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.\n\n## Use screenshots as evidence\n\nText 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:\n\n- At the end of every successful flow, so you have a baseline image for each device.\n- Immediately before a condition check, so you can compare the pass image with the fail image.\n- On the failure path, so you can see the error screen, missing element, or unexpected pop-up.\n\n### Screenshot naming for multiple devices\n\nIn 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:\n\n```\nsuccess_pixel_6_2024-06-12.png\nfail_pixel_6_2024-06-12.png\n```\n\nScreenshots 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.\n\n## Build the failure path\n\nWhen a condition fails, do not let the flow keep tapping blindly. Add steps to:\n\n1. Take a screenshot.\n2. Stop the flow or mark it as failed.\n3. Optionally write a short note in the flow run log describing which check failed.\n\nThis 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.\n\n## Run the same check on many phones\n\nPhoma 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.\n\nIf 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.\n\n## Keep the flow maintainable\n\n- Name steps after what they check, not after where they sit in the flow. Use \"Confirm expense saved\" instead of \"Step 7.\"\n- 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.\n- 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.\n- 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.\n\n## Example: end-to-end sanity check\n\nHere is how the complete flow looks in practice for an expense-checking use case:\n\n```\n1. Open app: com.example.expense\n2. Wait for element: home_screen_loaded\n3. Tap: button_new_expense\n4. Wait for element: amount_input\n5. Type text: amount_input -> 42.00\n6. Tap: button_save\n7. Wait for element: confirmation_text\n8. Read text: confirmation_text\n9. Condition: text equals \"Expense saved\"\n   - Pass: Screenshot -> success_\u003Cdevice>_\u003Cdate>.png\n   - Fail: Screenshot -> fail_\u003Cdevice>_\u003Cdate>.png; Stop flow\n```\n\nThe 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.\n\n## Bottom line\n\nA 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.\n","https://blog-api.phomaapp.com/api/blog/posts/text-assertions-and-screenshots-in-phoma-flows/assets",1796035641781]