Write automated tests for the WebDriver server

edit

ServoServo is an open source prototype web browser layout engine being developed by Mozilla, and it is written in Rust language. It is currently developed on 64bit OS X, 64bit Linux, Android, and Gonk (Firefox OS). The main idea is to create a highly parallel environment, in which different components can be handled by fine grained, isolated tasks. The different components can be rendering, HTML parsing, etc.

Background information:

edit

Python:

edit

Python is a widely used high-level, general-purpose, interpreted, dynamic programming language. Python supports multiple programming paradigms, including object oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive standard library. Modules for creating graphical user interfaces, connecting to relational databases, pseudorandom number generators, arithmetic with arbitrary precision decimals,[77] manipulating regular expressions, and doing unit testing are also included.

WebDriver:

edit

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.

Scope

edit
  • Compile Servo and ensure that it runs on tests/html/about-mozilla.html
  • To run a simple webdriver script using the python client against Servo.
  • Create amach command (test-webdriver) in python/servo/testing_commands.py that will import each python file in the directory and execute the test method contained within it by invoking the Servo process before running each test, and killing it after each test finishes.
  • Create a webdriver directory under tests where the forthcoming tests will reside.
  • Write an automated test for loading a particular URL, asserting that the resulting page is the expected url.

Design pattern

edit

Design patterns are not applicable as our task involved writing automated tests in python. However, the Implementation section below provides details of the steps the way it was implemented.

Implementation

edit

The following steps were followed to meet the project requirements as per this github page.

Step 1:

edit

We created a new mach command (test-webdriver) in python/servo/testing_commands.py file. It imports each python file in the directory and executes the test method contained within it.

 
test_webdriver command
 
running tests
 
adding test-webdriver mach command


Step 2:

edit

We created tests in test.py and test1.py for loading a particular URL, asserting that the resulting page is the expected url.

Testing

edit

Following are the steps to run the automated tests for WebDriver:

git clone https://github.com/krunal3103/servo 

Note: Follow the steps listed in the Readme.md file of this link to clone and build servo on your local machine.

cd servo 
./mach test-webdriver 

You will see that all tests pass as expected.

Pull Request

edit

Here is our pull request. In the link you can see all code snippets and commits as well as integration test progression information.