diff --git a/.gitignore b/.gitignore index 9efb852..ebd5ca0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ browsers/ +browsers-tmp firefox-*.tar.bz2 .DS_Store node_modules/ diff --git a/test/run-tests b/test/run-tests index ebfce09..acf5ec2 100755 --- a/test/run-tests +++ b/test/run-tests @@ -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} diff --git a/test/run-tests.js b/test/run-tests.js index 3224b86..470c306 100644 --- a/test/run-tests.js +++ b/test/run-tests.js @@ -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'); diff --git a/test/test.js b/test/test.js index bc1b0c6..1aa6ec4 100644 --- a/test/test.js +++ b/test/test.js @@ -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'; @@ -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(); + }); +});