Awesome
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:
- Jest + selenium-webdriver + WinAppDriver, please refer to selenium-appium example.
- 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.
- Jest + selenium-webdriver + WinAppDriver
- 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 example in packages/selenium-webdriver
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.
- webdriverio example in packages/webdriverio
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:
-
E2E test on React Native for Windows. MoreAboutE2ETest.md provides some background why React Native Windows choose WinAppDriver and node test runner for E2E testing.
-
winappdriver-js-webdriver-example, Which includes:
- Jest + selenium-webdriver + WinAppDriver
- Jasmine + WebDriverIO + WinAppDriver
-
selenium-webdriver-winappdriver-example. An example of jest, selenium-webdriver and winappdriver integration
-
selenium-appium. selenium-appium is selenium-webdriver extension to make selenium-webdriver to drive Appium to run automation for native, hybrid and mobile web and desktop apps.
-
Choose the right E2E automation framework for React Native Windows
-
How to: Use Jest + selenium-webdriver + WinAppDriver to do Windows UI testing
-
Automated Windows UI testing by Jest + selenium-appium + selenium-webdriver + WinAppDriver
-
Inspecting UI Elements for WinAppDriver automation using Appium Desktop