Automating Test Cases Using iOS DevicesAutomating M-Site Applications using iOS devices

Automating M-Site Applications Using iOS Devices

Automate M-Site applications on iOS devices using algoQA with Safari Web Inspector and Python Appium.

Use Case: Amazon Shopping Journey — Verifying the Cart Details

In this use case, you are shopping for a new laptop on the Amazon M-Site, making selections based on specific requirements such as brand and filtering options, adding items to your cart, and proceeding to check out for a purchase.

Prerequisite

Using algoQA, you can scrape the UI elements manually by performing the following:

  1. Enable Safari Web Inspector on iOS:

    On your iOS device, go to "Settings" > "Safari" > "Advanced."

    Toggle on the "Web Inspector" option.

  2. Connect the iOS Device to Mac:

    Connect your iOS device to your Mac using a USB cable.

  3. Open Safari on your Mac.

  4. Enable the Developer Menu:

    Go to "Safari" > "Preferences" > "Advanced."

    Enable the "Show Develop menu in menu bar" option.

  5. Inspect Elements:

    Open Safari on your iOS device and navigate to the mobile site you want to inspect.

  6. Open Safari Developer Tools on Mac:

    On your Mac, open Safari and go to the "Develop" menu.

    Select your connected iOS device and choose the tab that corresponds to the open Safari window on your iOS device.

  7. Toggle Element Selection:

    In Safari on your Mac, click the "Elements" tab to open the Developer Tools.

    Use the "Select Element" tool (arrow icon) to highlight and select the element on the mobile site.

  8. Copy XPath:

    Once the element is selected, right-click the highlighted code in the Developer Tools and choose "Copy" > "Copy XPath."

Ensure that all page names in the scraped file are the same as the UI elements' names.

Test Design the Application

Test Design is the process of creating an scenario of an application under test (AUT), which involves mimicking a UI model of an AUT using nodes, features, and UI elements.

Profiling involves:

  • Create an Offline Model - To create an offline model, see Profiling article.
  • Recording the scenarios using Offline Recorder_ -_The Record Scenario feature is used to record and save the workflow, scenario, or use case. The scenario will be saved in the same sequence in which it was recorded.

Note: Recording for the Record Scenario feature is done in an offline model. It doesn't interact with the live application.

Generate and Test Cases and Test Scripts

Test cases are generated in Gherkin language and are Behavior-Driven Development (BDD) compliant.

For more information, see Generate Test cases and Test Scripts.

Execute Scripts

Perform the following:

  1. Download the generated scripts.
  2. Executing Scripts on macOS
    1. Navigate to Test Scripts and download the script.
    2. Download the script to your local folder. Navigate to that folder, right-click, and select Services > New Terminal at Folder.
      Mac Finder Downloads folder with right-click menu showing Services, New Terminal at Folder highlighted
    3. Run the following command to trigger the script in the Terminal window.
      behave
      
      Terminal window showing the behave command entered after last login prompt
    4. In the folder structure, you can view the respective report as follows:
      macOS Finder Downloads folder showing AlgoAFScript folder structure with features and steps subfolders