Automate Multi Step Checkout Flow in Android Shopping Apps
Why Automate Checkout Flows
Automating a multi‑step checkout in an Android shopping app brings three immediate benefits. First, it eliminates the manual repetition that QA engineers perform every release cycle, freeing them to focus on exploratory testing. Second, a reliable flow ensures that regression tests cover the exact user journey, reducing the risk of a broken payment or shipping step slipping into production. Third, once the flow is recorded, it can be reused across many devices, making it ideal for distributed test labs or small teams that run nightly sanity checks.
Prerequisites
- Phoma installed on a Windows desktop. The application runs locally, so no cloud subscription is required.
- Android device with USB debugging enabled, or Wi‑Fi ADB debugging configured. Verify the connection with
adb devices; the device should appear as device. - Drivers for the device (often installed automatically by the Android SDK). If the PC does not recognize the phone, reinstall the Google USB driver or use a Wi‑Fi debugging app such as scrcpy‑adb.
- A recent version of the shopping app that you intend to test. The flow will interact with UI elements that may change after an update, so stable selectors are essential.
Step 1: Connect Device and Verify
- Plug the phone into the PC via USB, enable Developer options → USB debugging, and confirm the prompt on the device.
- Open a command prompt and run
adb devices. You should see a line like0123456789ABCDEF device. - In Phoma, click Add Device → choose USB (or Wi‑Fi if you configured it). The app will list the connected phone; select it and click Connect.
- In the device view, take a screenshot to confirm the home screen is visible. This snapshot will be used later as a reference point for debugging.
If the connection fails, check the driver, ensure the phone is not in charging only mode, and verify that the Android version matches the driver package.
Step 2: Capture Stable Element Selectors
Stable selectors survive app updates better than raw coordinates. In Phoma, open the Element Inspector (the mouse‑over icon) and tap the first element you need – typically the product name on the product list screen.
The inspector will show a JSON‑style selector. Copy the whole block; for example:
{
"resource-id": "com.shopapp:id/product_name",
"text": "Blue T‑Shirt",
"class": "android.widget.TextView"
}
Repeat this process for each key step:
- Add to Cart button (resource‑id or content‑desc)
- Cart icon (global navigation)
- Proceed to Checkout button
- Shipping address field
- Payment method selector
- Place Order button
Store all selectors in a separate document; you will reference them while building the flow.
Step 3: Build the Flow Visually
Phoma’s visual builder lets you drag‑and‑drop actions. Follow these steps in order:
- Launch the app – use the Open App action and select the package name.
- Navigate to the product list – if the app starts on a splash screen, add a Wait for Element action that looks for the product‑list header (e.g., resource‑id
com.shopapp:id/product_list). - Select a product – add a Tap action using the selector you captured for the product name. To make the flow reusable, you can parameterize the text (e.g.,
"Blue T‑Shirt") or use a Search action that filters by keyword. - Add to Cart – tap the Add to Cart button. Use the selector for the button (often a content‑desc like "Add to cart").
- Open the Cart – tap the global cart icon. This may be a persistent UI element, so use a Click with the content‑desc.
- Proceed to Checkout – locate the Proceed button and tap it.
- Enter Shipping Address – if the app requires manual entry, add a Tap on the address field, then a Type Text action. For the address, you can reuse a pre‑written string or read it from a CSV file (Phoma can import CSV values).
- Select Payment Method – tap the payment option (e.g., credit card) and fill any required fields.
- Place Order – final tap on the Place Order button.
- Verify Order Confirmation – add a Wait for Element that looks for the order‑confirmation header (resource‑id
com.shopapp:id/order_success).
Each action can be named in the flow editor, making it easy to read later. Use the Comment feature to annotate why a particular step exists.
Step 4: Add Verification and Screenshot Checkpoints
Automation is only as good as the assertions that confirm it succeeded. In Phoma, you can insert two types of checkpoints:
- Text Assertion – verify that the order total displayed matches an expected value. For example, assert that the text
"Total: $42.90"appears. - Screenshot Checkpoint – capture the screen after the Place Order step and compare it to a baseline image. This catches visual regressions such as layout shifts.
To add a text assertion, right‑click the Place Order step, choose Add Assertion, then select Text and provide the expected string. For a screenshot, choose Add Snapshot and name it order_confirmation.png.
These assertions give you immediate feedback in the Phoma run log, showing green for success or red for failure.
Step 5: Run the Flow on Multiple Devices
One of Phoma’s strongest features is the ability to execute a single flow across many phones simultaneously. To do this:
- In the Devices panel, click Add Device Pool and import a CSV file that lists the UDIDs or connection IDs of all test phones.
- Select the pool, then click Run Flow. Phoma will launch the flow on each device in parallel, collecting logs and screenshots from every device.
- After the run finishes, open the Report tab. You will see a matrix view: each row represents a device, each column a step. Failed steps are highlighted in red, allowing you to pinpoint device‑specific issues (e.g., different screen sizes).
Running on multiple devices is especially useful for smoke testing before a release, or for nightly regression suites that need to validate the checkout on low‑end and high‑end hardware.
Step 6: Stability Tips
Even with a well‑built flow, UI changes can break it. Follow these best practices to keep the flow robust:
- Use content descriptions (
content-desc) whenever possible; they are less likely to change than resource‑ids. - Add explicit waits (
Wait for Element) before interacting with a new screen. Wait for the Proceed button to become clickable rather than relying on a fixed sleep. - Handle pop‑ups – if a promotional banner appears, insert a Dismiss action (e.g., click the "No thanks" button) before proceeding.
- Use text assertions instead of solely relying on screenshots; text is less fragile across device‑specific DPI scaling.
- Parameterize values – store shipping address, coupon code, or expected total in variables. This makes the flow reusable for different test data sets.
- Version‑lock selectors – when an app updates, the inspector may generate new IDs. Capture the selector before the update, and keep a changelog of when you need to refresh it.
Conclusion
By following these six steps you can create a maintainable, visual automation flow that handles a complete Android shopping checkout from product selection to order confirmation. The approach combines stable element selectors, clear verification points, and the ability to run the same test on many devices without writing a single line of code. Once the flow is built, share it with your team through Phoma’s Team plan, allowing everyone to reuse the same checkout script and keep your Android test devices consistently validated.
