plum-e2e 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +15 -15
- package/README.md +5 -5
- package/backend/_scaffold/pages/LoginPage.js +22 -22
- package/backend/_scaffold/step_definitions/LoginSteps.js +9 -9
- package/backend/_scaffold/utils/constants.js +3 -3
- package/backend/_scaffold/utils/hooks.js +65 -65
- package/backend/_scaffold/utils/utils.js +10 -10
- package/backend/app.js +37 -37
- package/backend/config/scripts/create-settings.js +60 -60
- package/backend/config/scripts/generate-report.js +135 -135
- package/backend/config/scripts/run-tests.js +37 -37
- package/backend/cucumber.json +6 -6
- package/backend/package.json +29 -29
- package/backend/playwright.config.js +97 -97
- package/backend/routes/cron.routes.js +127 -127
- package/backend/routes/reports.routes.js +42 -42
- package/backend/routes/schedules.routes.js +32 -32
- package/backend/routes/tests.routes.js +33 -33
- package/backend/server.js +39 -39
- package/backend/services/cronService.js +127 -127
- package/backend/services/envService.js +43 -43
- package/backend/services/reportService.js +50 -50
- package/backend/services/scheduleService.js +34 -34
- package/backend/services/testService.js +70 -70
- package/backend/websockets/socketHandler.js +46 -46
- package/bin/plum.js +198 -198
- package/docker-compose.yml +41 -41
- package/frontend/jsconfig.json +13 -13
- package/frontend/package.json +26 -26
- package/frontend/postcss.config.js +23 -23
- package/frontend/src/app.css +35 -35
- package/frontend/src/app.html +28 -28
- package/frontend/src/lib/index.js +18 -18
- package/frontend/src/routes/+layout.svelte +34 -34
- package/frontend/src/routes/+page.svelte +188 -188
- package/frontend/src/routes/components/Navigation.svelte +53 -53
- package/frontend/src/routes/reports/+page.svelte +160 -160
- package/frontend/src/routes/scheduled-tests/+page.svelte +363 -363
- package/frontend/svelte.config.js +30 -30
- package/frontend/tailwind.config.js +44 -44
- package/frontend/vite.config.js +23 -23
- package/license-config.json +37 -37
- package/package.json +32 -28
package/.prettierrc
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"useTabs": true,
|
|
3
|
-
"singleQuote": true,
|
|
4
|
-
"trailingComma": "none",
|
|
5
|
-
"printWidth": 100,
|
|
6
|
-
"plugins": ["prettier-plugin-svelte"],
|
|
7
|
-
"overrides": [
|
|
8
|
-
{
|
|
9
|
-
"files": "*.svelte",
|
|
10
|
-
"options": {
|
|
11
|
-
"parser": "svelte"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
]
|
|
15
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"useTabs": true,
|
|
3
|
+
"singleQuote": true,
|
|
4
|
+
"trailingComma": "none",
|
|
5
|
+
"printWidth": 100,
|
|
6
|
+
"plugins": ["prettier-plugin-svelte"],
|
|
7
|
+
"overrides": [
|
|
8
|
+
{
|
|
9
|
+
"files": "*.svelte",
|
|
10
|
+
"options": {
|
|
11
|
+
"parser": "svelte"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-

|
|
2
|
-
|
|
3
|
-
**_Pre-requisite:_**
|
|
4
|
-
|
|
5
|
-
**_I. How to Run:_**
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
**_Pre-requisite:_**
|
|
4
|
+
|
|
5
|
+
**_I. How to Run:_**
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
const { SAMPLE_CONSTANT } = require('../utils/constants');
|
|
2
|
-
const Utils = require('../utils/utils');
|
|
3
|
-
|
|
4
|
-
class LoginPage {
|
|
5
|
-
constructor(page) {
|
|
6
|
-
this.page = page;
|
|
7
|
-
this.utils = new Utils(this.page);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
async goToLoginPage() {
|
|
11
|
-
console.log(SAMPLE_CONSTANT);
|
|
12
|
-
await this.utils.goToPage(process.env.BASE_URL);
|
|
13
|
-
await this.page.waitForTimeout(3000);
|
|
14
|
-
throw Error();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async skipTest() {
|
|
18
|
-
test.skip();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
module.exports = LoginPage;
|
|
1
|
+
const { SAMPLE_CONSTANT } = require('../utils/constants');
|
|
2
|
+
const Utils = require('../utils/utils');
|
|
3
|
+
|
|
4
|
+
class LoginPage {
|
|
5
|
+
constructor(page) {
|
|
6
|
+
this.page = page;
|
|
7
|
+
this.utils = new Utils(this.page);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async goToLoginPage() {
|
|
11
|
+
console.log(SAMPLE_CONSTANT);
|
|
12
|
+
await this.utils.goToPage(process.env.BASE_URL);
|
|
13
|
+
await this.page.waitForTimeout(3000);
|
|
14
|
+
throw Error();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async skipTest() {
|
|
18
|
+
test.skip();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = LoginPage;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const { Given, When, Then } = require('@cucumber/cucumber');
|
|
2
|
-
|
|
3
|
-
Given('I am in Demo Sauce Login page', async function () {
|
|
4
|
-
await this.loginPage.goToLoginPage();
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
Given('I fail this test', async function () {
|
|
8
|
-
throw new Error('err');
|
|
9
|
-
});
|
|
1
|
+
const { Given, When, Then } = require('@cucumber/cucumber');
|
|
2
|
+
|
|
3
|
+
Given('I am in Demo Sauce Login page', async function () {
|
|
4
|
+
await this.loginPage.goToLoginPage();
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
Given('I fail this test', async function () {
|
|
8
|
+
throw new Error('err');
|
|
9
|
+
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
SAMPLE_CONSTANT: 'this is a constant'
|
|
3
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
SAMPLE_CONSTANT: 'this is a constant'
|
|
3
|
+
};
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of Plum.
|
|
3
|
-
*
|
|
4
|
-
* Plum is free software: you can redistribute it and/or modify
|
|
5
|
-
* it under the terms of the GNU General Public License as published by
|
|
6
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
-
* (at your option) any later version.
|
|
8
|
-
*
|
|
9
|
-
* Plum is distributed in the hope that it will be useful,
|
|
10
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
* GNU General Public License for more details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU General Public License
|
|
15
|
-
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
require('dotenv').config();
|
|
19
|
-
|
|
20
|
-
const { Before, After, setWorldConstructor } = require('@cucumber/cucumber');
|
|
21
|
-
const { chromium } = require('playwright');
|
|
22
|
-
const fs = require('fs');
|
|
23
|
-
const path = require('path');
|
|
24
|
-
const Utils = require('../utils/utils');
|
|
25
|
-
const LoginPage = require('../pages/LoginPage');
|
|
26
|
-
|
|
27
|
-
class CustomWorld {
|
|
28
|
-
constructor({ attach }) {
|
|
29
|
-
// Enable attaching files to reports
|
|
30
|
-
this.attach = attach;
|
|
31
|
-
|
|
32
|
-
// Instance
|
|
33
|
-
this.browser = null;
|
|
34
|
-
this.context = null;
|
|
35
|
-
this.page = null;
|
|
36
|
-
|
|
37
|
-
// Pages
|
|
38
|
-
this.loginPage = null;
|
|
39
|
-
this.utils = null;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
setWorldConstructor(CustomWorld);
|
|
44
|
-
|
|
45
|
-
Before(async function () {
|
|
46
|
-
this.browser = await chromium.launch({ headless: process.env.IS_HEADLESS === 'true' });
|
|
47
|
-
this.context = await this.browser.newContext();
|
|
48
|
-
this.page = await this.context.newPage();
|
|
49
|
-
this.loginPage = new LoginPage(this.page);
|
|
50
|
-
this.utils = new Utils(this.page);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
After(async function (scenario) {
|
|
54
|
-
if (scenario.result.status === 'FAILED') {
|
|
55
|
-
const screenshotPath = path.join('reports/screenshots', `screenshot_${Date.now()}.png`);
|
|
56
|
-
await this.page.screenshot({ path: screenshotPath });
|
|
57
|
-
|
|
58
|
-
// Attach screenshot to the Cucumber report
|
|
59
|
-
const screenshotData = fs.readFileSync(screenshotPath);
|
|
60
|
-
this.attach(screenshotData, 'image/png');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Close the browser after each test
|
|
64
|
-
await this.browser.close();
|
|
65
|
-
});
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of Plum.
|
|
3
|
+
*
|
|
4
|
+
* Plum is free software: you can redistribute it and/or modify
|
|
5
|
+
* it under the terms of the GNU General Public License as published by
|
|
6
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
* (at your option) any later version.
|
|
8
|
+
*
|
|
9
|
+
* Plum is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License
|
|
15
|
+
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
require('dotenv').config();
|
|
19
|
+
|
|
20
|
+
const { Before, After, setWorldConstructor } = require('@cucumber/cucumber');
|
|
21
|
+
const { chromium } = require('playwright');
|
|
22
|
+
const fs = require('fs');
|
|
23
|
+
const path = require('path');
|
|
24
|
+
const Utils = require('../utils/utils');
|
|
25
|
+
const LoginPage = require('../pages/LoginPage');
|
|
26
|
+
|
|
27
|
+
class CustomWorld {
|
|
28
|
+
constructor({ attach }) {
|
|
29
|
+
// Enable attaching files to reports
|
|
30
|
+
this.attach = attach;
|
|
31
|
+
|
|
32
|
+
// Instance
|
|
33
|
+
this.browser = null;
|
|
34
|
+
this.context = null;
|
|
35
|
+
this.page = null;
|
|
36
|
+
|
|
37
|
+
// Pages
|
|
38
|
+
this.loginPage = null;
|
|
39
|
+
this.utils = null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
setWorldConstructor(CustomWorld);
|
|
44
|
+
|
|
45
|
+
Before(async function () {
|
|
46
|
+
this.browser = await chromium.launch({ headless: process.env.IS_HEADLESS === 'true' });
|
|
47
|
+
this.context = await this.browser.newContext();
|
|
48
|
+
this.page = await this.context.newPage();
|
|
49
|
+
this.loginPage = new LoginPage(this.page);
|
|
50
|
+
this.utils = new Utils(this.page);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
After(async function (scenario) {
|
|
54
|
+
if (scenario.result.status === 'FAILED') {
|
|
55
|
+
const screenshotPath = path.join('reports/screenshots', `screenshot_${Date.now()}.png`);
|
|
56
|
+
await this.page.screenshot({ path: screenshotPath });
|
|
57
|
+
|
|
58
|
+
// Attach screenshot to the Cucumber report
|
|
59
|
+
const screenshotData = fs.readFileSync(screenshotPath);
|
|
60
|
+
this.attach(screenshotData, 'image/png');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Close the browser after each test
|
|
64
|
+
await this.browser.close();
|
|
65
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
class Utils {
|
|
2
|
-
constructor(page) {
|
|
3
|
-
this.page = page;
|
|
4
|
-
}
|
|
5
|
-
async goToPage(url) {
|
|
6
|
-
await this.page.goto(url);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
module.exports = Utils;
|
|
1
|
+
class Utils {
|
|
2
|
+
constructor(page) {
|
|
3
|
+
this.page = page;
|
|
4
|
+
}
|
|
5
|
+
async goToPage(url) {
|
|
6
|
+
await this.page.goto(url);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
module.exports = Utils;
|
package/backend/app.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of Plum.
|
|
3
|
-
*
|
|
4
|
-
* Plum is free software: you can redistribute it and/or modify
|
|
5
|
-
* it under the terms of the GNU General Public License as published by
|
|
6
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
-
* (at your option) any later version.
|
|
8
|
-
*
|
|
9
|
-
* Plum is distributed in the hope that it will be useful,
|
|
10
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
* GNU General Public License for more details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU General Public License
|
|
15
|
-
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
const express = require('express');
|
|
19
|
-
const cors = require('cors');
|
|
20
|
-
const app = express();
|
|
21
|
-
|
|
22
|
-
app.use(cors({ origin: '*' }));
|
|
23
|
-
app.use(express.json());
|
|
24
|
-
|
|
25
|
-
// Routes
|
|
26
|
-
const testRoutes = require('./routes/tests.routes');
|
|
27
|
-
const reportRoutes = require('./routes/reports.routes');
|
|
28
|
-
const cronRoutes = require('./routes/cron.routes');
|
|
29
|
-
const scheduleRoutes = require('./routes/schedules.routes');
|
|
30
|
-
|
|
31
|
-
app.use('/tests', testRoutes);
|
|
32
|
-
app.use('/reports', reportRoutes);
|
|
33
|
-
app.use('/cron-jobs', cronRoutes);
|
|
34
|
-
app.use('/reports', express.static('reports'));
|
|
35
|
-
app.use('/schedules', scheduleRoutes);
|
|
36
|
-
|
|
37
|
-
module.exports = app;
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of Plum.
|
|
3
|
+
*
|
|
4
|
+
* Plum is free software: you can redistribute it and/or modify
|
|
5
|
+
* it under the terms of the GNU General Public License as published by
|
|
6
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
* (at your option) any later version.
|
|
8
|
+
*
|
|
9
|
+
* Plum is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License
|
|
15
|
+
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const express = require('express');
|
|
19
|
+
const cors = require('cors');
|
|
20
|
+
const app = express();
|
|
21
|
+
|
|
22
|
+
app.use(cors({ origin: '*' }));
|
|
23
|
+
app.use(express.json());
|
|
24
|
+
|
|
25
|
+
// Routes
|
|
26
|
+
const testRoutes = require('./routes/tests.routes');
|
|
27
|
+
const reportRoutes = require('./routes/reports.routes');
|
|
28
|
+
const cronRoutes = require('./routes/cron.routes');
|
|
29
|
+
const scheduleRoutes = require('./routes/schedules.routes');
|
|
30
|
+
|
|
31
|
+
app.use('/tests', testRoutes);
|
|
32
|
+
app.use('/reports', reportRoutes);
|
|
33
|
+
app.use('/cron-jobs', cronRoutes);
|
|
34
|
+
app.use('/reports', express.static('reports'));
|
|
35
|
+
app.use('/schedules', scheduleRoutes);
|
|
36
|
+
|
|
37
|
+
module.exports = app;
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of Plum.
|
|
3
|
-
*
|
|
4
|
-
* Plum is free software: you can redistribute it and/or modify
|
|
5
|
-
* it under the terms of the GNU General Public License as published by
|
|
6
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
-
* (at your option) any later version.
|
|
8
|
-
*
|
|
9
|
-
* Plum is distributed in the hope that it will be useful,
|
|
10
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
* GNU General Public License for more details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU General Public License
|
|
15
|
-
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
const fs = require('fs');
|
|
19
|
-
const path = require('path');
|
|
20
|
-
const fse = require('fs-extra'); // fs-extra for directory copying
|
|
21
|
-
|
|
22
|
-
// Path to the settings.json file inside the backend/config directory
|
|
23
|
-
const settingsFilePath = path.join(process.cwd(), 'config', 'settings.json');
|
|
24
|
-
const scaffoldFolderPath = path.join(process.cwd(), '_scaffold');
|
|
25
|
-
const userTestsFolderPath = path.join(process.cwd(), 'tests');
|
|
26
|
-
|
|
27
|
-
// Check if the settings.json file exists
|
|
28
|
-
if (!fs.existsSync(settingsFilePath)) {
|
|
29
|
-
console.log('⚠️ settings.json not found. Creating it with default values...');
|
|
30
|
-
|
|
31
|
-
// Default content for settings.json
|
|
32
|
-
const settingsContent = JSON.stringify(
|
|
33
|
-
{
|
|
34
|
-
reportsHistory: 20,
|
|
35
|
-
cronJobSchedules: [
|
|
36
|
-
{ label: 'Every minute', value: '* * * * *' },
|
|
37
|
-
{ label: 'Every hour', value: '0 * * * *' },
|
|
38
|
-
{ label: 'Every midnight', value: '0 0 * * *' },
|
|
39
|
-
{ label: 'Every Sunday', value: '0 0 * * 0' }
|
|
40
|
-
]
|
|
41
|
-
},
|
|
42
|
-
null,
|
|
43
|
-
2
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
// Write the settings to the settings.json file
|
|
47
|
-
fs.writeFileSync(settingsFilePath, settingsContent, 'utf8');
|
|
48
|
-
console.log('✅ settings.json created with default values.');
|
|
49
|
-
} else {
|
|
50
|
-
console.log('⚠️ settings.json already exists. Skipping creation.');
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Check if the tests folder exists, if not, copy the scaffold folder as tests
|
|
54
|
-
if (!fs.existsSync(userTestsFolderPath)) {
|
|
55
|
-
console.log('🧪 `tests/` folder not found. Creating `tests/` from the scaffold folder...');
|
|
56
|
-
fse.copySync(scaffoldFolderPath, userTestsFolderPath);
|
|
57
|
-
console.log('✅ `tests/` folder created from scaffold.');
|
|
58
|
-
} else {
|
|
59
|
-
console.log('⚠️ `tests/` folder already exists. Skipping creation.');
|
|
60
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of Plum.
|
|
3
|
+
*
|
|
4
|
+
* Plum is free software: you can redistribute it and/or modify
|
|
5
|
+
* it under the terms of the GNU General Public License as published by
|
|
6
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
* (at your option) any later version.
|
|
8
|
+
*
|
|
9
|
+
* Plum is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License
|
|
15
|
+
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const fs = require('fs');
|
|
19
|
+
const path = require('path');
|
|
20
|
+
const fse = require('fs-extra'); // fs-extra for directory copying
|
|
21
|
+
|
|
22
|
+
// Path to the settings.json file inside the backend/config directory
|
|
23
|
+
const settingsFilePath = path.join(process.cwd(), 'config', 'settings.json');
|
|
24
|
+
const scaffoldFolderPath = path.join(process.cwd(), '_scaffold');
|
|
25
|
+
const userTestsFolderPath = path.join(process.cwd(), 'tests');
|
|
26
|
+
|
|
27
|
+
// Check if the settings.json file exists
|
|
28
|
+
if (!fs.existsSync(settingsFilePath)) {
|
|
29
|
+
console.log('⚠️ settings.json not found. Creating it with default values...');
|
|
30
|
+
|
|
31
|
+
// Default content for settings.json
|
|
32
|
+
const settingsContent = JSON.stringify(
|
|
33
|
+
{
|
|
34
|
+
reportsHistory: 20,
|
|
35
|
+
cronJobSchedules: [
|
|
36
|
+
{ label: 'Every minute', value: '* * * * *' },
|
|
37
|
+
{ label: 'Every hour', value: '0 * * * *' },
|
|
38
|
+
{ label: 'Every midnight', value: '0 0 * * *' },
|
|
39
|
+
{ label: 'Every Sunday', value: '0 0 * * 0' }
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
null,
|
|
43
|
+
2
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// Write the settings to the settings.json file
|
|
47
|
+
fs.writeFileSync(settingsFilePath, settingsContent, 'utf8');
|
|
48
|
+
console.log('✅ settings.json created with default values.');
|
|
49
|
+
} else {
|
|
50
|
+
console.log('⚠️ settings.json already exists. Skipping creation.');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Check if the tests folder exists, if not, copy the scaffold folder as tests
|
|
54
|
+
if (!fs.existsSync(userTestsFolderPath)) {
|
|
55
|
+
console.log('🧪 `tests/` folder not found. Creating `tests/` from the scaffold folder...');
|
|
56
|
+
fse.copySync(scaffoldFolderPath, userTestsFolderPath);
|
|
57
|
+
console.log('✅ `tests/` folder created from scaffold.');
|
|
58
|
+
} else {
|
|
59
|
+
console.log('⚠️ `tests/` folder already exists. Skipping creation.');
|
|
60
|
+
}
|