plum-e2e 1.0.2 → 1.0.4
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 +66 -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,23 +1,23 @@
|
|
|
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
|
-
export default {
|
|
19
|
-
plugins: {
|
|
20
|
-
tailwindcss: {},
|
|
21
|
-
autoprefixer: {}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
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
|
+
export default {
|
|
19
|
+
plugins: {
|
|
20
|
+
tailwindcss: {},
|
|
21
|
+
autoprefixer: {}
|
|
22
|
+
}
|
|
23
|
+
};
|
package/frontend/src/app.css
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
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
|
-
@tailwind base;
|
|
18
|
-
@tailwind components;
|
|
19
|
-
@tailwind utilities;
|
|
20
|
-
|
|
21
|
-
html {
|
|
22
|
-
scroll-behavior: smooth;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
* {
|
|
26
|
-
font-family: 'Inter', sans-serif;
|
|
27
|
-
font-weight: 300;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
h1,
|
|
31
|
-
h2,
|
|
32
|
-
h3,
|
|
33
|
-
.poppins {
|
|
34
|
-
font-family: 'Poppins', sans-serif;
|
|
35
|
-
}
|
|
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
|
+
@tailwind base;
|
|
18
|
+
@tailwind components;
|
|
19
|
+
@tailwind utilities;
|
|
20
|
+
|
|
21
|
+
html {
|
|
22
|
+
scroll-behavior: smooth;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
* {
|
|
26
|
+
font-family: 'Inter', sans-serif;
|
|
27
|
+
font-weight: 300;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
h1,
|
|
31
|
+
h2,
|
|
32
|
+
h3,
|
|
33
|
+
.poppins {
|
|
34
|
+
font-family: 'Poppins', sans-serif;
|
|
35
|
+
}
|
package/frontend/src/app.html
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
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
|
-
<!doctype html>
|
|
18
|
-
<html lang="en">
|
|
19
|
-
<head>
|
|
20
|
-
<meta charset="utf-8" />
|
|
21
|
-
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
|
22
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
23
|
-
%sveltekit.head%
|
|
24
|
-
</head>
|
|
25
|
-
<body data-sveltekit-preload-data="hover">
|
|
26
|
-
<div style="display: contents">%sveltekit.body%</div>
|
|
27
|
-
</body>
|
|
28
|
-
</html>
|
|
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
|
+
<!doctype html>
|
|
18
|
+
<html lang="en">
|
|
19
|
+
<head>
|
|
20
|
+
<meta charset="utf-8" />
|
|
21
|
+
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
|
22
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
23
|
+
%sveltekit.head%
|
|
24
|
+
</head>
|
|
25
|
+
<body data-sveltekit-preload-data="hover">
|
|
26
|
+
<div style="display: contents">%sveltekit.body%</div>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
@@ -1,18 +1,18 @@
|
|
|
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
|
-
// place files you want to import through the `$lib` alias in this folder.
|
|
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
|
+
// place files you want to import through the `$lib` alias in this folder.
|
|
@@ -1,34 +1,34 @@
|
|
|
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
|
-
<script>
|
|
19
|
-
import '../app.css';
|
|
20
|
-
import Navigation from './components/Navigation.svelte';
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<div class="layout">
|
|
24
|
-
<Navigation></Navigation>
|
|
25
|
-
<slot />
|
|
26
|
-
</div>
|
|
27
|
-
|
|
28
|
-
<style>
|
|
29
|
-
.layout {
|
|
30
|
-
display: flex;
|
|
31
|
-
flex-direction: column;
|
|
32
|
-
min-height: 100vh; /* Full viewport height */
|
|
33
|
-
}
|
|
34
|
-
</style>
|
|
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
|
+
<script>
|
|
19
|
+
import '../app.css';
|
|
20
|
+
import Navigation from './components/Navigation.svelte';
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<div class="layout">
|
|
24
|
+
<Navigation></Navigation>
|
|
25
|
+
<slot />
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<style>
|
|
29
|
+
.layout {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
min-height: 100vh; /* Full viewport height */
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
@@ -1,188 +1,188 @@
|
|
|
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
|
-
<script>
|
|
19
|
-
import { onMount } from 'svelte';
|
|
20
|
-
import { io } from 'socket.io-client';
|
|
21
|
-
|
|
22
|
-
let output = "Enter a test ID and click 'Run Test'...\n";
|
|
23
|
-
let socket;
|
|
24
|
-
let testCompleted = false;
|
|
25
|
-
let testID = '';
|
|
26
|
-
let outputRef;
|
|
27
|
-
let suites = [];
|
|
28
|
-
let latestReport = null;
|
|
29
|
-
|
|
30
|
-
onMount(async () => {
|
|
31
|
-
socket = io('http://localhost:3001');
|
|
32
|
-
|
|
33
|
-
socket.on('log', (data) => {
|
|
34
|
-
output += data + '\n';
|
|
35
|
-
scrollToBottom();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
socket.on('done', async () => {
|
|
39
|
-
output += '✅ Test completed!\n';
|
|
40
|
-
testCompleted = true;
|
|
41
|
-
scrollToBottom();
|
|
42
|
-
|
|
43
|
-
// Fetch the latest report **after** test completion
|
|
44
|
-
await fetchLatestReport();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
// Fetch test names from backend
|
|
48
|
-
try {
|
|
49
|
-
const response = await fetch('http://localhost:3001/tests');
|
|
50
|
-
const data = await response.json();
|
|
51
|
-
|
|
52
|
-
suites = data.suites.suites;
|
|
53
|
-
} catch (error) {
|
|
54
|
-
console.error('Error fetching test suites:', error);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
function runTest() {
|
|
59
|
-
const formattedTestID = testID.replace(/\sOR\s/gi, (match) => match.toLowerCase());
|
|
60
|
-
output = `Running test with ID: ${formattedTestID}...\n`;
|
|
61
|
-
testCompleted = false;
|
|
62
|
-
socket.emit('run-test', formattedTestID, 'manual-trigger');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
async function fetchLatestReport() {
|
|
66
|
-
const response = await fetch('http://localhost:3001/reports/latest');
|
|
67
|
-
const data = await response.json();
|
|
68
|
-
latestReport = data.latestReport;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
async function scrollToBottom() {
|
|
72
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
73
|
-
if (outputRef) outputRef.scrollTop = outputRef.scrollHeight;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function copyIdToTextbox(id) {
|
|
77
|
-
console.log('Selected Test ID:', id);
|
|
78
|
-
testID = id;
|
|
79
|
-
}
|
|
80
|
-
</script>
|
|
81
|
-
|
|
82
|
-
<div class="flex flex-col md:flex-row w-full my-4">
|
|
83
|
-
<!-- Left Panel: Run Tests -->
|
|
84
|
-
<div
|
|
85
|
-
class="card bg-base-300 rounded-box grid flex-grow place-items-center md:w-1/2 w-full p-4 md:mr-2 md:ml-4 mb-4 md:mb-0"
|
|
86
|
-
>
|
|
87
|
-
<div class="card-body items-center text-center">
|
|
88
|
-
<h2 class="card-title">Run Tests</h2>
|
|
89
|
-
<p>Enter a test case/suite ID or select an ID from the Test List</p>
|
|
90
|
-
<label class="form-control w-full max-w-xs mt-4">
|
|
91
|
-
<input
|
|
92
|
-
type="text"
|
|
93
|
-
class="input input-bordered w-full max-w-xs"
|
|
94
|
-
bind:value={testID}
|
|
95
|
-
placeholder="Enter test ID"
|
|
96
|
-
/>
|
|
97
|
-
</label>
|
|
98
|
-
<div class="card-actions justify-end">
|
|
99
|
-
<button class="btn btn-primary" on:click={runTest}>Run</button>
|
|
100
|
-
{#if testCompleted}
|
|
101
|
-
<a href={`http://localhost:3001/reports/${latestReport}`} target="_blank">
|
|
102
|
-
<button class="btn btn-primary">View Report</button>
|
|
103
|
-
</a>
|
|
104
|
-
{/if}
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
|
|
108
|
-
<pre
|
|
109
|
-
bind:this={outputRef}
|
|
110
|
-
class="bg-black rounded-box p-4 w-full overflow-auto whitespace-pre-wrap h-64 max-h-64">{output}</pre>
|
|
111
|
-
</div>
|
|
112
|
-
|
|
113
|
-
<!-- Right Panel: Test List -->
|
|
114
|
-
<div class="card bg-base-300 rounded-box md:w-1/2 w-full p-4 md:ml-2 md:mr-4">
|
|
115
|
-
<div class="card-body items-center text-center">
|
|
116
|
-
<h2 class="card-title sticky top-0 bg-base-300 z-10">Test List</h2>
|
|
117
|
-
<div class="mt-4">
|
|
118
|
-
{#each suites as suite, suiteIndex}
|
|
119
|
-
<div class="collapse bg-base-200 mb-4">
|
|
120
|
-
<input type="radio" name="my-accordion-1" id="collapse-{suiteIndex}" />
|
|
121
|
-
<label
|
|
122
|
-
for="collapse-{suiteIndex}"
|
|
123
|
-
class="collapse-title font-medium justify-start cursor-pointer"
|
|
124
|
-
>
|
|
125
|
-
{#if Array.isArray(suite.suiteId)}
|
|
126
|
-
{#each suite.suiteId as suiteId}
|
|
127
|
-
<div class="badge badge-primary mr-2">{suiteId}</div>
|
|
128
|
-
{/each}
|
|
129
|
-
{:else}
|
|
130
|
-
<div class="badge badge-primary mr-2">{suite.suiteId}</div>
|
|
131
|
-
{/if}
|
|
132
|
-
{suite.suiteName}
|
|
133
|
-
</label>
|
|
134
|
-
|
|
135
|
-
<div class="collapse-content">
|
|
136
|
-
<button
|
|
137
|
-
class="btn btn-active btn-ghost btn-xs"
|
|
138
|
-
on:click={() =>
|
|
139
|
-
copyIdToTextbox(Array.isArray(suite.suiteId) ? suite.suiteId[0] : suite.suiteId)}
|
|
140
|
-
>
|
|
141
|
-
Select Suite
|
|
142
|
-
</button>
|
|
143
|
-
|
|
144
|
-
<div class="card rounded-lg shadow-md mt-2">
|
|
145
|
-
<div class="overflow-x-auto">
|
|
146
|
-
<table class="table">
|
|
147
|
-
<thead>
|
|
148
|
-
<tr>
|
|
149
|
-
<th>ID</th>
|
|
150
|
-
<th>Test Case</th>
|
|
151
|
-
</tr>
|
|
152
|
-
</thead>
|
|
153
|
-
<tbody>
|
|
154
|
-
{#each suite.tests as test}
|
|
155
|
-
<tr>
|
|
156
|
-
<th>
|
|
157
|
-
{#if Array.isArray(test.id)}
|
|
158
|
-
{#each test.id as testId}
|
|
159
|
-
<button
|
|
160
|
-
class="btn btn-active btn-ghost btn-xs mr-1"
|
|
161
|
-
on:click={() => copyIdToTextbox(testId)}
|
|
162
|
-
>
|
|
163
|
-
{testId}
|
|
164
|
-
</button>
|
|
165
|
-
{/each}
|
|
166
|
-
{:else}
|
|
167
|
-
<button
|
|
168
|
-
class="btn btn-active btn-ghost btn-xs"
|
|
169
|
-
on:click={() => copyIdToTextbox(test.id)}
|
|
170
|
-
>
|
|
171
|
-
{test.id}
|
|
172
|
-
</button>
|
|
173
|
-
{/if}
|
|
174
|
-
</th>
|
|
175
|
-
<td>{test.testCase}</td>
|
|
176
|
-
</tr>
|
|
177
|
-
{/each}
|
|
178
|
-
</tbody>
|
|
179
|
-
</table>
|
|
180
|
-
</div>
|
|
181
|
-
</div>
|
|
182
|
-
</div>
|
|
183
|
-
</div>
|
|
184
|
-
{/each}
|
|
185
|
-
</div>
|
|
186
|
-
</div>
|
|
187
|
-
</div>
|
|
188
|
-
</div>
|
|
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
|
+
<script>
|
|
19
|
+
import { onMount } from 'svelte';
|
|
20
|
+
import { io } from 'socket.io-client';
|
|
21
|
+
|
|
22
|
+
let output = "Enter a test ID and click 'Run Test'...\n";
|
|
23
|
+
let socket;
|
|
24
|
+
let testCompleted = false;
|
|
25
|
+
let testID = '';
|
|
26
|
+
let outputRef;
|
|
27
|
+
let suites = [];
|
|
28
|
+
let latestReport = null;
|
|
29
|
+
|
|
30
|
+
onMount(async () => {
|
|
31
|
+
socket = io('http://localhost:3001');
|
|
32
|
+
|
|
33
|
+
socket.on('log', (data) => {
|
|
34
|
+
output += data + '\n';
|
|
35
|
+
scrollToBottom();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
socket.on('done', async () => {
|
|
39
|
+
output += '✅ Test completed!\n';
|
|
40
|
+
testCompleted = true;
|
|
41
|
+
scrollToBottom();
|
|
42
|
+
|
|
43
|
+
// Fetch the latest report **after** test completion
|
|
44
|
+
await fetchLatestReport();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Fetch test names from backend
|
|
48
|
+
try {
|
|
49
|
+
const response = await fetch('http://localhost:3001/tests');
|
|
50
|
+
const data = await response.json();
|
|
51
|
+
|
|
52
|
+
suites = data.suites.suites;
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.error('Error fetching test suites:', error);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
function runTest() {
|
|
59
|
+
const formattedTestID = testID.replace(/\sOR\s/gi, (match) => match.toLowerCase());
|
|
60
|
+
output = `Running test with ID: ${formattedTestID}...\n`;
|
|
61
|
+
testCompleted = false;
|
|
62
|
+
socket.emit('run-test', formattedTestID, 'manual-trigger');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function fetchLatestReport() {
|
|
66
|
+
const response = await fetch('http://localhost:3001/reports/latest');
|
|
67
|
+
const data = await response.json();
|
|
68
|
+
latestReport = data.latestReport;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async function scrollToBottom() {
|
|
72
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
73
|
+
if (outputRef) outputRef.scrollTop = outputRef.scrollHeight;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function copyIdToTextbox(id) {
|
|
77
|
+
console.log('Selected Test ID:', id);
|
|
78
|
+
testID = id;
|
|
79
|
+
}
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<div class="flex flex-col md:flex-row w-full my-4">
|
|
83
|
+
<!-- Left Panel: Run Tests -->
|
|
84
|
+
<div
|
|
85
|
+
class="card bg-base-300 rounded-box grid flex-grow place-items-center md:w-1/2 w-full p-4 md:mr-2 md:ml-4 mb-4 md:mb-0"
|
|
86
|
+
>
|
|
87
|
+
<div class="card-body items-center text-center">
|
|
88
|
+
<h2 class="card-title">Run Tests</h2>
|
|
89
|
+
<p>Enter a test case/suite ID or select an ID from the Test List</p>
|
|
90
|
+
<label class="form-control w-full max-w-xs mt-4">
|
|
91
|
+
<input
|
|
92
|
+
type="text"
|
|
93
|
+
class="input input-bordered w-full max-w-xs"
|
|
94
|
+
bind:value={testID}
|
|
95
|
+
placeholder="Enter test ID"
|
|
96
|
+
/>
|
|
97
|
+
</label>
|
|
98
|
+
<div class="card-actions justify-end">
|
|
99
|
+
<button class="btn btn-primary" on:click={runTest}>Run</button>
|
|
100
|
+
{#if testCompleted}
|
|
101
|
+
<a href={`http://localhost:3001/reports/${latestReport}`} target="_blank">
|
|
102
|
+
<button class="btn btn-primary">View Report</button>
|
|
103
|
+
</a>
|
|
104
|
+
{/if}
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<pre
|
|
109
|
+
bind:this={outputRef}
|
|
110
|
+
class="bg-black rounded-box p-4 w-full overflow-auto whitespace-pre-wrap h-64 max-h-64">{output}</pre>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
<!-- Right Panel: Test List -->
|
|
114
|
+
<div class="card bg-base-300 rounded-box md:w-1/2 w-full p-4 md:ml-2 md:mr-4">
|
|
115
|
+
<div class="card-body items-center text-center">
|
|
116
|
+
<h2 class="card-title sticky top-0 bg-base-300 z-10">Test List</h2>
|
|
117
|
+
<div class="mt-4">
|
|
118
|
+
{#each suites as suite, suiteIndex}
|
|
119
|
+
<div class="collapse bg-base-200 mb-4">
|
|
120
|
+
<input type="radio" name="my-accordion-1" id="collapse-{suiteIndex}" />
|
|
121
|
+
<label
|
|
122
|
+
for="collapse-{suiteIndex}"
|
|
123
|
+
class="collapse-title font-medium justify-start cursor-pointer"
|
|
124
|
+
>
|
|
125
|
+
{#if Array.isArray(suite.suiteId)}
|
|
126
|
+
{#each suite.suiteId as suiteId}
|
|
127
|
+
<div class="badge badge-primary mr-2">{suiteId}</div>
|
|
128
|
+
{/each}
|
|
129
|
+
{:else}
|
|
130
|
+
<div class="badge badge-primary mr-2">{suite.suiteId}</div>
|
|
131
|
+
{/if}
|
|
132
|
+
{suite.suiteName}
|
|
133
|
+
</label>
|
|
134
|
+
|
|
135
|
+
<div class="collapse-content">
|
|
136
|
+
<button
|
|
137
|
+
class="btn btn-active btn-ghost btn-xs"
|
|
138
|
+
on:click={() =>
|
|
139
|
+
copyIdToTextbox(Array.isArray(suite.suiteId) ? suite.suiteId[0] : suite.suiteId)}
|
|
140
|
+
>
|
|
141
|
+
Select Suite
|
|
142
|
+
</button>
|
|
143
|
+
|
|
144
|
+
<div class="card rounded-lg shadow-md mt-2">
|
|
145
|
+
<div class="overflow-x-auto">
|
|
146
|
+
<table class="table">
|
|
147
|
+
<thead>
|
|
148
|
+
<tr>
|
|
149
|
+
<th>ID</th>
|
|
150
|
+
<th>Test Case</th>
|
|
151
|
+
</tr>
|
|
152
|
+
</thead>
|
|
153
|
+
<tbody>
|
|
154
|
+
{#each suite.tests as test}
|
|
155
|
+
<tr>
|
|
156
|
+
<th>
|
|
157
|
+
{#if Array.isArray(test.id)}
|
|
158
|
+
{#each test.id as testId}
|
|
159
|
+
<button
|
|
160
|
+
class="btn btn-active btn-ghost btn-xs mr-1"
|
|
161
|
+
on:click={() => copyIdToTextbox(testId)}
|
|
162
|
+
>
|
|
163
|
+
{testId}
|
|
164
|
+
</button>
|
|
165
|
+
{/each}
|
|
166
|
+
{:else}
|
|
167
|
+
<button
|
|
168
|
+
class="btn btn-active btn-ghost btn-xs"
|
|
169
|
+
on:click={() => copyIdToTextbox(test.id)}
|
|
170
|
+
>
|
|
171
|
+
{test.id}
|
|
172
|
+
</button>
|
|
173
|
+
{/if}
|
|
174
|
+
</th>
|
|
175
|
+
<td>{test.testCase}</td>
|
|
176
|
+
</tr>
|
|
177
|
+
{/each}
|
|
178
|
+
</tbody>
|
|
179
|
+
</table>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
{/each}
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|