-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1956 from Orange-OpenSource/functional-tests
Functional tests
- Loading branch information
Showing
58 changed files
with
1,172 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
define({ | ||
local:'http://localhost/DEV/Orange-OpenSource/dash.js/test/functional/tests.html' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
define(function () { | ||
|
||
var CHROME_CONFIG = { | ||
browserName: 'chrome', | ||
platform: 'MAC' | ||
}; | ||
|
||
var FIREFOX_CONFIG = { | ||
browserName: 'firefox', | ||
platform: 'MAC' | ||
}; | ||
|
||
return { | ||
all: [CHROME_CONFIG, FIREFOX_CONFIG], | ||
|
||
chrome: [CHROME_CONFIG], | ||
|
||
firefox: [FIREFOX_CONFIG] | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
define(function () { | ||
|
||
var CHROME_CONFIG = { | ||
browserName: 'chrome', | ||
platform: 'WINDOWS', | ||
os: 'WINDOWS', | ||
os_version: '10' | ||
}; | ||
|
||
var IE11_CONFIG = { | ||
browserName: 'internet explorer', | ||
platform: 'WINDOWS' | ||
}; | ||
|
||
var EDGE_CONFIG = { | ||
browserName: 'MicrosoftEdge', | ||
platform: 'WINDOWS' | ||
}; | ||
var FIREFOX_CONFIG = { | ||
browserName: 'firefox', | ||
platform: 'WINDOWS', | ||
os: 'WINDOWS', | ||
os_version: '10' | ||
}; | ||
|
||
return { | ||
all: [CHROME_CONFIG, IE11_CONFIG, EDGE_CONFIG, FIREFOX_CONFIG], | ||
|
||
chrome: [CHROME_CONFIG], | ||
|
||
ie: [IE11_CONFIG], | ||
|
||
edge: [EDGE_CONFIG], | ||
|
||
firefox: [FIREFOX_CONFIG] | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
define(function (require) { | ||
|
||
var MAC = {}; | ||
var WINDOWS = {}; | ||
|
||
var getWindowsBrowers = function () { | ||
var browsers = require('./browsers/windows.js'); | ||
|
||
for (var key in browsers) { | ||
WINDOWS[key] = browsers[key]; | ||
} | ||
}; | ||
|
||
var getMacBrowsers = function () { | ||
var browsers = require('./browsers/mac.js'); | ||
|
||
for (var key in browsers) { | ||
MAC[key] = browsers[key]; | ||
} | ||
}; | ||
|
||
getWindowsBrowers(); | ||
getMacBrowsers(); | ||
|
||
return { | ||
mac: MAC, | ||
windows: WINDOWS | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
define({ | ||
|
||
local: { | ||
proxyUrl: 'http://127.0.0.1:3555', | ||
proxyPort: 3555, | ||
tunnel: 'NullTunnel', | ||
tunnelOptions: { | ||
hostname: '127.0.0.1', | ||
port: '4444', | ||
verbose: true | ||
}, | ||
reporters: ['Runner'], | ||
capabilities: { | ||
'selenium-version': '3.4.0' | ||
}, | ||
leaveRemoteOpen:'fail' | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"DASH_VOD_1": { | ||
"url": "http://dash.edgesuite.net/akamai/bbb_30fps/bbb_30fps.mpd", | ||
"name": "SegmentTemplate/Number, live profile, 250kbps up to 15Mbps@4K.", | ||
"type": "VOD", | ||
"protocol": "DASH" | ||
}, | ||
|
||
"DASH_VOD_2": { | ||
"url": "http://rdmedia.bbc.co.uk/dash/ondemand/testcard/1/client_manifest-events.mpd", | ||
"name": "SegmentTemplate/Number, live profile", | ||
"type": "VOD", | ||
"protocol": "DASH" | ||
}, | ||
|
||
"DASH_LIVE_1": { | ||
"url": "http://vm2.dashif.org/livesim/testpic_2s/Manifest.mpd", | ||
"name": "SegmentTemplate without manifest updates (livesim)", | ||
"type": "Live", | ||
"protocol": "DASH" | ||
}, | ||
|
||
"DASH_LIVE_2": { | ||
"url": "http://vm2.dashif.org/livesim/mup_30/testpic_2s/Manifest.mpd", | ||
"name": "SegmentTemplate with manifest updates every 30s (livesim)", | ||
"type": "Live", | ||
"protocol": "DASH" | ||
}, | ||
|
||
"MSS_VOD_1": { | ||
"url": "http://2is7server2.rd.francetelecom.com/hasplayer/VOD_1/VOD_1.ism/manifest", | ||
"name": "Prince Of Persia", | ||
"type": "VOD", | ||
"protocol": "MSS" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
define(function (require) { | ||
|
||
var fs = require('intern/dojo/node!fs'); | ||
var streams = JSON.parse(fs.readFileSync('./test/functional/config/streams.json', 'utf8')); | ||
|
||
var streamsArray = []; | ||
for (var key in streams) { | ||
streamsArray.push(streams[key]); | ||
} | ||
|
||
var _createInstance = function () { | ||
return { | ||
asyncTimeout: 10, | ||
|
||
tests: { | ||
default: { | ||
streams: streamsArray | ||
}, | ||
|
||
seek: { | ||
seekCount: 5 | ||
}, | ||
|
||
pause: { | ||
pauseCount: 2 | ||
} | ||
} | ||
}; | ||
}; | ||
|
||
var _getInstance = function () { | ||
if (!this._instance) { | ||
this._instance = _createInstance(); | ||
} | ||
return this._instance; | ||
}; | ||
|
||
return _getInstance(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
define(function () { | ||
|
||
var PLAY_TESTS = [ | ||
'test/functional/tests/play/play', | ||
]; | ||
|
||
var PAUSE_TESTS = [ | ||
'test/functional/tests/play/pause' | ||
]; | ||
|
||
var SEEK_TESTS = [ | ||
'test/functional/tests/play/seek' | ||
]; | ||
|
||
var ALL_TESTS = PLAY_TESTS.concat(PAUSE_TESTS, SEEK_TESTS); | ||
|
||
return { | ||
all: ALL_TESTS, | ||
play: PLAY_TESTS, | ||
pause: PAUSE_TESTS, | ||
seek: SEEK_TESTS | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# Functional testing | ||
|
||
This README explains how to run functional tests for dash.js project, based on Selenium and the Intern framework. | ||
The tests can be executed using BrowserStack platform, meanwhile it details how to launch the functional tests locally on your desktop, using selenium grid. | ||
|
||
## Intern | ||
Proposed functional tests are based upon Intern framework (https://theintern.github.io/). | ||
To install Intern, perform a ```npm install``` command in dash.js root folder. | ||
|
||
## Web application for tests | ||
To run the tests you have to serve a web application that is able to run the dash.js player. | ||
This web application must declare the video element and the dash.js MediaPlayer instance, respectively with the ids ```'video'``` and ```'player'```. | ||
|
||
## Tests scripts | ||
The folder ```tests``` contains the different scripts for testing each functionnality/scenario. | ||
For example the script ```test/play/play.js``` is testing the scenario for playing a stream. | ||
|
||
When writing a functional test, instead of executing application code directly, we do use the Leadfoot Command object, provided by the Intern framework, to automate interactions to test the application (see https://theintern.github.io/leadfoot/module-leadfoot_Command.html). | ||
|
||
Also in order to automate and check the tests results we do use the Chai Assertion Library (http://chaijs.com/) which is also bundled with Intern. | ||
|
||
All the tests can interact with the video element and the MediaPlayer instance provided by the tested web application with the help of functions declared in ```test/video_functions.js``` and ```test/player_functions.js``` | ||
|
||
## Selenium and tests configuration | ||
In ```config``` folder, you will multiple configurations files that are used by the ```testCommon.js``` script to run tests: | ||
- ```selenium.js``` provides the configuration for the Selenium nodes configuration. Only 'local' configuration is provided so far | ||
- ```os.js``` and ```browsers/*.js``` provides the available Selenium configurations for executing the tests on the different browsers on different platforms | ||
- ```applications.js``` provides the configuration for some web application that can be used to execute the tests | ||
- ```streams.json``` provides the streams configuration that can be used by the different tests | ||
- ```testsConfig.js``` provides some configuration parameters for each test contained in ```tests``` folder | ||
- ```testsSuites.js``` provides some suites of tests that can be run independently | ||
|
||
## Running tests on Windows | ||
#### WebDrivers | ||
In ```tools``` folder, the following web drivers are available: | ||
- Chrome | ||
- Firefox | ||
- Edge | ||
- IE11 | ||
|
||
#### Launch the tests | ||
1. Start selenium hub. Open a new terminal and launch the command: | ||
```sh | ||
cd test/functional/tools | ||
startHub.bat | ||
``` | ||
|
||
2. Start selenium node. Open a new terminal and launch the command: | ||
```sh | ||
cd test/functional/tools | ||
startClient.bat | ||
``` | ||
|
||
3. Start Intern runner. Open a new terminal and launch the command: | ||
```sh | ||
cd test/functional | ||
./runTestsWin.bat | ||
``` | ||
|
||
This last command contains a script for running tests on all browsers. | ||
The script can be modified and executed (from project root folder) in order to run the tests: | ||
- on specific browsers (see ```config/browsers/windows.js```), | ||
```sh | ||
browser=<browser_names_separated_by_comma> | ||
``` | ||
- on a specific testing web application (see ```config/applications.js```) | ||
```sh | ||
app=<app_name_from_config_file> or appurl=<app_url> | ||
``` | ||
- only for a specific suite of tests (see ```config/testsSuites.js```) | ||
```sh | ||
tests=<test_suites_names_separated_by_comma> | ||
``` | ||
|
||
For example: | ||
```sh | ||
node node_modules/intern/runner.js config=test/functional/testsCommon.js os=windows browsers=chrome|firefox appurl=http://... tests=play | ||
``` | ||
|
||
## Running tests on Mac OSX | ||
#### Chrome | ||
Download latest chrome driver (chromedriver) from https://sites.google.com/a/chromium.org/chromedriver/downloads | ||
Make sure installation path is available in PATH variable. | ||
You can follow this article : http://www.kenst.com/2015/03/installing-chromedriver-on-mac-osx/ | ||
|
||
#### Firefox | ||
Download last firefox driver (geckodriver) from https://github.com/mozilla/geckodriver/releases | ||
Make sure installation path is available in PATH variable. | ||
|
||
#### Launch the tests | ||
1. Start selenium hub. Open a new terminal and launch the command : | ||
```sh | ||
cd test/functional/tools | ||
java -jar selenium-server-standalone-3.4.0.jar -role hub | ||
``` | ||
|
||
2. Start selenium node. Open a new terminal and launch the command : | ||
```sh | ||
cd test/functional/tools | ||
java -jar selenium-server-standalone-3.4.0.jar -role node | ||
``` | ||
3. Start Intern runner. Open a new terminal and launch the command: | ||
```sh | ||
cd test/functional | ||
./runTestsMac.sh | ||
``` | ||
|
||
As for Windows, the script can be modified to setup the tests. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cd ../.. | ||
|
||
node node_modules/intern/runner.js config=test/functional/testsCommon.js os=mac browsers=all app=local | ||
|
||
cd test/functional |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cd ../.. | ||
|
||
node node_modules/intern/runner.js config=test/functional/testsCommon.js os=windows browsers=all app=local | ||
|
||
cd test/functional |
Oops, something went wrong.