Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

update selenium-lib.js from samples/ repo #115

Merged
merged 1 commit into from
Aug 19, 2015
Merged
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
21 changes: 20 additions & 1 deletion test/selenium-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ function buildDriver() {
profile.setPreference('media.navigator.streams.fake', true);
// This enables device labels for enumerateDevices when using fake devices.
profile.setPreference('media.navigator.permission.disabled', true);
// Currently the FF webdriver extension is not signed and FF 41 no longer
// allows unsigned extensions by default.
// TODO: Remove this once FF no longer allow turning this off and the
// selenium team starts making a signed FF webdriver extension.
// https://github.com/SeleniumHQ/selenium/issues/901.
profile.setPreference('xpinstall.signatures.required', false);

var firefoxOptions = new firefox.Options()
.setProfile(profile)
.setBinary('node_modules/.bin/start-firefox');
Expand All @@ -46,6 +53,18 @@ function buildDriver() {
return sharedDriver;
}

// A helper function to query stats from a PeerConnection.
function getStats(driver, peerConnection) {
// Execute getStats on peerconnection named `peerConnection`.
driver.manage().timeouts().setScriptTimeout(1000);
return driver.executeAsyncScript(
'var callback = arguments[arguments.length - 1];' +
peerConnection + '.getStats(null).then(function(report) {' +
' callback(report);' +
'});');
}

module.exports = {
buildDriver: buildDriver
buildDriver: buildDriver,
getStats: getStats
};