ortoni-report 1.0.9 → 1.1.0

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/changelog.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Change Log:
2
2
 
3
+ ### Version 1.1.0
4
+
5
+ ## New Features
6
+ - **Search Functionality:**
7
+ - Added a search bar to filter tests by their title.
8
+ - Display the relevant test name, project, and test file name while hiding others during search.
9
+ - Reset search form to show all tests when cleared.
10
+
11
+ ## Improvements
12
+ - **Page Zoom:**
13
+ - Set the HTML page zoom to 90% for better display on different screen sizes.
14
+
15
+ ## Bug Fixes
16
+ - **Event Listeners:**
17
+ - Fixed an issue where test details would not display when clicking on filtered search results.
18
+ - Ensured event listeners are correctly reattached after filtering search results.
19
+
20
+ ## Style Adjustments
21
+ - **CSS Adjustments:**
22
+ - Adjusted body zoom for better overall display: `body { zoom: 0.9; }`
23
+
24
+ ---
25
+
26
+ ### Instructions for Users
27
+ - Use the search bar to quickly find specific tests by their title.
28
+ - Clear the search input to reset the view and display all tests.
29
+ - Note that the page zoom has been set to 90% for optimal display.
30
+
3
31
  ### Version 1.0.9
4
32
 
5
33
  **Added:**
@@ -145,7 +145,7 @@ var OrtoniReport = class {
145
145
  suiteName: this.suiteName,
146
146
  results: this.results,
147
147
  passCount: this.results.filter((r) => r.status === "passed").length,
148
- failCount: this.results.filter((r) => r.status === "failed").length,
148
+ failCount: this.results.filter((r) => r.status === "failed" || r.status === "timedOut").length,
149
149
  skipCount: this.results.filter((r) => r.status === "skipped").length,
150
150
  flakyCount: this.results.filter((r) => r.flaky === "flaky").length,
151
151
  totalCount: this.results.length,
@@ -111,7 +111,7 @@ var OrtoniReport = class {
111
111
  suiteName: this.suiteName,
112
112
  results: this.results,
113
113
  passCount: this.results.filter((r) => r.status === "passed").length,
114
- failCount: this.results.filter((r) => r.status === "failed").length,
114
+ failCount: this.results.filter((r) => r.status === "failed" || r.status === "timedOut").length,
115
115
  skipCount: this.results.filter((r) => r.status === "skipped").length,
116
116
  flakyCount: this.results.filter((r) => r.flaky === "flaky").length,
117
117
  totalCount: this.results.length,
@@ -5,10 +5,13 @@
5
5
  <meta charset="UTF-8">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
7
  <title>Playwright Test Report</title>
8
- <link rel="icon" href="node_modules/ortoni-report/dist/icon/32.png" type="image/x-icon">
9
- <link rel="stylesheet" href="node_modules/ortoni-report/dist/css/pico.css">
10
- {{!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.0/chart.min.css"> --}}
8
+ <link rel="icon" href="node_modules\ortoni-report\src\icon\32.png" type="image/x-icon">
9
+ <link rel="stylesheet" href="node_modules\ortoni-report\src\css\pico.css">
11
10
  <style>
11
+ body {
12
+ zoom: 0.9;
13
+ }
14
+
12
15
  main.container {
13
16
  display: grid;
14
17
  grid-template-columns: 1fr 2fr;
@@ -26,7 +29,7 @@
26
29
  }
27
30
 
28
31
  .highlight {
29
- background-color: var(--pico-primary-background)
32
+ background-color: var(--pico-primary-background);
30
33
  }
31
34
 
32
35
  .text-success {
@@ -73,10 +76,7 @@
73
76
  </div>
74
77
  {{!-- Dummy for now --}}
75
78
  <div>
76
- <form role="search">
77
- <input name="search" type="search" placeholder="Search" />
78
- <input type="submit" value="Search" />
79
- </form>
79
+ <input name="search" type="search" placeholder="Search by test title" />
80
80
  </div>
81
81
  </div>
82
82
  </header>
@@ -84,7 +84,7 @@
84
84
  {{!-- Test Scripts --}}
85
85
  <aside class="sidebar">
86
86
  <h2>Tests</h2>
87
- <div class="">
87
+ <div>
88
88
  {{#each groupedResults}}
89
89
  <details>
90
90
  <summary>{{@key}}</summary>
@@ -195,18 +195,15 @@
195
195
  const testDetails = document.getElementById('testDetails');
196
196
  const summary = document.getElementById('summary');
197
197
  const backButton = document.querySelector('.back-button');
198
- const testItems = document.querySelectorAll('[data-test-id]');
199
- const searchInput = document.querySelector('input[name="search"]');
200
- const searchForm = document.querySelector('form[role="search"]');
198
+ let highlightedItem = null;
201
199
 
202
200
  function showSummary() {
203
201
  summary.style.display = 'block';
204
202
  testDetails.style.display = 'none';
205
203
  backButton.style.display = 'none';
206
- clearHighlights();
207
- }
208
- function clearHighlights() {
209
- testItems.forEach(item => item.classList.remove('highlight'));
204
+ if (highlightedItem) {
205
+ highlightedItem.classList.remove('highlight');
206
+ }
210
207
  }
211
208
 
212
209
  window.showSummary = showSummary;
@@ -236,53 +233,75 @@
236
233
  <div>
237
234
  ${test.errors.length ? `
238
235
  <h4>Errors</h4>
239
- <pre>${escapeHtml(test.errors.join('\n'))}</pre>
236
+ <div class="grid">
237
+ <pre>${escapeHtml(test.errors.join('\n'))}</pre></div>
240
238
  ` : ''}
241
239
  </div>
242
240
  <div>
243
241
  ${test.logs ? `
244
242
  <h4>Logs</h4>
245
- <pre>${escapeHtml(test.logs)}</pre>
243
+ <div class="grid">
244
+ <pre>${escapeHtml(test.logs)}</pre></div>
246
245
  ` : ''}
247
246
  </div>
248
- `;
247
+ `;
249
248
  }
250
-
251
- function searchTests(query) {
252
- const lowerCaseQuery = query.toLowerCase();
253
- if (lowerCaseQuery === '') {
254
- testItems.forEach(item => {
255
- item.style.display = 'block';
256
- });
257
- } else {
258
- testItems.forEach(item => {
259
- const title = item.textContent.toLowerCase();
260
- if (title.includes(lowerCaseQuery)) {
261
- item.style.display = 'block';
262
- } else {
263
- item.style.display = 'none';
249
+
250
+ function attachEventListeners() {
251
+ const testItems = document.querySelectorAll('[data-test-id]');
252
+ testItems.forEach(item => {
253
+ item.addEventListener('click', () => {
254
+ const testId = item.getAttribute('data-test-id');
255
+ const test = testData[testId];
256
+ displayTestDetails(test);
257
+ if (highlightedItem) {
258
+ highlightedItem.classList.remove('highlight');
264
259
  }
260
+ item.classList.add('highlight');
261
+ highlightedItem = item;
265
262
  });
266
- }
263
+ });
267
264
  }
268
265
 
269
- searchForm.addEventListener('submit', event => {
270
- event.preventDefault();
271
- searchTests(searchInput.value);
272
- });
266
+ attachEventListeners(); // Attach event listeners initially
267
+
268
+ const searchInput = document.querySelector('input[name="search"]');
269
+ const detailsElements = document.querySelectorAll('details');
270
+
273
271
  searchInput.addEventListener('input', () => {
274
- searchTests(searchInput.value);
275
- });
272
+ const searchTerm = searchInput.value.toLowerCase();
273
+ const testItems = document.querySelectorAll('[data-test-id]');
274
+
275
+ if (searchTerm) {
276
+ detailsElements.forEach(detail => {
277
+ detail.open = false; // Collapse all details initially
278
+ });
276
279
 
280
+ testItems.forEach(item => {
281
+ const testTitle = item.textContent.toLowerCase();
282
+ if (testTitle.includes(searchTerm)) {
283
+ item.style.display = 'block'; // Show matching test item
277
284
 
278
- testItems.forEach(item => {
279
- item.addEventListener('click', () => {
280
- const testId = item.getAttribute('data-test-id');
281
- const test = testData[testId];
282
- displayTestDetails(test);
283
- clearHighlights();
284
- item.classList.add('highlight');
285
- });
285
+ let parent = item.parentElement;
286
+ while (parent && parent.tagName !== 'ASIDE') {
287
+ if (parent.tagName === 'DETAILS') {
288
+ parent.open = true; // Expand parent details elements
289
+ }
290
+ parent = parent.parentElement;
291
+ }
292
+ } else {
293
+ item.style.display = 'none'; // Hide non-matching test item
294
+ }
295
+ });
296
+ } else {
297
+ testItems.forEach(item => {
298
+ item.style.display = 'block'; // Show all test items
299
+ });
300
+ detailsElements.forEach(detail => {
301
+ detail.open = false; // Collapse all details elements
302
+ });
303
+ }
304
+ attachEventListeners(); // Reattach event listeners after filtering
286
305
  });
287
306
 
288
307
  const ctx = document.getElementById('testChart').getContext('2d');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ortoni-report",
3
- "version": "1.0.9",
3
+ "version": "1.1.0",
4
4
  "description": "Playwright Report By LetCode with Koushik",
5
5
  "scripts": {
6
6
  "test": "npx playwright test",