This script is to run any version of Khronos WebGL conformance test on various OSes (like Android, ChromeOS, Linux, MacOS and Windows) with various browsers (like Chrome, Edge, FireFox, Safari, etc.). Results will be compared with expectations and a final report will be generated.
WebDriver backs the main logic of test automation in this script.
Target OS means the OS you run test on, while host OS is the place you run this script. They are same most of time, while Android is the only known exception now.
[1] means the configuration has been tested.
Assuming your current directory is the one with conformance.py
.
Install Python
Both Python 2 and 3 are supported, available from https://www.python.org/downloads/.
OPTIONAL - Install a virtual environment
Seeing as you‘ll be installing packages, it might be best to use a virtual python environment. If you’re not familiar with this, the flow is something like this (on UNIX):
# If you're using python3 shell> python3 -m pip install --user virtualenv shell> python3 -m venv env # If you're using python2 shell> pip install virtualenv shell> virtualenv env # Now activate the environment shell> source env/bin/activate # To exit the environment shell> deactivate
Install the Selenium package
Selenium is a tool for automating browsers. There is a python API, which talks to WebDriver.
shell> pip install selenium
Note on Windows, pip resides in <python_dir>/Scripts
.
Android Only - Download and install the platform tools
If you're going to run this tool for Android, download the relevant package for your host platform, and install into your PATH
.
Download a Web Driver binary if necessary
With the exception of Safari, which comes with the system, you'll probably need the tool that can control the browser via Web Driver.
This tool will look for the driver in ./webdriver/<os_name>
by default, where os_name
is “android”, “linux”, “win” or “mac”. You can also designate a path to a webdriver executable with --webdriver-path
.
Webdrivers are available at:
/usr/bin/safaridriver
Execute script
shell> python conformance.py [options]
Pass --help
for more information. You'll need to provide --browser-name
at least.
For example, to run a local version of the 1.0.4 test suite against Safari, use:
# Start a server pointing to the tests. shell1> ./serve_localhost.py --directory sdk/tests # Run the tests. shell2> python3 conformance.py --browser-name safari --url http://localhost:8000/webgl-conformance-tests.html --version 1.0.4
Check report
Test results will be placed in <work_dir>/result/<timestamp>.html
where timestamp
is when the test run happened (%Y%m%d%H%M%S
, e.g., 20170403235901)
First, a test image is required as the script relies on telemetry. Then you just need to copy the script to your ChromeOS and execute it as others, including Python, webdriver binary, etc., just work out of the box.