Skip to content

Commit 9d42e63

Browse files
author
Matt Gaunt
committed
Fixing up selenium tests for Chrome and Firefox. Just need to fix firefox notification stuff
1 parent d244f9f commit 9d42e63

File tree

8 files changed

+204
-636
lines changed

8 files changed

+204
-636
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
coverage
22
node_modules
3-
test_tools
4-
3+
wires
4+
test/output/

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
"description": "Web Push library for Node.js",
55
"main": "index.js",
66
"scripts": {
7+
"download-browser": "node ./test/helpers/download-test-browsers.js",
78
"lint": "./node_modules/.bin/eslint index.js test/",
8-
"pretest": "npm run lint",
9+
"pretest": "npm run lint && npm run download-browser",
910
"test": "node --harmony node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- --ui tdd test/test*"
1011
},
1112
"repository": {
@@ -38,13 +39,18 @@
3839
"urlsafe-base64": "^1.0.0"
3940
},
4041
"devDependencies": {
42+
"chalk": "^1.1.3",
43+
"chromedriver": "^2.21.2",
44+
"del": "^2.2.1",
4145
"dmg": "^0.1.0",
4246
"eslint": "^2.3.0",
4347
"fs-extra": "^0.28.0",
4448
"istanbul": "^0.4.2",
49+
"mkdirp": "^0.5.1",
4550
"mocha": "^2.4.5",
4651
"portfinder": "^1.0.2",
4752
"request": "^2.69.0",
53+
"selenium-assistant": "0.1.5",
4854
"selenium-webdriver": "~2.53.2",
4955
"semver": "^5.1.0",
5056
"temp": "^0.8.3",

test/browser-managers/chrome-browsers.js

Lines changed: 0 additions & 105 deletions
This file was deleted.

test/browser-managers/firefox-browsers.js

Lines changed: 0 additions & 97 deletions
This file was deleted.

test/data/demo/index.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,7 @@
2727
})
2828
.then(function(subscription) {
2929
window.subscribeSuccess = true;
30-
var key = subscription.getKey ? subscription.getKey('p256dh') : '';
31-
var auth = subscription.getKey ? subscription.getKey('auth') : '';
32-
window.testSubscription = {
33-
endpoint: subscription.endpoint,
34-
key: key ? btoa(String.fromCharCode.apply(null, new Uint8Array(key))) : '',
35-
auth: auth ? btoa(String.fromCharCode.apply(null, new Uint8Array(auth))) : '',
36-
};
30+
window.testSubscription = JSON.stringify(subscription);
3731
})
3832
.catch(function(err) {
3933
window.subscribeSuccess = false;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
(function() {
2+
var invalidNodeVersions = /0.(10|12).(\d+)/;
3+
if (process.versions.node.match(invalidNodeVersions)) {
4+
console.log('Skipping downloading browsers as selenium tests can\'t run on ' + process.versions.node);
5+
return;
6+
}
7+
8+
const seleniumAssistant = require('selenium-assistant');
9+
10+
const promises = [
11+
seleniumAssistant.downloadFirefoxDriver(),
12+
seleniumAssistant.downloadBrowser('firefox', 'stable'),
13+
seleniumAssistant.downloadBrowser('firefox', 'beta'),
14+
seleniumAssistant.downloadBrowser('firefox', 'unstable'),
15+
seleniumAssistant.downloadBrowser('chrome', 'stable'),
16+
seleniumAssistant.downloadBrowser('chrome', 'beta'),
17+
seleniumAssistant.downloadBrowser('chrome', 'unstable')
18+
];
19+
20+
Promise.all(promises)
21+
.then(function() {
22+
console.log('Download complete.');
23+
});
24+
})();

0 commit comments

Comments
 (0)