Skip to content

Commit 32af382

Browse files
committed
Make it possible to define VAPID keys to use during tests via env variables
1 parent 7ee2b20 commit 32af382

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/testSelenium.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ if (!process.env.GCM_API_KEY) {
1414
console.log('You need to set the GCM_API_KEY env variable to run the tests with Chromium.'.bold.red);
1515
}
1616

17+
if (!process.env.VAPID_PRIVATE_KEY || !process.env.VAPID_PUBLIC_KEY) {
18+
var keys = webPush.generateVAPIDKeys();
19+
process.env.VAPID_PRIVATE_KEY = keys.privateKey.toString('base64');
20+
process.env.VAPID_PUBLIC_KEY = keys.publicKey.toString('base64');
21+
}
22+
1723
process.env.PATH = process.env.PATH + ':test_tools/';
1824

1925
suite('selenium', function() {
@@ -177,12 +183,11 @@ suite('selenium', function() {
177183
});
178184
});
179185

180-
var vapidKeys = webPush.generateVAPIDKeys();
181186
var vapidParam = {
182187
audience: 'https://www.mozilla.org/',
183188
subject: 'mailto:[email protected]',
184-
privateKey: vapidKeys.privateKey,
185-
publicKey: vapidKeys.publicKey,
189+
privateKey: new Buffer(process.env.VAPID_PRIVATE_KEY, 'base64'),
190+
publicKey: new Buffer(process.env.VAPID_PUBLIC_KEY, 'base64'),
186191
};
187192

188193
test('send/receive notification without payload with Firefox Release', function() {

0 commit comments

Comments
 (0)