All posts

Fix Phoma Flows After Android App UI Changes

Fix Phoma Flows After Android App UI Changes

Why Android UI Changes Break Phoma Flows

When an app updates its UI the accessibility tree that Phoma reads under the hood shifts. Buttons get new text IDs change layouts reorder each of these changes is invisible to the flow until it runs and fails. Phoma maps each step to an element using attributes like resource-id content-desc or visible text. When any of those attributes shift the step can't find its target and the flow stops. Understanding this mapping is the first step to recovery without starting over.

Diagnose Which Element Changed

  1. Open the Phoma flow that failed and locate the step that errored.
  2. Click the Edit element or Inspect button associated with that step. Phoma will show the current element tree as it sees it on the connected phone.
  3. Compare the displayed tree with your app's known structure. Look for differences in resource-id content-desc or the exact text value.
  4. If you have a previous version of the app side-by-side the two trees. Common changes include a button's text shifting from Login to Sign in or a container's ID being renamed from com.app:id/submit_btn to com.app:id/continue.
  5. Note the exact attribute that changed. This targeted note saves time instead of guessing.

Update the Selector in Phoma's Visual Builder

Once you've identified the changed attribute updating the selector is usually a few clicks:

  • Replace text-based selection: If the step was tied to button text edit the text field to match the new label. Phoma supports exact match contains and regex patterns. For example changing from exact Submit to contains:Submit future-proofs the step against minor text tweaks.
  • Swap the resource-id: If the ID changed but the visual label stayed the same replace the ID value in the selector configuration. Phoma will re-query the phone for the new ID.
  • Add a fallback: For critical steps you can add a second selector condition. Phoma will try the first match; if it fails it attempts the second. This is useful when an element occasionally disappears due to network-induced loading states.
  • Use description over ID: Whenever possible prefer content-desc or visible text that's less likely to change between releases. If the app provides content-desc use that as the primary selector.

Code Block Example: Selector Configuration Snippet

While Phoma's interface handles selector edits visually understanding the underlying configuration helps when you need to manually edit or version-control steps. Below is a representation of how a step's element selector might look in Phoma's internal format:

step: tap element: resource_id: com.example.app:id/submit_button text_contains: Submit fallback: - resource_id: com.example.app:id/continue_button

In practice you'll adjust these fields through Phoma's point-and-click editor but keeping this structure in mind makes it easier to document changes or restore a selector after a fresh app install.

Real-World Example: Fixing a Login Flow After a Rebrand

Imagine a QA team maintains a Phoma flow that taps the Login button on an app's home screen. After a minor release the button text changes to Get Started and the underlying ID renames from id/login to id/auth_start. The flow fails at the tap step with an element not found error.

Step-by-step fix:

  1. Open the flow in Phoma and select the failing tap step.
  2. Inspect the element tree. Notice the text changed and the ID shifted.
  3. In the step editor change the text_contains value from Login to contains:Get Started.
  4. Update the resource_id to the new com.example.app:id/auth_start.
  5. Run the flow again. The step now locates the button by the new text and ID and the flow proceeds.
  6. Add a brief wait for element step before the tap set to wait up to 5 seconds to absorb any future UI rendering delays.

After this fix the flow remains stable even if the development team later tweaks the button's padding or adds a subtle animation; the selector relies on text content and ID which are less volatile than screen coordinates or absolute positions.

Preventive Practices for Team Flows

Maintaining selectors across app updates is easier when the team adopts a few habits:

  • Document the app version each flow was built against. Add a notes step at the flow's start or keep a separate spreadsheet linking flow names to tested app versions.
  • Favor text_contains over exact text matches. A change from Submit to Submit! should not break the flow if the selector uses contains.
  • Review element trees after every CI build. If your team uses Phoma on a shared machine make it a quick checkpoint after each test run.
  • Use fallback selectors sparingly. Adding too many fallbacks can make debugging harder; reserve them for steps that genuinely intermittently fail.
  • Tie selector stability to the app's release notes. If a release mentions redesigned onboarding plan to review onboarding-related flows in advance.

Recovering Multiple Flows at Once

When an app update affects many flows updating each one individually is tedious. Phoma's flow list lets you select multiple flows and apply the same selector change across them. To do this:

  1. Go to the Phoma dashboard and check the boxes next to the flows you want to update.
  2. Choose Edit selected steps from the bulk actions menu.
  3. Apply the new text or ID change. Phoma will propagate the update to the corresponding steps in each selected flow.
  4. Run a quick test on one phone per flow to confirm the change took effect before deploying to the full set.

This bulk approach is especially valuable for small businesses and operations teams that run the same verification tasks on a dozen phones daily.

When to Repair vs Rebuild

Not every UI change can be patched quickly. Use this heuristic:

  • If fewer than 30% of steps error out update the affected selectors individually as described above.
  • If more than 30% of steps fail or if the app's layout logic has fundamentally shifted (e.g navigation moved from a bottom tab bar to a side drawer) consider rebuilding the most impacted flows from scratch. Starting fresh often yields a more maintainable structure than patching a dozen fragile selectors.
  • Keep the original flow version until the rebuilt flow has been run successfully on a test phone for at least one full cycle. This safety net lets you roll back if the new flow misses a step or introduces a regression.

Conclusion: Maintainable Phoma Flows After Updates

Android app updates are inevitable but flow breakage doesn't have to halt your QA or operations work. By understanding how Phoma maps steps to elements diagnosing changes methodically and using the visual builder's selector tools - text_contains ID swaps and fallbacks - you can recover most automations in minutes rather than hours. Adopting preventive habits like version documentation and contains-based text matching further reduces the frequency of future fixes. When the changes are too deep a strategic rebuild guided by the original flow's structure ensures your automations stay reliable without starting from zero every time.