-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcypress.config.ts
43 lines (42 loc) · 1.19 KB
/
cypress.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { defineConfig } from 'cypress';
import { getAuth } from 'firebase-admin/auth';
import admin from 'firebase-admin';
import { applicationDefault } from 'firebase-admin/app';
require('dotenv').config({ path: '.env.local' });
//
export default defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
setupNodeEvents(on, config) {
on('task', {
test() {
return null;
},
});
// -----
on('task', {
createCustomToken(): Promise<string | undefined> {
if(admin.apps.length === 0){
admin.initializeApp({
credential: applicationDefault(),
storageBucket: 'lime-27e23.appspot.com',
});
}
return new Promise((resolve, reject) => {
getAuth()
.createCustomToken(process.env.UID as string)
.then(token => {
console.log('::> custom token made');
resolve(token);
})
.catch(e => {
console.log('::> failed to create custom token: ', e);
reject(undefined);
});
});
},
});
},
},
watchForFileChanges: false,
});