Skip to content

Commit 958a875

Browse files
Merge pull request #366 from fippo/geckodriver
re-enable firefox tests with geckodriver
2 parents 951ec66 + 8f7fda4 commit 958a875

File tree

4 files changed

+26
-42
lines changed

4 files changed

+26
-42
lines changed

.travis.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,14 @@ env:
1212
- BROWSER=firefox BVER=beta
1313
- BROWSER=firefox BVER=nightly
1414
- BROWSER=firefox BVER=esr
15-
- BROWSER=MicrosoftEdge BVER=stable
1615

1716
matrix:
1817
fast_finish: true
1918

2019
allow_failures:
2120
- env: BROWSER=chrome BVER=unstable
22-
- env: BROWSER=firefox BVER=stable
23-
- env: BROWSER=firefox BVER=beta
2421
- env: BROWSER=firefox BVER=nightly
25-
- env: BROWSER=MicrosoftEdge BVER=stable
22+
- env: BROWSER=firefox BVER=esr
2623

2724
before_script:
2825
- ./node_modules/travis-multirunner/setup.sh

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@
2828
"chromedriver": "^2.16.0",
2929
"eslint-config-webrtc": "^1.0.0",
3030
"faucet": "0.0.1",
31+
"geckodriver": "^1.1.3",
3132
"grunt": "^0.4.5",
3233
"grunt-browserify": "^4.0.1",
3334
"grunt-cli": ">=0.1.9",
3435
"grunt-contrib-clean": "^1.0.0",
3536
"grunt-contrib-copy": "^1.0.0",
3637
"grunt-eslint": "^17.2.0",
3738
"grunt-githooks": "^0.3.1",
38-
"selenium-webdriver": "^2.52.0",
39+
"selenium-webdriver": "^3.0.0-beta-3",
3940
"tape": "^4.0.0",
4041
"travis-multirunner": "^3.0.1"
4142
}

test/selenium-lib.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function buildDriver() {
7979
}
8080

8181
// Only enable this for Chrome >= 49.
82-
if (process.env.BROWSER === 'chrome' && getBrowserVersion >= '49') {
82+
if (process.env.BROWSER === 'chrome' && getBrowserVersion >= 49) {
8383
chromeOptions.addArguments('--enable-experimental-web-platform-features');
8484
}
8585

@@ -98,6 +98,8 @@ function buildDriver() {
9898
throw new Error('MicrosoftEdge is only supported on Windows or via ' +
9999
'a selenium server');
100100
}
101+
} else if (process.env.BROWSER === 'firefox' && getBrowserVersion >= 47) {
102+
sharedDriver.getCapabilities().set('marionette', true);
101103
}
102104

103105
sharedDriver = sharedDriver.build();

test/test.js

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ test('Attach mediaStream directly', function(t) {
612612
// Run test.
613613
seleniumHelpers.loadTestPage(driver)
614614
.then(function() {
615-
t.plan(6);
615+
t.plan(4);
616616
t.pass('Page loaded');
617617
return driver.executeAsyncScript(testDefinition);
618618
})
@@ -635,20 +635,14 @@ test('Attach mediaStream directly', function(t) {
635635
return driver.wait(webdriver.until.elementLocated(
636636
webdriver.By.id('video')), 3000);
637637
})
638-
.then(function(videoElement) {
639-
t.pass('Stream attached directly succesfully to a video element');
640-
videoElement.getAttribute('videoWidth')
641-
.then(function(width) {
642-
videoElement.getAttribute('videoHeight')
643-
.then(function(height) {
644-
// Chrome sets the stream dimensions to 2x2 if something is wrong
645-
// with the stream/frames from the camera.
646-
t.ok(width > 2, 'Video width is: ' + width);
647-
t.ok(height > 2, 'Video height is: ' + height);
648-
});
649-
});
638+
.then(function() {
639+
return driver.wait(function() {
640+
return driver.executeScript(
641+
'return document.getElementById("video").readyState === 4');
642+
}, 3000);
650643
})
651644
.then(function() {
645+
t.pass('Stream attached directly succesfully to a video element');
652646
t.end();
653647
})
654648
.then(null, function(err) {
@@ -700,7 +694,7 @@ test('Re-attaching mediaStream directly', function(t) {
700694
// Run test.
701695
seleniumHelpers.loadTestPage(driver)
702696
.then(function() {
703-
t.plan(9);
697+
t.plan(5);
704698
t.pass('Page loaded');
705699
return driver.executeAsyncScript(testDefinition);
706700
})
@@ -726,36 +720,26 @@ test('Re-attaching mediaStream directly', function(t) {
726720
webdriver.By.id('video')), 3000);
727721
})
728722
.then(function(videoElement) {
723+
return driver.wait(function() {
724+
return driver.executeScript(
725+
'return document.querySelector("video").readyState === 4');
726+
}, 3000);
727+
})
728+
.then(function() {
729729
t.pass('Stream attached directly succesfully to a video element');
730-
videoElement.getAttribute('videoWidth')
731-
.then(function(width) {
732-
videoElement.getAttribute('videoHeight')
733-
.then(function(height) {
734-
// Chrome sets the stream dimensions to 2x2 if something is wrong
735-
// with the stream/frames from the camera.
736-
t.ok(width > 2, 'Video width is: ' + width);
737-
t.ok(height > 2, 'Video height is: ' + height);
738-
});
739-
});
740730
// Wait until loadedmetadata event has fired and appended video element.
741731
// 5 second timeout in case the event does not fire for some reason.
742732
return driver.wait(webdriver.until.elementLocated(
743733
webdriver.By.id('video2')), 3000);
744734
})
745-
.then(function(videoElement2) {
746-
t.pass('Stream re-attached directly succesfully to a video element');
747-
videoElement2.getAttribute('videoWidth')
748-
.then(function(width) {
749-
videoElement2.getAttribute('videoHeight')
750-
.then(function(height) {
751-
// Chrome sets the stream dimensions to 2x2 if something is wrong
752-
// with the stream/frames from the camera.
753-
t.ok(width > 2, 'Video 2 width is: ' + width);
754-
t.ok(height > 2, 'Video 2 height is: ' + height);
755-
});
756-
});
735+
.then(function() {
736+
return driver.wait(function() {
737+
return driver.executeScript(
738+
'return document.getElementById("video2").readyState === 4');
739+
}, 3000);
757740
})
758741
.then(function() {
742+
t.pass('Stream re-attached directly succesfully to a video element');
759743
t.end();
760744
})
761745
.then(null, function(err) {

0 commit comments

Comments
 (0)