@@ -14,6 +14,14 @@ if (!process.env.GCM_API_KEY) {
14
14
console . log ( 'You need to set the GCM_API_KEY env variable to run the tests with Chromium.' . bold . red ) ;
15
15
}
16
16
17
+ if ( ! process . env . VAPID_PRIVATE_KEY || ! process . env . VAPID_PUBLIC_KEY ) {
18
+ console . log ( 'You haven\'t set the VAPID env variables, I\'ll generate them for you.' . bold . yellow ) ;
19
+
20
+ var keys = webPush . generateVAPIDKeys ( ) ;
21
+ process . env . VAPID_PRIVATE_KEY = keys . privateKey . toString ( 'base64' ) ;
22
+ process . env . VAPID_PUBLIC_KEY = keys . publicKey . toString ( 'base64' ) ;
23
+ }
24
+
17
25
process . env . PATH = process . env . PATH + ':test_tools/' ;
18
26
19
27
suite ( 'selenium' , function ( ) {
@@ -177,12 +185,11 @@ suite('selenium', function() {
177
185
} ) ;
178
186
} ) ;
179
187
180
- var vapidKeys = webPush . generateVAPIDKeys ( ) ;
181
188
var vapidParam = {
182
189
audience : 'https://www.mozilla.org/' ,
183
190
subject :
'mailto:[email protected] ' ,
184
- privateKey : vapidKeys . privateKey ,
185
- publicKey : vapidKeys . publicKey ,
191
+ privateKey : new Buffer ( process . env . VAPID_PRIVATE_KEY , 'base64' ) ,
192
+ publicKey : new Buffer ( process . env . VAPID_PUBLIC_KEY , 'base64' ) ,
186
193
} ;
187
194
188
195
test ( 'send/receive notification without payload with Firefox Release' , function ( ) {
0 commit comments