Skip to content

Commit

Permalink
Fix removeEventListener error which caused FF to stop, moved back REA…
Browse files Browse the repository at this point in the history
…DME.md to test
  • Loading branch information
KaptenJansson committed Aug 4, 2015
1 parent 0235cec commit 3507f9c
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 74 deletions.
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@ env:
- BROWSER=chrome BVER=stable
- BROWSER=chrome BVER=beta
- BROWSER=chrome BVER=unstable
# TODO: Enable more browsers when it runs successfully.
# - BROWSER=firefox BVER=stable
# - BROWSER=firefox BVER=beta
# - BROWSER=firefox BVER=unstable
# - BROWSER=firefox BVER=esr
- BROWSER=firefox BVER=stable
- BROWSER=firefox BVER=beta

matrix:
fast_finish: true

allow_failures:
- env: BROWSER=chrome BVER=unstable
# - env: BROWSER=firefox BVER=unstable

before_script:
- npm install
Expand Down
65 changes: 0 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,68 +86,3 @@ python dev_appserver.py app.yml
```bash
python dev_appserver.py out/app.yml
```

### Testing ###
Selenium WebDriver, Node, Testling and travis-multirunner are used as the testing framework. Selenium WebDriver drives the browser; Node and Testling manage the tests, while travis-multirunner downloads and installs the browsers to be tested on, i.e. creates the testing matrix.

This guide assumes you are running a Debian based Linux distribution (travis-multirunner currently fetches .deb browser packages).

#### Run tests ####
Runs grunt and tests in test/tests.js.
```bash
npm test
```

#### Run individual tests ####
Runs only the specified test using the specified browser.
```bash
BROWSER=chrome node test/sanity-test.js
```

#### Choose browser and release channel ####
Runs the specified test using the specified browser and release channel.
```bash
BROWSER=chrome BVER=beta npm test
```

#### Add tests ####
test/tests.js is used as an index for the tests, tests should be added here using `require()`.
The tests themselves should be placed in the same js folder as main.js: e.g.test/sanity-test.js`.

The tests should be written using Testling for test validation (using Tape script language) and Selenium WebDriver is used to control and drive the test in the browser.

Use the existing tests as guide on how to write tests and also look at the [Testling guide](https://ci.testling.com/guide/tape) and [Selenium WebDriver](http://www.seleniumhq.org/docs/03_webdriver.jsp) (make sure to select javascript as language preference.) for more information.

Global Selenium WebDriver settings can be found in `test/selenium-lib.js`, if your test require some specific settings not covered in selenium-lib.js, add your own to the test and do not import the selenium-lib.js file into the test, only do this if it's REALLY necessary.

Once your test is ready, create a pull request and see how it runs on travis-multirunner.

#### Change browser and channel/version for testing ####
Chrome stable is currently installed as the default browser for the tests.

Currently Chrome and Firefox are supported[*](#-experimental-browser-support), check [travis-multirunner](https://github.com/DamonOehlman/travis-multirunner/blob/master/) repo for updates around this.
Firefox channels supported are stable, beta and nightly.
Chrome channels supported on Linux are stable, beta and unstable.

To select a different browser and/or channel version, change environment variables BROWSER and BVER, then you can rerun the tests with the new browser.
```bash
export BROWSER=firefox BVER=nightly
```

Alternatively you can also do it without changing environment variables.
```bash
BROWSER=firefox BVER=nightly npm test
```

###* Experimental browser support###
You can run the tests in any currently installed browser locally that is supported by Selenium WebDriver but you have to bypass travis-multirunner. Also it only makes sense to use a WebRTC supported browser.
* Remove the `.setBinary()` and `.setChromeBinaryPath()` methods in `test/selenium-lib.js` (these currently point to travis-multirunner scripts that only run on Debian based Linux distributions) or change them to point to a location of your choice.
* Then add the Selenium driver of the browser you want to use to `test/selenium-lib.js`, check Selenium WebDriver [supported browsers](http://www.seleniumhq.org/about/platforms.jsp#browsers) page for more details.
* Then just do the following (replace "opera" with your browser of choice) in order to run all tests
```bash
BROWSER=opera npm test
```
* If you want to run a specific test do the following
```bash
BROWSER=opera node test/sanity-test.js
```
2 changes: 1 addition & 1 deletion src/js/camresolutionstest.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ function VideoFrameChecker(videoElement) {

VideoFrameChecker.prototype = {
stop: function() {
this.videoElement_.removeEventListener(this.listener_);
this.videoElement_.removeEventListener('play' , this.listener_);
},

getCurrentImageData_: function() {
Expand Down
84 changes: 84 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
[![Build Status](https://travis-ci.org/webrtc/testrtc.svg)](https://travis-ci.org/webrtc/testrtc)

# Intro #
Selenium WebDriver, Node, Testling and travis-multirunner are used as the testing framework. Selenium WebDriver drives the browser; Node and Testling manage the tests, while travis-multirunner downloads and installs the browsers to be tested on, i.e. creates the testing matrix.

## Development ##
Detailed information on developing in the [webrtc](https://github.com/webrtc) GitHub repo can be found in the [WebRTC GitHub repo developer's guide](https://docs.google.com/document/d/1tn1t6LW2ffzGuYTK3366w1fhTkkzsSvHsBnOHoDfRzY/edit?pli=1#heading=h.e3366rrgmkdk).

This guide assumes you are running a Debian based Linux distribution (travis-multirunner currently fetches .deb browser packages).

#### Clone the repo in desired folder
```bash
git clone https://github.com/webrtc/testrtc.git
```

#### Install npm dependencies
```bash
npm install
```

#### Install bower dependencies
```bash
bower install
```

#### Run tests
Runs grunt and tests in test/tests.js.
```bash
npm test
```

#### Run individual tests
Runs only the specified test using the specified browser.
```bash
BROWSER=chrome node test/sanity-test.js
```

#### Choose browser and release channel
Runs the specified test using the specified browser and release channel.
```bash
BROWSER=chrome BVER=beta npm test
```

#### Add tests
test/tests.js is used as an index for the tests, tests should be added here using `require()`.
The tests themselves should be placed in the same js folder as main.js: e.g.test/sanity-test.js`.

The tests should be written using Testling for test validation (using Tape script language) and Selenium WebDriver is used to control and drive the test in the browser.

Use the existing tests as guide on how to write tests and also look at the [Testling guide](https://ci.testling.com/guide/tape) and [Selenium WebDriver](http://www.seleniumhq.org/docs/03_webdriver.jsp) (make sure to select javascript as language preference.) for more information.

Global Selenium WebDriver settings can be found in `test/selenium-lib.js`, if your test require some specific settings not covered in selenium-lib.js, add your own to the test and do not import the selenium-lib.js file into the test, only do this if it's REALLY necessary.

Once your test is ready, create a pull request and see how it runs on travis-multirunner.

#### Change browser and channel/version for testing
Chrome stable is currently installed as the default browser for the tests.

Currently Chrome and Firefox are supported[*](#-experimental-browser-support), check [travis-multirunner](https://github.com/DamonOehlman/travis-multirunner/blob/master/) repo for updates around this.
Firefox channels supported are stable, beta and nightly.
Chrome channels supported on Linux are stable, beta and unstable.

To select a different browser and/or channel version, change environment variables BROWSER and BVER, then you can rerun the tests with the new browser.
```bash
export BROWSER=firefox BVER=nightly
```

Alternatively you can also do it without changing environment variables.
```bash
BROWSER=firefox BVER=nightly npm test
```

###* Experimental browser support###
You can run the tests in any currently installed browser locally that is supported by Selenium WebDriver but you have to bypass travis-multirunner. Also it only makes sense to use a WebRTC supported browser.
* Remove the `.setBinary()` and `.setChromeBinaryPath()` methods in `test/selenium-lib.js` (these currently point to travis-multirunner scripts that only run on Debian based Linux distributions) or change them to point to a location of your choice.
* Then add the Selenium driver of the browser you want to use to `test/selenium-lib.js`, check Selenium WebDriver [supported browsers](http://www.seleniumhq.org/about/platforms.jsp#browsers) page for more details.
* Then just do the following (replace "opera" with your browser of choice) in order to run all tests
```bash
BROWSER=opera npm test
```
* If you want to run a specific test do the following
```bash
BROWSER=opera node test/sanity-test.js
```
2 changes: 1 addition & 1 deletion test/sanity-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ test('Run TestRTC', function(t) {
})
// TODO: Dump console.log contents to stderr.
.then(function() {
t.pass('startButton is active.');
t.pass('startButton is active. Test execution completed.');
t.end();
})
.then(null, function(err) {
Expand Down
2 changes: 1 addition & 1 deletion test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var test = require('tape');

// Add all test files here with a short comment.

// Tests basic functionality of the the gum demo.
// Checks that the tests can start and that execution finishes.
require('./sanity-test');

// This is run as a test so it is executed after all tests
Expand Down

0 comments on commit 3507f9c

Please sign in to comment.