-
Notifications
You must be signed in to change notification settings - Fork 0
Webdriver tests student project
Background information: The WebDriver specification defines a communication protocol for automating interactions with a web browser that would traditionally require a human being (eg. clicking the mouse on a particular link; typing text into an input field; etc.) This protocol is being implemented by major browsers such as Firefox, Edge, and Chrome, and Servo also provides a WebDriver server. The goal of this project is both to submit a broad range of automated client tests using the Python WebDriver API that can be run against multiple browsers, and also to report on how many of the tests Servo currently passes.
There is a Python client that encapsulates many WebDriver API calls in a nice interface that resides in the Servo repository. This project will build on that, modifying it as necessary to expose more of the WebDriver API, creating new files that contain tests that rely on the Session
type from the client, as follows (cd tests/wpt/harness/wptrunner/executors; python ~/test.py
):
import webdriver
session = webdriver.Session('127.0.0.1', 7000)
session.start()
session.url = 'http://google.com'
Initial steps:
- compile Servo and ensure that it runs on
tests/html/about-mozilla.html
- email the mozilla.dev.servo mailing list introducing your group and your progress
- using the Python client, run a simple webdriver script that against Servo (
./mach run --webdriver 7000 tests/html/about-mozilla.html
to start Servo before running the script) - create a
webdriver
directory undertests
where the forthcoming tests will reside. Create amach
command (test-webdriver
) inpython/servo/testing_commands.py
that will import each python file in the directory and execute thetest
method contained within it. If any execution throws, record a test failure. Invoke the Servo process before running each test, and kill it after each test finishes. - write an automated test for loading a particular URL, asserting that the resulting page is the expected url
Subsequent steps:
- Write tests that exercise the lower-level command API (eg.
self.send_command("POST", "url", body)
) to test server capabilities:- Write a test with a simple get to a url that exists on the server, ensure that we get the right response type
- Send a non-string as the URL ensure we get the right kind of error message
- Try other kinds of non-conforming messages e.g. ones with extra fields (should be ignored) or no url field (should return the correct type of error)
- Test that we are actually loading the correct page. This will require the use of some other webdriver functions e.g. to get an element's text, or take a screenshot
- Test that Get always navigates the top level browsing context (by navigating to a page with an iframe, setting the current bc to that iframe, and ensuring that it is not just the iframe that is navigated).
- Try Get with pages that return non-200 responses.
- Loading a page that loads slower than the timeout, and ensure we get the correct error message
- Integrate all tests into the upstream cross-browser repository when it becomes possible
- ...more to come...