Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
browsers/
browsers-tmp
firefox-*.tar.bz2
.DS_Store
node_modules/
Expand Down
9 changes: 7 additions & 2 deletions test/run-tests
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/bin/sh
#
# Run testling with a default set of parameters
# Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree.
#!/bin/sh

# Run testling with a default set of parameters
BINDIR=./browsers/bin
export BROWSER=${BROWSER-chrome}
export BVER=${BVER-stable}
Expand Down
2 changes: 1 addition & 1 deletion test/run-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* that can be found in the LICENSE file in the root of the source
* tree.
*/
/* jshint node: true */
/* eslint-env node */

'use strict';
var test = require('tape');
Expand Down
39 changes: 38 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* that can be found in the LICENSE file in the root of the source
* tree.
*/
/* jshint node: true */
/* eslint-env node */

'use strict';

Expand All @@ -30,3 +30,40 @@ test('Check Selenium lib buildDriver method', function(t) {
t.end();
});
});

test('Check Selenium lib getStats method', function(t) {
if (process.env.BROWSER === 'firefox') {
t.skip('getStats not supported on Firefox.');
t.end();
return;
}
var driver = require('../main.js').seleniumLib.buildDriver();
var getStats = require('../main.js').seleniumLib.getStats;

driver.get('file://' + process.cwd() + '/test/testpage.html')
.then(function() {
t.plan(3);
t.pass('Page loaded');
return driver.executeScript('window.pc1 = new RTCPeerConnection();' +
'return window.pc1;');
})
.then(function(peerConnection) {
if (typeof peerConnection.remoteDescription === 'object') {
t.pass('PeerConnection created, calling on getStats.')
return getStats(driver, 'pc1');
}
})
.then(function(response) {
for (var object in response) {
t.ok(object.toString().match('googLibjingleSession_') !== null,
'getStats response OK!');
}
t.end();
})
.then(null, function(err) {
if (err !== 'skip-test') {
t.fail(err);
}
t.end();
});
});