ShadowWolf1999 commited on
Commit
0422b98
·
verified ·
1 Parent(s): 19c26ec

展示一个fsd下 有多少 testcase 能明确看出不同的case types, 以及不同的阶段。

Browse files
Files changed (4) hide show
  1. README.md +8 -5
  2. components/testcase-dashboard.js +267 -0
  3. index.html +21 -19
  4. style.css +21 -20
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Testcase Visualizer Pro
3
- emoji: 🐠
4
- colorFrom: green
5
- colorTo: red
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: TestCase Visualizer Pro 🧪
3
+ colorFrom: pink
4
+ colorTo: pink
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
components/testcase-dashboard.js ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class TestcaseDashboard extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ :host {
7
+ display: block;
8
+ font-family: 'Inter', sans-serif;
9
+ }
10
+
11
+ .header {
12
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
13
+ color: white;
14
+ }
15
+
16
+ .phase-tab {
17
+ transition: all 0.3s ease;
18
+ }
19
+
20
+ .phase-tab.active {
21
+ border-bottom: 3px solid #667eea;
22
+ color: #667eea;
23
+ font-weight: 600;
24
+ }
25
+ </style>
26
+
27
+ <div class="min-h-screen">
28
+ <!-- Header -->
29
+ <header class="header py-8 px-6 shadow-lg">
30
+ <div class="container mx-auto">
31
+ <div class="flex items-center justify-between">
32
+ <div>
33
+ <h1 class="text-3xl font-bold flex items-center">
34
+ <i data-feather="activity" class="mr-3"></i>
35
+ TestCase Visualizer Pro
36
+ </h1>
37
+ <p class="mt-2 opacity-90">Visualize your FSD test cases with clarity</p>
38
+ </div>
39
+ <div class="flex items-center space-x-4">
40
+ <button class="bg-white text-indigo-700 px-4 py-2 rounded-lg font-medium flex items-center">
41
+ <i data-feather="plus" class="mr-2"></i>
42
+ Add Test Case
43
+ </button>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </header>
48
+
49
+ <!-- Main Content -->
50
+ <main class="container mx-auto py-8 px-6">
51
+ <!-- Filters -->
52
+ <div class="bg-white rounded-xl shadow-md p-6 mb-8">
53
+ <div class="flex flex-wrap items-center justify-between gap-4">
54
+ <div class="flex items-center space-x-4">
55
+ <div>
56
+ <label class="block text-sm font-medium text-gray-700 mb-1">Test Type</label>
57
+ <select class="border border-gray-300 rounded-lg px-4 py-2 w-48">
58
+ <option>All Types</option>
59
+ <option>Unit Tests</option>
60
+ <option>Integration Tests</option>
61
+ <option>E2E Tests</option>
62
+ <option>Component Tests</option>
63
+ </select>
64
+ </div>
65
+
66
+ <div>
67
+ <label class="block text-sm font-medium text-gray-700 mb-1">Status</label>
68
+ <select class="border border-gray-300 rounded-lg px-4 py-2 w-48">
69
+ <option>All Statuses</option>
70
+ <option>Passed</option>
71
+ <option>Failed</option>
72
+ <option>Pending</option>
73
+ <option>Skipped</option>
74
+ </select>
75
+ </div>
76
+ </div>
77
+
78
+ <div class="flex items-center">
79
+ <button class="bg-indigo-600 text-white px-4 py-2 rounded-lg font-medium flex items-center">
80
+ <i data-feather="filter" class="mr-2"></i>
81
+ Apply Filters
82
+ </button>
83
+ </div>
84
+ </div>
85
+ </div>
86
+
87
+ <!-- Phase Tabs -->
88
+ <div class="flex border-b border-gray-200 mb-6">
89
+ <button class="phase-tab px-6 py-3 active">Design Phase</button>
90
+ <button class="phase-tab px-6 py-3">Development Phase</button>
91
+ <button class="phase-tab px-6 py-3">Testing Phase</button>
92
+ <button class="phase-tab px-6 py-3">Deployment Phase</button>
93
+ </div>
94
+
95
+ <!-- Test Case Stats -->
96
+ <div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-8">
97
+ <div class="bg-white rounded-xl shadow-md p-6">
98
+ <div class="flex items-center justify-between">
99
+ <div>
100
+ <p class="text-gray-500">Total Test Cases</p>
101
+ <h3 class="text-3xl font-bold mt-2">128</h3>
102
+ </div>
103
+ <div class="bg-indigo-100 p-3 rounded-full">
104
+ <i data-feather="list" class="text-indigo-600"></i>
105
+ </div>
106
+ </div>
107
+ </div>
108
+
109
+ <div class="bg-white rounded-xl shadow-md p-6">
110
+ <div class="flex items-center justify-between">
111
+ <div>
112
+ <p class="text-gray-500">Passed</p>
113
+ <h3 class="text-3xl font-bold mt-2 text-green-600">98</h3>
114
+ </div>
115
+ <div class="bg-green-100 p-3 rounded-full">
116
+ <i data-feather="check-circle" class="text-green-600"></i>
117
+ </div>
118
+ </div>
119
+ </div>
120
+
121
+ <div class="bg-white rounded-xl shadow-md p-6">
122
+ <div class="flex items-center justify-between">
123
+ <div>
124
+ <p class="text-gray-500">Failed</p>
125
+ <h3 class="text-3xl font-bold mt-2 text-red-600">12</h3>
126
+ </div>
127
+ <div class="bg-red-100 p-3 rounded-full">
128
+ <i data-feather="x-circle" class="text-red-600"></i>
129
+ </div>
130
+ </div>
131
+ </div>
132
+
133
+ <div class="bg-white rounded-xl shadow-md p-6">
134
+ <div class="flex items-center justify-between">
135
+ <div>
136
+ <p class="text-gray-500">Pending</p>
137
+ <h3 class="text-3xl font-bold mt-2 text-yellow-600">18</h3>
138
+ </div>
139
+ <div class="bg-yellow-100 p-3 rounded-full">
140
+ <i data-feather="clock" class="text-yellow-600"></i>
141
+ </div>
142
+ </div>
143
+ </div>
144
+ </div>
145
+
146
+ <!-- Test Case List -->
147
+ <div class="bg-white rounded-xl shadow-md overflow-hidden">
148
+ <div class="overflow-x-auto">
149
+ <table class="min-w-full divide-y divide-gray-200">
150
+ <thead class="bg-gray-50">
151
+ <tr>
152
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
153
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Test Case</th>
154
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Type</th>
155
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Phase</th>
156
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
157
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
158
+ </tr>
159
+ </thead>
160
+ <tbody class="bg-white divide-y divide-gray-200">
161
+ ${this.generateTestCases()}
162
+ </tbody>
163
+ </table>
164
+ </div>
165
+ </div>
166
+ </main>
167
+ </div>
168
+ `;
169
+
170
+ // Add event listeners for tabs
171
+ const tabs = this.shadowRoot.querySelectorAll('.phase-tab');
172
+ tabs.forEach(tab => {
173
+ tab.addEventListener('click', () => {
174
+ tabs.forEach(t => t.classList.remove('active'));
175
+ tab.classList.add('active');
176
+ });
177
+ });
178
+ }
179
+
180
+ generateTestCases() {
181
+ const testCases = [
182
+ {
183
+ id: 'TC-001',
184
+ name: 'User authentication validation',
185
+ type: 'Unit Test',
186
+ phase: 'Design',
187
+ status: 'Passed'
188
+ },
189
+ {
190
+ id: 'TC-002',
191
+ name: 'API endpoint response time',
192
+ type: 'Integration Test',
193
+ phase: 'Development',
194
+ status: 'Failed'
195
+ },
196
+ {
197
+ id: 'TC-003',
198
+ name: 'Checkout flow E2E',
199
+ type: 'E2E Test',
200
+ phase: 'Testing',
201
+ status: 'Pending'
202
+ },
203
+ {
204
+ id: 'TC-004',
205
+ name: 'UI component rendering',
206
+ type: 'Component Test',
207
+ phase: 'Design',
208
+ status: 'Passed'
209
+ },
210
+ {
211
+ id: 'TC-005',
212
+ name: 'Database migration',
213
+ type: 'Integration Test',
214
+ phase: 'Deployment',
215
+ status: 'Skipped'
216
+ }
217
+ ];
218
+
219
+ return testCases.map(testCase => `
220
+ <tr class="testcase-card hover:bg-gray-50">
221
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${testCase.id}</td>
222
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${testCase.name}</td>
223
+ <td class="px-6 py-4 whitespace-nowrap">
224
+ <span class="pill ${this.getTypeClass(testCase.type)}">
225
+ ${testCase.type}
226
+ </span>
227
+ </td>
228
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${testCase.phase}</td>
229
+ <td class="px-6 py-4 whitespace-nowrap">
230
+ <span class="pill ${this.getStatusClass(testCase.status)}">
231
+ ${testCase.status}
232
+ </span>
233
+ </td>
234
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
235
+ <button class="text-indigo-600 hover:text-indigo-900 mr-3">
236
+ <i data-feather="eye"></i>
237
+ </button>
238
+ <button class="text-gray-600 hover:text-gray-900">
239
+ <i data-feather="more-vertical"></i>
240
+ </button>
241
+ </td>
242
+ </tr>
243
+ `).join('');
244
+ }
245
+
246
+ getTypeClass(type) {
247
+ const classes = {
248
+ 'Unit Test': 'bg-blue-100 text-blue-800',
249
+ 'Integration Test': 'bg-purple-100 text-purple-800',
250
+ 'E2E Test': 'bg-green-100 text-green-800',
251
+ 'Component Test': 'bg-yellow-100 text-yellow-800'
252
+ };
253
+ return classes[type] || 'bg-gray-100 text-gray-800';
254
+ }
255
+
256
+ getStatusClass(status) {
257
+ const classes = {
258
+ 'Passed': 'bg-green-100 text-green-800',
259
+ 'Failed': 'bg-red-100 text-red-800',
260
+ 'Pending': 'bg-yellow-100 text-yellow-800',
261
+ 'Skipped': 'bg-gray-100 text-gray-800'
262
+ };
263
+ return classes[status] || 'bg-gray-100 text-gray-800';
264
+ }
265
+ }
266
+
267
+ customElements.define('testcase-dashboard', TestcaseDashboard);
index.html CHANGED
@@ -1,19 +1,21 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>TestCase Visualizer Pro</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://unpkg.com/feather-icons"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <link rel="stylesheet" href="style.css">
11
+ </head>
12
+ <body class="bg-gray-50">
13
+ <testcase-dashboard></testcase-dashboard>
14
+
15
+ <script src="components/testcase-dashboard.js"></script>
16
+ <script>
17
+ feather.replace();
18
+ </script>
19
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
20
+ </body>
21
+ </html>
style.css CHANGED
@@ -1,28 +1,29 @@
1
- body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
 
 
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
28
- }
 
1
+ /* Custom styles for test case visualization */
2
+ .testcase-card {
3
+ transition: all 0.3s ease;
4
  }
5
 
6
+ .testcase-card:hover {
7
+ transform: translateY(-5px);
8
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
9
  }
10
 
11
+ .pill {
12
+ font-size: 0.75rem;
13
+ padding: 0.25rem 0.75rem;
14
+ border-radius: 9999px;
 
15
  }
16
 
17
+ /* Animation for test case status */
18
+ @keyframes pulse {
19
+ 0%, 100% {
20
+ opacity: 1;
21
+ }
22
+ 50% {
23
+ opacity: 0.5;
24
+ }
25
  }
26
 
27
+ .pulse-animation {
28
+ animation: pulse 2s infinite;
29
+ }