Running a Web UI test by using industry-standard mobile browsers

You can use industry-standard mobile browsers, such as Chrome and Safari, to run Web UI tests for mobile web applications. You can run tests with Chrome on Android devices and emulators and with Safari on iOS devices and simulators.

Here are some of the test execution scenarios that are available to you with this feature:
  • You can run Web UI tests on the browsers of the connected mobile devices, emulators, or simulators. The mobile devices can be connected either to a local computer or to a remote computer.
  • You can run a Web UI test in parallel on multiple devices.
  • You can run a Web UI test on the mobile device clouds.
  • You can run AFT suites on the connected mobile devices through the command line.

Running a Web UI test on the mobile devices connected to a local or remote computer

You can run a test on a local computer or on a remote computer by providing details in the Windows > Preferences > Test > Test Execution > UI Test Playback > Mobile Devices tab.

Android

For an Android device, the following details must be entered to enable Chrome for selection in the Mobile Devices tab:
  • Host - The IP address of the local computer or IP address of the remote computer on which the UI Test Agent is running.
  • Android Device - Name of the Android device or emulator. The device name shown by adb for a real device or the configured name in avd manager for an emulator.
    Note: When you run the UI Test Agent on the remote computer, you can connect to only one Android device or emulator that is running on the remote machine.

iOS

For an iOS device, the following details must be entered to enable Safari for selection in the Mobile Devices tab:
  • Host - The IP address of the local computer or IP address of the remote computer on which the UI Test Agent is running.
  • iOS Device - The UDID for the real device or the name of the iOS simulator
  • Platform Version - The iOS version of the device
  • Apple Team ID - The Apple Team ID of the user
  • Role - The role in the Apple Developer License for the specific registered user
Also, you must have completed the following tasks before you run tests on an iOS device:
  • Installed the Xcode and the CLI tools for Xcode on the computer that you want to use for testing.
  • Connected and started the iOS device that you want to use for testing. You can connect the iOS device to the computer through a USB cable.
  • Codesigned the WebDriverAgent Xcode project WebDriverAgent.xcodeproj for WebDriverAgentLib and WebDriverAgentRunner by using a valid Apple developer account.
    Note: You must navigate to the <installation directory>/node-js/appium-server/node_modules/appium/node_modules/appium-webdriveragent folder to locate WebDriverAgent.xcodeproj, and then follow the steps as described in the Setting up iOS Real Devices Tests with XCUITest portal.
  • Enabled the Developer Mode on the iOS device.
  • Added the iOS real devices to the same developer profile.
  • Enabled remote automation by clicking the Develop > Allow Remote Automation in the Safari browser.
After you complete the above configurations, you can see the available devices, emulators, and simulators listed in the Run Configuration wizard when you run a test.Run Config wizardYou can select any of the listed devices to run the test. See Running a Web UI test.

you can also choose to run the test on multiple devices in parallel by selecting Run on several devices and browsers in parallel in the Run Configuration wizard. See Running a single Web UI test on multiple browsers and devices simultaneously.

Running a Web UI test on the mobile device clouds

You can check the connection between the application and mobile device cloud before executing your tests in the mobile cloud by providing the mobile cloud credentials in the Windows > Preferences > Test > Test Execution > UI Test Playback > Mobile Devices tab. The credentials are validated and a message is displayed about the connection validity. The following options are available:

Running AFT suites on the mobile devices through the command line

You can specify the browser and device details in an XML file to do Accelerated Functional Testing through the command line as described in Running a Web UI test or compound test from the command line on multiple browsers.

Here is a sample XML file for use with Safari and iOS:
<?xml version="1.0" encoding="UTF-8"?>
<inits name="smokesuite"> 
<group>
<tests> 
<test path="/WebUIProj/Tests/amazonpixel.testsuite"/>
    </tests>
        <browsers>
              <browser name="safari" id="Simulator:iPhone X"/>

              <browser name="safari" id="iOS:DeviceIdSNo"/>

       </browsers>
    <locations>
            <location host="123.0.0.1" />
   </locations>
  </group>
</inits>
                    
Here is a sample XML file for Chrome on Android devices and emulators:
<?xml version="1.0" encoding="UTF-8"?>
<inits name="smokesuite"> 
<group>
<tests> 
<test path="/WebUIProj/Tests/amazonpixel.testsuite"/>
    </tests>
        <browsers>
              <browser name="chrome" id="Emulator:Pixel_XL_API_28"/>

              <browser name="chrome" id="Android:DeviceName"/>

       </browsers>
    <locations>
            <location host="123.0.0.1" />
   </locations>
  </group>
</inits>