Included in this repository are simple example tests for the 'Hello OpenFin' app using the popular WebDriver JS Bindings, test frameworks and assertion libraries.
We have modified the latest Chrome driver to work with OpenFin Runtime.
Examples for the following WebDriver JS Bindings are included in this project:
- WebDriverJs / Selenium-WebDriver: test/WebDriverJs/Mocha
- WebDriverIO: test/WebDriverIO/Mocha
- WD: test/WD/Mocha
- Protractor: test/protractor
Since all HTML5 applications in the OpenFin environment need to be started with OpenFin API, chromeDriver.get(URL) is not supported.
ChromeDriver, by default, starts Chrome browser with various Chrome arguments, including remote debugging port, before running tests. ChromeOptions.setBinary needs to be called so ChromeDriver can start OpenFin Runtime properly. RunOpenFin.bat is an example batch file that can be set as 'binary'.
Given there can be multiple applications/windows active in OpenFin Runtime, tests must begin by selecting the targeted window. Each test script has a function that selects the window by matching it's title.
Since the OpenFin Runtime is started by OpenFinRVM, Chromedriver does not have direct control of the OpenFin Runtime. Chromedriver must be started before any test runs. Once a test is complete, it needs to shut down OpenFin Runtime by running javascript code "fin.desktop.System.exit();". driver.quit() does not shut down OpenFin Runtime since it does not have access.
In Summary
- Tests must target specific windows
- OpenFin RunTime must be shut down after a test is completed
- Install Node.js
- Download/clone this repository and
cd
into it - Install all the dependencies
npm install
- For Windows, install Hello OpenFin App
- For Mac, install OpenFin CLI
npm install -g openfin-cli
The following steps will help you run tests:
- Start chromedriver.exe. You can specify --verbose command line argument to get more loggings.
- Host test/app.json in a webserver, such as localhost:8000, and update test/config.js with the correct URL.
- Run the test for one bindings (replace [bindings] with WD, WIO or WJS)
npm run test[bindings]
The example code is written for the Super Calculator Angular demo app that is used in Quick Start of Protractor (http://angular.github.io/protractor/#/).
- Install Node.js
- Download/clone this repository and
cd
to test/protractor directory - Install all the dependencies
npm install
-
Start chromedriver.exe. You can specify --verbose command line argument to get more loggings.
-
Host protractor/app.json on a web server. The default is http://localhost:9000/app.json.
-
Run the example
npm run test
Two example scripts are included in this project to demonstrate use of Selenium Server.
- seleniumHub.bat/sh for launching Selenium Grid hub.
- seleniumNode.bat for launching Selenium Grid node.
config.js for each test needs to be modified to match IP and port of Selenium hub.
- This is a starter example and intended to demonstrate to app providers a sample of how to approach an implementation.
- This is an open source project and all are encouraged to contribute.
- As of runtime 29+, a new, single renderer process can appear if using view visibility settings in platfowm windows. This process will always have the URL
openfin://blank
and can be filtered out if desired.
MIT
The code in this repository is covered by the included license.
However, if you run this code, it may call on the OpenFin RVM or OpenFin Runtime, which are covered by OpenFin’s Developer, Community, and Enterprise licenses. You can learn more about OpenFin licensing at the links listed below or just email us at [email protected] with questions.
https://openfin.co/developer-agreement/
https://openfin.co/licensing/
Please enter an issue in the repo for any questions or problems.
Alternatively, please contact us at [email protected]