Skip to content

Examples and Azure Pipeline for Windows App E2E test with Jest/Jamsine + WebDriverIO/selenium-webdriver + WinAppDriver

Notifications You must be signed in to change notification settings

react-native-windows/winappdriver-js-webdriver-example

Repository files navigation

Warnings:

Because XamlControlGalary app changed a lot, the test cases would fail. So I will not maintain the test cases on this repo anymore. If you are looking for:

  1. Jest + selenium-webdriver + WinAppDriver, please refer to selenium-appium example.
  2. Jasmine + WebDriverIO + WinAppDriver, please refer to wdio-winappdriver-example

I created a open source WinappDriver, welcome to try it: YWinAppDriver

Below are the old Readme

This repo is already merged into WinAppDriver repo

winappdriver-js-webdriver-example

There are two popular JavaScript WebDrivers which could be used for WinAppDriver testing: selenium-webdriver and webdriverio.

This is used to demo UI automation testing with WinAppDriver which the test runner is JavaScript. It includes the examples and Azure Pipeline with selenium-webdirver and WebDriverIO.

  1. Jest + selenium-webdriver + WinAppDriver
  2. Jasmine + WebDriverIO + WinAppDriver

WinAppDriver is recommended to do E2E test for Windows apps. Here I validate Xaml-Controls-Gallery application using JavaScript + WinAppDriver.

This test project highlights the following basic interactions to demonstrate how UI testing using Windows Application Driver work.

  • Azure pipeline
  • Finding element using 'accessibility id' and 'name'
  • Sending click action to an element
  • Retrieving element value
  • WinAppDriver integration with WebDriverIO and selenium-webdriver

I prototyped and successfully made the two webdrivers to be happy with WinAppDriver. And you can use any of them on your project.

Examples

I provided two examples which are using selenium-webdriver or webdriverio.

selenium-webdriver is the offical WebDriver JavaScript binding from selenium project. Unfortunately selenium-webdriver doesn't support Mobile JSON Wire Protocol Specification. selenium-appium is selenium-webdriver extension to make selenium-webdriver to drive Appium to run automation.

WinAppDriver doesn't implement w3c WebDriver completely, so currently I workaround the problem by WebDriver. In your project, you have to use private webdriver in package.json lke this:

    "webdriverio": "^5.10.1",
    "webdriver": "git+https://github.com/react-native-windows/webdriver.git",

Azure pipeline for WinAppDriver

Please refer to .ado folder in this project. For WinAppDriver, see WinAppDriver in CI with Azure Pipelines

Dependencies

  • Install nodejs, make sure a recent version of Node.js is installed. Chocolatey is the recommended installation method. But you can also install Node directly from NodeJs. To use chocolately, from an elevated Command Prompt, run:

    choco install nodejs
    
  • Install Yarn (optional if you use npm command directly)

  • Install 'xaml controls Gallery'

  • Download and Install it from Microsoft Store.
  • Or build and deploy Xaml-Controls-Gallery submodule
  • Install the most recent stable WinAppDriver on the test device

Note

To know more about how to integrate JavaScript test runner and WinAppDriver for UI automation, please refer to:

  1. Jest + selenium-webdriver + WinAppDriver
  2. Jasmine + WebDriverIO + WinAppDriver