plum-e2e 1.0.2 → 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
|
@@ -1,46 +1,46 @@
|
|
|
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 { spawn } = require('child_process');
|
|
19
|
-
|
|
20
|
-
const socketHandler = (io) => {
|
|
21
|
-
io.on('connection', (socket) => {
|
|
22
|
-
console.log('WebSocket connection established');
|
|
23
|
-
socket.on('run-test', (testID) => {
|
|
24
|
-
const tag = testID ? `${testID}` : '';
|
|
25
|
-
|
|
26
|
-
const testProcess = spawn('npm', ['run', 'test'], {
|
|
27
|
-
env: { ...process.env, TAG: tag, TRIGGER: 'manual-trigger' }
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
testProcess.stdout.on('data', (data) => {
|
|
31
|
-
socket.emit('log', data.toString());
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
testProcess.stderr.on('data', (data) => {
|
|
35
|
-
socket.emit('log', `[ERROR] ${data.toString()}`);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
testProcess.on('close', (code) => {
|
|
39
|
-
socket.emit('log', `Test finished with code ${code}`);
|
|
40
|
-
socket.emit('done');
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
module.exports = socketHandler;
|
|
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 { spawn } = require('child_process');
|
|
19
|
+
|
|
20
|
+
const socketHandler = (io) => {
|
|
21
|
+
io.on('connection', (socket) => {
|
|
22
|
+
console.log('WebSocket connection established');
|
|
23
|
+
socket.on('run-test', (testID) => {
|
|
24
|
+
const tag = testID ? `${testID}` : '';
|
|
25
|
+
|
|
26
|
+
const testProcess = spawn('npm', ['run', 'test'], {
|
|
27
|
+
env: { ...process.env, TAG: tag, TRIGGER: 'manual-trigger' }
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
testProcess.stdout.on('data', (data) => {
|
|
31
|
+
socket.emit('log', data.toString());
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
testProcess.stderr.on('data', (data) => {
|
|
35
|
+
socket.emit('log', `[ERROR] ${data.toString()}`);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
testProcess.on('close', (code) => {
|
|
39
|
+
socket.emit('log', `Test finished with code ${code}`);
|
|
40
|
+
socket.emit('done');
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
module.exports = socketHandler;
|
package/bin/plum.js
CHANGED
|
@@ -1,198 +1,198 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/*
|
|
3
|
-
* This file is part of Plum.
|
|
4
|
-
*
|
|
5
|
-
* Plum is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* Plum is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import { execSync } from 'child_process';
|
|
20
|
-
import fs from 'fs';
|
|
21
|
-
import path from 'path';
|
|
22
|
-
import { fileURLToPath } from 'url';
|
|
23
|
-
import fse from 'fs-extra';
|
|
24
|
-
|
|
25
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
26
|
-
const __dirname = path.dirname(__filename);
|
|
27
|
-
const command = process.argv[2];
|
|
28
|
-
const plumRoot = path.resolve(__dirname, '..');
|
|
29
|
-
const userTestsPath = path.join(process.cwd(), 'tests');
|
|
30
|
-
const scaffoldTestsPath = path.join(plumRoot, 'backend', '_scaffold');
|
|
31
|
-
const overrideFilePath = path.join(plumRoot, 'docker-compose.override.yml');
|
|
32
|
-
|
|
33
|
-
// Paths for .env file
|
|
34
|
-
const rootEnvPath = path.join(process.cwd(), '.env');
|
|
35
|
-
const backendEnvPath = path.join(plumRoot, 'backend', '.env');
|
|
36
|
-
|
|
37
|
-
// Function to create the .env file with default values NOTE: DO NOT FORMAT envContent
|
|
38
|
-
function createEnvFile() {
|
|
39
|
-
const envFilePath = path.join(process.cwd(), '.env');
|
|
40
|
-
|
|
41
|
-
// Check if .env file already exists
|
|
42
|
-
if (fs.existsSync(envFilePath)) {
|
|
43
|
-
copyEnvFile();
|
|
44
|
-
console.log('⚠️ .env file already exists. Syncing .env file...\n');
|
|
45
|
-
return; // Exit if file exists
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Default content for .env file
|
|
49
|
-
const envContent = `BASE_URL=https://www.saucedemo.com/v1/
|
|
50
|
-
IS_HEADLESS=false
|
|
51
|
-
`;
|
|
52
|
-
|
|
53
|
-
// Write the content to the .env file
|
|
54
|
-
fs.writeFileSync(envFilePath, envContent, 'utf8');
|
|
55
|
-
console.log('✅ .env file created with default values.\n');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Function to copy .env file from root to backend
|
|
59
|
-
function copyEnvFile() {
|
|
60
|
-
try {
|
|
61
|
-
if (fs.existsSync(rootEnvPath)) {
|
|
62
|
-
fse.copySync(rootEnvPath, backendEnvPath);
|
|
63
|
-
console.log('📦 .env file copied to the backend folder.\n');
|
|
64
|
-
} else {
|
|
65
|
-
console.log('⚠️ .env file not found in the root directory.\n');
|
|
66
|
-
}
|
|
67
|
-
} catch (err) {
|
|
68
|
-
console.error('Error copying .env file:', err);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/* -----------------------------------------------------
|
|
73
|
-
* Commands
|
|
74
|
-
* Description:
|
|
75
|
-
* Main command line interface for Plum. Use
|
|
76
|
-
* "plum <command>" to run the desired command.
|
|
77
|
-
* ------------------------------------------------------ */
|
|
78
|
-
switch (command) {
|
|
79
|
-
case 'init':
|
|
80
|
-
console.log('--------------------------------------\n');
|
|
81
|
-
console.log('🟣 Preparing Plum...\n');
|
|
82
|
-
|
|
83
|
-
if (fs.existsSync(userTestsPath)) {
|
|
84
|
-
console.log('⚠️ A `tests/` folder already exists.\n');
|
|
85
|
-
} else {
|
|
86
|
-
console.log('📦 Creating test scaffold...\n');
|
|
87
|
-
fse.copySync(scaffoldTestsPath, userTestsPath);
|
|
88
|
-
console.log('✅ `tests/` initialized with example files.\n');
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Create .env file with default values
|
|
92
|
-
createEnvFile();
|
|
93
|
-
|
|
94
|
-
// Initialize project
|
|
95
|
-
console.log('--------------------------------------\n');
|
|
96
|
-
console.log('🚀 Initializing Plum...');
|
|
97
|
-
execSync('npm run init', {
|
|
98
|
-
cwd: plumRoot,
|
|
99
|
-
stdio: 'inherit'
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
console.log(
|
|
103
|
-
'🟣 Plum is now ready!\n\n Scaffold test cases are included in the `tests/` folder.\n For more information about Cucumber, visit: https://cucumber.io/\n\n - To start the server, run:\n `plum start` \n\n - If you are developing locally, run:\n `plum dev <@tag/blank if you want to run all tests>`'
|
|
104
|
-
);
|
|
105
|
-
console.log('--------------------------------------\n');
|
|
106
|
-
break;
|
|
107
|
-
|
|
108
|
-
case 'start':
|
|
109
|
-
console.log('--------------------------------------\n');
|
|
110
|
-
|
|
111
|
-
console.log('🚀 Running Plum via Docker Compose...');
|
|
112
|
-
|
|
113
|
-
// Copy .env file from root to backend
|
|
114
|
-
copyEnvFile();
|
|
115
|
-
|
|
116
|
-
// Convert Windows paths to safe format
|
|
117
|
-
const userTestsAbs = path.resolve(process.cwd(), 'tests').replace(/\\/g, '/');
|
|
118
|
-
const userModulesAbs = path.resolve(process.cwd(), 'node_modules').replace(/\\/g, '/');
|
|
119
|
-
|
|
120
|
-
// Generate docker-compose.override.yml
|
|
121
|
-
const overrideYAML = [
|
|
122
|
-
'services:',
|
|
123
|
-
' backend:',
|
|
124
|
-
' volumes:',
|
|
125
|
-
` - "${userTestsAbs}:/app/tests"`,
|
|
126
|
-
` - "${userModulesAbs}:/app/tests/node_modules"`
|
|
127
|
-
].join('\n');
|
|
128
|
-
|
|
129
|
-
fs.writeFileSync(overrideFilePath, overrideYAML + '\n', 'utf8');
|
|
130
|
-
console.log('✅ docker-compose.override.yml written');
|
|
131
|
-
|
|
132
|
-
// Run docker compose
|
|
133
|
-
execSync('docker compose up', {
|
|
134
|
-
cwd: plumRoot,
|
|
135
|
-
stdio: 'inherit'
|
|
136
|
-
});
|
|
137
|
-
console.log('--------------------------------------\n');
|
|
138
|
-
break;
|
|
139
|
-
|
|
140
|
-
case 'dev': {
|
|
141
|
-
console.log('--------------------------------------\n');
|
|
142
|
-
console.log('🚀 Running Plum in Development Mode...');
|
|
143
|
-
|
|
144
|
-
// Copy .env file from root to backend
|
|
145
|
-
copyEnvFile();
|
|
146
|
-
|
|
147
|
-
const tagArg = process.argv[3]; // This is your tag, like @test-1
|
|
148
|
-
const userTestsPath = path.resolve(process.cwd(), 'tests');
|
|
149
|
-
const backendTestsPath = path.join(plumRoot, 'backend', 'tests');
|
|
150
|
-
|
|
151
|
-
// Copy user tests into backend
|
|
152
|
-
if (fs.existsSync(userTestsPath)) {
|
|
153
|
-
console.log('📦 Syncing your tests
|
|
154
|
-
fse.copySync(userTestsPath, backendTestsPath);
|
|
155
|
-
} else {
|
|
156
|
-
console.log('⚠️ No `tests/` folder found in the user directory
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// Run npm install
|
|
160
|
-
console.log('--------------------------------------\n');
|
|
161
|
-
console.log('Running `npm install`...');
|
|
162
|
-
|
|
163
|
-
execSync('npm install', {
|
|
164
|
-
cwd: path.join(plumRoot, 'backend'),
|
|
165
|
-
stdio: 'inherit'
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
console.log('Running `npx playwright install`...');
|
|
169
|
-
|
|
170
|
-
execSync('npx playwright install', {
|
|
171
|
-
cwd: path.join(plumRoot, 'backend'),
|
|
172
|
-
stdio: 'inherit'
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
// Run the tests with the tag filter, only if a tag is provided
|
|
176
|
-
console.log('--------------------------------------\n');
|
|
177
|
-
console.log('Running `npm run test` with:');
|
|
178
|
-
console.log('TAG =', tagArg ?? '');
|
|
179
|
-
console.log('TRIGGER =', 'command-line-trigger');
|
|
180
|
-
|
|
181
|
-
execSync('npm run test', {
|
|
182
|
-
cwd: path.join(plumRoot, 'backend'),
|
|
183
|
-
stdio: 'inherit',
|
|
184
|
-
env: {
|
|
185
|
-
...process.env,
|
|
186
|
-
TAG: tagArg ?? '',
|
|
187
|
-
TRIGGER: 'command-line-trigger'
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
console.log('--------------------------------------\n');
|
|
191
|
-
break;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
default:
|
|
195
|
-
console.log('--------------------------------------\n');
|
|
196
|
-
console.log('Usage: plum <init|start|dev>');
|
|
197
|
-
console.log('--------------------------------------\n');
|
|
198
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/*
|
|
3
|
+
* This file is part of Plum.
|
|
4
|
+
*
|
|
5
|
+
* Plum is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
*
|
|
10
|
+
* Plum is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU General Public License
|
|
16
|
+
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { execSync } from 'child_process';
|
|
20
|
+
import fs from 'fs';
|
|
21
|
+
import path from 'path';
|
|
22
|
+
import { fileURLToPath } from 'url';
|
|
23
|
+
import fse from 'fs-extra';
|
|
24
|
+
|
|
25
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
26
|
+
const __dirname = path.dirname(__filename);
|
|
27
|
+
const command = process.argv[2];
|
|
28
|
+
const plumRoot = path.resolve(__dirname, '..');
|
|
29
|
+
const userTestsPath = path.join(process.cwd(), 'tests');
|
|
30
|
+
const scaffoldTestsPath = path.join(plumRoot, 'backend', '_scaffold');
|
|
31
|
+
const overrideFilePath = path.join(plumRoot, 'docker-compose.override.yml');
|
|
32
|
+
|
|
33
|
+
// Paths for .env file
|
|
34
|
+
const rootEnvPath = path.join(process.cwd(), '.env');
|
|
35
|
+
const backendEnvPath = path.join(plumRoot, 'backend', '.env');
|
|
36
|
+
|
|
37
|
+
// Function to create the .env file with default values NOTE: DO NOT FORMAT envContent
|
|
38
|
+
function createEnvFile() {
|
|
39
|
+
const envFilePath = path.join(process.cwd(), '.env');
|
|
40
|
+
|
|
41
|
+
// Check if .env file already exists
|
|
42
|
+
if (fs.existsSync(envFilePath)) {
|
|
43
|
+
copyEnvFile();
|
|
44
|
+
console.log('⚠️ .env file already exists. Syncing .env file...\n');
|
|
45
|
+
return; // Exit if file exists
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Default content for .env file
|
|
49
|
+
const envContent = `BASE_URL=https://www.saucedemo.com/v1/
|
|
50
|
+
IS_HEADLESS=false
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
// Write the content to the .env file
|
|
54
|
+
fs.writeFileSync(envFilePath, envContent, 'utf8');
|
|
55
|
+
console.log('✅ .env file created with default values.\n');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Function to copy .env file from root to backend
|
|
59
|
+
function copyEnvFile() {
|
|
60
|
+
try {
|
|
61
|
+
if (fs.existsSync(rootEnvPath)) {
|
|
62
|
+
fse.copySync(rootEnvPath, backendEnvPath);
|
|
63
|
+
console.log('📦 .env file copied to the backend folder.\n');
|
|
64
|
+
} else {
|
|
65
|
+
console.log('⚠️ .env file not found in the root directory.\n');
|
|
66
|
+
}
|
|
67
|
+
} catch (err) {
|
|
68
|
+
console.error('Error copying .env file:', err);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* -----------------------------------------------------
|
|
73
|
+
* Commands
|
|
74
|
+
* Description:
|
|
75
|
+
* Main command line interface for Plum. Use
|
|
76
|
+
* "plum <command>" to run the desired command.
|
|
77
|
+
* ------------------------------------------------------ */
|
|
78
|
+
switch (command) {
|
|
79
|
+
case 'init':
|
|
80
|
+
console.log('--------------------------------------\n');
|
|
81
|
+
console.log('🟣 Preparing Plum...\n');
|
|
82
|
+
|
|
83
|
+
if (fs.existsSync(userTestsPath)) {
|
|
84
|
+
console.log('⚠️ A `tests/` folder already exists.\n');
|
|
85
|
+
} else {
|
|
86
|
+
console.log('📦 Creating test scaffold...\n');
|
|
87
|
+
fse.copySync(scaffoldTestsPath, userTestsPath);
|
|
88
|
+
console.log('✅ `tests/` initialized with example files.\n');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Create .env file with default values
|
|
92
|
+
createEnvFile();
|
|
93
|
+
|
|
94
|
+
// Initialize project
|
|
95
|
+
console.log('--------------------------------------\n');
|
|
96
|
+
console.log('🚀 Initializing Plum...');
|
|
97
|
+
execSync('npm run init', {
|
|
98
|
+
cwd: plumRoot,
|
|
99
|
+
stdio: 'inherit'
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
console.log(
|
|
103
|
+
'🟣 Plum is now ready!\n\n Scaffold test cases are included in the `tests/` folder.\n For more information about Cucumber, visit: https://cucumber.io/\n\n - To start the server, run:\n `plum start` \n\n - If you are developing locally, run:\n `plum dev <@tag/blank if you want to run all tests>`'
|
|
104
|
+
);
|
|
105
|
+
console.log('--------------------------------------\n');
|
|
106
|
+
break;
|
|
107
|
+
|
|
108
|
+
case 'start':
|
|
109
|
+
console.log('--------------------------------------\n');
|
|
110
|
+
|
|
111
|
+
console.log('🚀 Running Plum via Docker Compose...');
|
|
112
|
+
|
|
113
|
+
// Copy .env file from root to backend
|
|
114
|
+
copyEnvFile();
|
|
115
|
+
|
|
116
|
+
// Convert Windows paths to safe format
|
|
117
|
+
const userTestsAbs = path.resolve(process.cwd(), 'tests').replace(/\\/g, '/');
|
|
118
|
+
const userModulesAbs = path.resolve(process.cwd(), 'node_modules').replace(/\\/g, '/');
|
|
119
|
+
|
|
120
|
+
// Generate docker-compose.override.yml
|
|
121
|
+
const overrideYAML = [
|
|
122
|
+
'services:',
|
|
123
|
+
' backend:',
|
|
124
|
+
' volumes:',
|
|
125
|
+
` - "${userTestsAbs}:/app/tests"`,
|
|
126
|
+
` - "${userModulesAbs}:/app/tests/node_modules"`
|
|
127
|
+
].join('\n');
|
|
128
|
+
|
|
129
|
+
fs.writeFileSync(overrideFilePath, overrideYAML + '\n', 'utf8');
|
|
130
|
+
console.log('✅ docker-compose.override.yml written');
|
|
131
|
+
|
|
132
|
+
// Run docker compose
|
|
133
|
+
execSync('docker compose up', {
|
|
134
|
+
cwd: plumRoot,
|
|
135
|
+
stdio: 'inherit'
|
|
136
|
+
});
|
|
137
|
+
console.log('--------------------------------------\n');
|
|
138
|
+
break;
|
|
139
|
+
|
|
140
|
+
case 'dev': {
|
|
141
|
+
console.log('--------------------------------------\n');
|
|
142
|
+
console.log('🚀 Running Plum in Development Mode...');
|
|
143
|
+
|
|
144
|
+
// Copy .env file from root to backend
|
|
145
|
+
copyEnvFile();
|
|
146
|
+
|
|
147
|
+
const tagArg = process.argv[3]; // This is your tag, like @test-1
|
|
148
|
+
const userTestsPath = path.resolve(process.cwd(), 'tests');
|
|
149
|
+
const backendTestsPath = path.join(plumRoot, 'backend', 'tests');
|
|
150
|
+
|
|
151
|
+
// Copy user tests into backend
|
|
152
|
+
if (fs.existsSync(userTestsPath)) {
|
|
153
|
+
console.log('📦 Syncing your tests...\n');
|
|
154
|
+
fse.copySync(userTestsPath, backendTestsPath);
|
|
155
|
+
} else {
|
|
156
|
+
console.log('⚠️ No `tests/` folder found in the user directory.\n');
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Run npm install
|
|
160
|
+
console.log('--------------------------------------\n');
|
|
161
|
+
console.log('Running `npm install`...');
|
|
162
|
+
|
|
163
|
+
execSync('npm install', {
|
|
164
|
+
cwd: path.join(plumRoot, 'backend'),
|
|
165
|
+
stdio: 'inherit'
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
console.log('Running `npx playwright install`...');
|
|
169
|
+
|
|
170
|
+
execSync('npx playwright install', {
|
|
171
|
+
cwd: path.join(plumRoot, 'backend'),
|
|
172
|
+
stdio: 'inherit'
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// Run the tests with the tag filter, only if a tag is provided
|
|
176
|
+
console.log('--------------------------------------\n');
|
|
177
|
+
console.log('Running `npm run test` with:');
|
|
178
|
+
console.log('TAG =', tagArg ?? '');
|
|
179
|
+
console.log('TRIGGER =', 'command-line-trigger');
|
|
180
|
+
|
|
181
|
+
execSync('npm run test', {
|
|
182
|
+
cwd: path.join(plumRoot, 'backend'),
|
|
183
|
+
stdio: 'inherit',
|
|
184
|
+
env: {
|
|
185
|
+
...process.env,
|
|
186
|
+
TAG: tagArg ?? '',
|
|
187
|
+
TRIGGER: 'command-line-trigger'
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
console.log('--------------------------------------\n');
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
default:
|
|
195
|
+
console.log('--------------------------------------\n');
|
|
196
|
+
console.log('Usage: plum <init|start|dev>');
|
|
197
|
+
console.log('--------------------------------------\n');
|
|
198
|
+
}
|
package/docker-compose.yml
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
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
|
-
services:
|
|
19
|
-
backend:
|
|
20
|
-
build: ./backend
|
|
21
|
-
ports:
|
|
22
|
-
- '3001:3001'
|
|
23
|
-
volumes:
|
|
24
|
-
- ./backend/reports:/app/reports
|
|
25
|
-
- ./backend/config:/app/config
|
|
26
|
-
- ./backend/tests:/app/tests:rw
|
|
27
|
-
networks:
|
|
28
|
-
- app-network
|
|
29
|
-
|
|
30
|
-
frontend:
|
|
31
|
-
build: ./frontend
|
|
32
|
-
ports:
|
|
33
|
-
- '5173:5173'
|
|
34
|
-
depends_on:
|
|
35
|
-
- backend
|
|
36
|
-
networks:
|
|
37
|
-
- app-network
|
|
38
|
-
|
|
39
|
-
networks:
|
|
40
|
-
app-network:
|
|
41
|
-
driver: bridge
|
|
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
|
+
services:
|
|
19
|
+
backend:
|
|
20
|
+
build: ./backend
|
|
21
|
+
ports:
|
|
22
|
+
- '3001:3001'
|
|
23
|
+
volumes:
|
|
24
|
+
- ./backend/reports:/app/reports
|
|
25
|
+
- ./backend/config:/app/config
|
|
26
|
+
- ./backend/tests:/app/tests:rw
|
|
27
|
+
networks:
|
|
28
|
+
- app-network
|
|
29
|
+
|
|
30
|
+
frontend:
|
|
31
|
+
build: ./frontend
|
|
32
|
+
ports:
|
|
33
|
+
- '5173:5173'
|
|
34
|
+
depends_on:
|
|
35
|
+
- backend
|
|
36
|
+
networks:
|
|
37
|
+
- app-network
|
|
38
|
+
|
|
39
|
+
networks:
|
|
40
|
+
app-network:
|
|
41
|
+
driver: bridge
|
package/frontend/jsconfig.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./.svelte-kit/tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"allowJs": true,
|
|
5
|
-
"checkJs": false,
|
|
6
|
-
"moduleResolution": "bundler"
|
|
7
|
-
}
|
|
8
|
-
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
|
|
9
|
-
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
|
|
10
|
-
//
|
|
11
|
-
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
|
|
12
|
-
// from the referenced tsconfig.json - TypeScript does not merge them in
|
|
13
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "./.svelte-kit/tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"allowJs": true,
|
|
5
|
+
"checkJs": false,
|
|
6
|
+
"moduleResolution": "bundler"
|
|
7
|
+
}
|
|
8
|
+
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
|
|
9
|
+
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
|
|
10
|
+
//
|
|
11
|
+
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
|
|
12
|
+
// from the referenced tsconfig.json - TypeScript does not merge them in
|
|
13
|
+
}
|
package/frontend/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "plum-frontend",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "0.0.1",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "vite dev",
|
|
8
|
-
"build": "vite build",
|
|
9
|
-
"preview": "vite preview",
|
|
10
|
-
"prepare": "svelte-kit sync || echo ''"
|
|
11
|
-
},
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"@sveltejs/adapter-auto": "^4.0.0",
|
|
14
|
-
"@sveltejs/kit": "^2.16.0",
|
|
15
|
-
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
|
16
|
-
"autoprefixer": "^10.4.20",
|
|
17
|
-
"daisyui": "^4.12.23",
|
|
18
|
-
"postcss": "^8.5.1",
|
|
19
|
-
"svelte": "^5.0.0",
|
|
20
|
-
"tailwindcss": "^3.4.17",
|
|
21
|
-
"vite": "^6.0.0"
|
|
22
|
-
},
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"socket.io-client": "^4.8.1"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "plum-frontend",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite dev",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"prepare": "svelte-kit sync || echo ''"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@sveltejs/adapter-auto": "^4.0.0",
|
|
14
|
+
"@sveltejs/kit": "^2.16.0",
|
|
15
|
+
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
|
16
|
+
"autoprefixer": "^10.4.20",
|
|
17
|
+
"daisyui": "^4.12.23",
|
|
18
|
+
"postcss": "^8.5.1",
|
|
19
|
+
"svelte": "^5.0.0",
|
|
20
|
+
"tailwindcss": "^3.4.17",
|
|
21
|
+
"vite": "^6.0.0"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"socket.io-client": "^4.8.1"
|
|
25
|
+
}
|
|
26
|
+
}
|