[{"data":1,"prerenderedAt":19},["ShallowReactive",2],{"blog-post-en-automate-multi-step-checkout-android":3},{"slug":4,"lang":5,"title":6,"summary":7,"date":8,"tags":9,"tag_slugs":14,"thumbnail_url":15,"translations":16,"body":17,"asset_base":18},"automate-multi-step-checkout-android","en","Automate Multi Step Checkout Flow in Android Shopping Apps","Learn how to build a reusable Phoma flow that automates a multi‑step checkout in any Android shopping app, using stable selectors and visual steps.","2026-12-05",[10,11,12,13],"phoma","android","checkout","automation",[10,11,12,13],"https://blog-api.phomaapp.com/api/blog/posts/automate-multi-step-checkout-android/thumbnail.svg?lang=en",[5],"## Why Automate Checkout Flows\n\nAutomating 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.\n\n## Prerequisites\n\n- **Phoma installed** on a Windows desktop. The application runs locally, so no cloud subscription is required.\n- **Android device** with USB debugging enabled, or Wi‑Fi ADB debugging configured. Verify the connection with `adb devices`; the device should appear as *device*.\n- **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.\n- **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.\n\n## Step 1: Connect Device and Verify\n\n1. Plug the phone into the PC via USB, enable *Developer options* → *USB debugging*, and confirm the prompt on the device.\n2. Open a command prompt and run `adb devices`. You should see a line like `0123456789ABCDEF\tdevice`.\n3. 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**.\n4. 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.\n\nIf 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.\n\n## Step 2: Capture Stable Element Selectors\n\nStable 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.\n\nThe inspector will show a JSON‑style selector. Copy the whole block; for example:\n\n```json\n{\n  \"resource-id\": \"com.shopapp:id/product_name\",\n  \"text\": \"Blue T‑Shirt\",\n  \"class\": \"android.widget.TextView\"\n}\n```\n\nRepeat this process for each key step:\n- **Add to Cart** button (resource‑id or content‑desc)\n- **Cart icon** (global navigation)\n- **Proceed to Checkout** button\n- **Shipping address field**\n- **Payment method selector**\n- **Place Order** button\n\nStore all selectors in a separate document; you will reference them while building the flow.\n\n## Step 3: Build the Flow Visually\n\nPhoma’s visual builder lets you drag‑and‑drop actions. Follow these steps in order:\n\n1. **Launch the app** – use the *Open App* action and select the package name.\n2. **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`).\n3. **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.\n4. **Add to Cart** – tap the *Add to Cart* button. Use the selector for the button (often a content‑desc like \"Add to cart\").\n5. **Open the Cart** – tap the global cart icon. This may be a persistent UI element, so use a *Click* with the content‑desc.\n6. **Proceed to Checkout** – locate the *Proceed* button and tap it.\n7. **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).\n8. **Select Payment Method** – tap the payment option (e.g., credit card) and fill any required fields.\n9. **Place Order** – final tap on the *Place Order* button.\n10. **Verify Order Confirmation** – add a *Wait for Element* that looks for the order‑confirmation header (resource‑id `com.shopapp:id/order_success`).\n\nEach 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.\n\n## Step 4: Add Verification and Screenshot Checkpoints\n\nAutomation is only as good as the assertions that confirm it succeeded. In Phoma, you can insert two types of checkpoints:\n\n- **Text Assertion** – verify that the order total displayed matches an expected value. For example, assert that the text `\"Total: $42.90\"` appears.\n- **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.\n\nTo 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*.\n\nThese assertions give you immediate feedback in the Phoma run log, showing green for success or red for failure.\n\n## Step 5: Run the Flow on Multiple Devices\n\nOne of Phoma’s strongest features is the ability to execute a single flow across many phones simultaneously. To do this:\n\n1. In the **Devices** panel, click **Add Device Pool** and import a CSV file that lists the UDIDs or connection IDs of all test phones.\n2. Select the pool, then click **Run Flow**. Phoma will launch the flow on each device in parallel, collecting logs and screenshots from every device.\n3. 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).\n\nRunning 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.\n\n## Step 6: Stability Tips\n\nEven with a well‑built flow, UI changes can break it. Follow these best practices to keep the flow robust:\n\n- **Use content descriptions** (`content-desc`) whenever possible; they are less likely to change than resource‑ids.\n- **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.\n- **Handle pop‑ups** – if a promotional banner appears, insert a *Dismiss* action (e.g., click the \"No thanks\" button) before proceeding.\n- **Use text assertions** instead of solely relying on screenshots; text is less fragile across device‑specific DPI scaling.\n- **Parameterize values** – store shipping address, coupon code, or expected total in variables. This makes the flow reusable for different test data sets.\n- **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.\n\n## Conclusion\n\nBy 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.\n","https://blog-api.phomaapp.com/api/blog/posts/automate-multi-step-checkout-android/assets",1796464663259]