forked from masslight/ottehr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-test-deps.js
More file actions
49 lines (45 loc) · 1.58 KB
/
Copy pathsetup-test-deps.js
File metadata and controls
49 lines (45 loc) · 1.58 KB
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
44
45
46
47
48
49
import * as fs from 'fs';
import * as path from 'path';
import setup from '../../scripts/setup/setup.utils.mjs';
const isCI = Boolean(process.env.CI);
// copy secrets only on local machine; GitHub workflow handles it on its own
if (!isCI) {
void (async () => {
await setup.loadEnvFilesFromRepo('git@github.com:masslight/ottehr-secrets.git', [
{
localEnvFolder: './env/',
repoEnvFolder: './ottehr-secrets/ottehr/apps/ehr/env/',
envsToCopy: [
'.env.demo',
'.env.local',
'.env.development',
'.env.staging',
'.env.testing',
'.env.e2e',
'tests.local.json',
'tests.demo.json',
'tests.development.json',
'tests.staging.json',
'tests.testing.json',
'tests.e2e.json',
],
},
{
localEnvFolder: '../../config/.env',
repoEnvFolder: './ottehr-secrets/ottehr/zambdas/.env',
envsToCopy: ['demo.json', 'development.json', 'local.json', 'staging.json', 'testing.json', 'e2e.json'],
},
]);
})();
}
const playwrightUserFile = './playwright/user.json';
const playwrightUserFileCode = JSON.stringify({ cookies: [], origins: [] }, null, 2);
// create the playwright/user.json file if it doesn't exist
if (!fs.existsSync(playwrightUserFile)) {
const playwrightDir = path.dirname(playwrightUserFile);
if (!fs.existsSync(playwrightDir)) {
fs.mkdirSync(playwrightDir, { recursive: true });
}
fs.writeFileSync(playwrightUserFile, playwrightUserFileCode);
console.log('playwright/user.json created successfully.');
}