ortoni-report 1.1.3 → 1.1.5

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.
@@ -1,76 +1,16 @@
1
- const isOpenClass = "modal-is-open";
2
- const openingClass = "modal-is-opening";
3
- const closingClass = "modal-is-closing";
4
- const scrollbarWidthCssVar = "--pico-scrollbar-width";
5
- const animationDuration = 400; // ms
6
- let visibleModal = null;
7
-
8
- // Toggle modal
9
- function toggleModal(event) {
10
- event.preventDefault();
11
- const modal = document.getElementById(event.currentTarget.dataset.target);
12
- if (!modal) return;
13
- if (modal) {
14
- if (modal.open) {
15
- closeModal(modal);
16
- } else {
17
- openModal(modal);
18
- }
19
- }
20
- }
21
-
22
- // Open modal
23
- function openModal(modal) {
24
- const html = document.documentElement;
25
- const scrollbarWidth = getScrollbarWidth();
26
- if (scrollbarWidth) {
27
- html.style.setProperty(scrollbarWidthCssVar, `${scrollbarWidth}px`);
28
- }
29
- html.classList.add(isOpenClass, openingClass);
30
- setTimeout(function () {
31
- visibleModal = modal;
32
- html.classList.remove(openingClass);
33
- }, animationDuration);
34
- modal.showModal();
1
+ // Functions to open and close a modal
2
+ function openModal() {
3
+ let modal = document.getElementsByClassName("modal")[0];
4
+ modal.classList.add("is-active")
35
5
  }
36
6
 
37
- // Close modal
38
- function closeModal(modal) {
39
- visibleModal = null;
40
- const html = document.documentElement;
41
- html.classList.add(closingClass);
42
- setTimeout(function () {
43
- html.classList.remove(closingClass, isOpenClass);
44
- html.style.removeProperty(scrollbarWidthCssVar);
45
- modal.close();
46
- }, animationDuration);
7
+ function closeModal() {
8
+ let modal = document.getElementsByClassName("modal")[0];
9
+ modal.classList.remove("is-active")
47
10
  }
48
-
49
- // Close with a click outside
50
- document.addEventListener("click", function (event) {
51
- if (visibleModal === null) return;
52
- const modalContent = visibleModal.querySelector("article");
53
- const isClickInside = modalContent.contains(event.target);
54
- if (!isClickInside) {
55
- closeModal(visibleModal);
11
+ // Add a keyboard event to close all modals
12
+ document.addEventListener('keydown', (event) => {
13
+ if (event.key === "Escape") {
14
+ closeModal();
56
15
  }
57
- });
58
-
59
- // Close with Esc key
60
- document.addEventListener("keydown", function (event) {
61
- if (event.key === "Escape" && visibleModal) {
62
- closeModal(visibleModal);
63
- }
64
- });
65
-
66
- // Get scrollbar width
67
- function getScrollbarWidth() {
68
- const scrollbarWidth =
69
- window.innerWidth - document.documentElement.clientWidth;
70
- return scrollbarWidth;
71
- }
72
-
73
- // Is scrollbar visible
74
- function isScrollbarVisible() {
75
- return document.body.scrollHeight > screen.height;
76
- }
16
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ortoni-report",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Playwright Report By LetCode with Koushik",
5
5
  "scripts": {
6
6
  "test": "npx playwright test",
package/readme.md CHANGED
@@ -4,81 +4,97 @@ We are excited to announce the release of OrtoniReport (Playwright report - unof
4
4
 
5
5
  [Click here to check the live Demo](https://ortoni.netlify.app/)
6
6
 
7
-
8
- ![Ortoni Report](https://github.com/ortoniKC/ortoni-report/assets/58769833/88237970-b97f-4339-94cd-a1e4f3488b10)
7
+ ![Ortoni-Report](https://github.com/ortoniKC/ortoni-report/assets/58769833/e88f33d4-eb5c-41c7-b90a-f8a283af0058)
9
8
 
10
9
  ## Features
11
10
 
12
- 1. **Hierarchical Grouping:**
11
+ 1. **Hierarchical Grouping:**
12
+
13
13
  - Test results are now grouped hierarchically by file name, suite name, and project name, allowing for a clear and organized view of your test structure.
14
-
14
+
15
15
  2. **Detailed Breakdown:**
16
+
16
17
  - Each suite displays a sub-category for project names, with individual test cases listed under their respective projects.
17
18
 
18
19
  3. **Test Result Display:**
19
- - Display results including status (passed, failed, skipped), duration, errors, logs, and screenshots.
20
+
21
+ - Display results including status (passed, failed, skipped), duration, errors, logs, and screenshots.
20
22
  - Organize test results by suite, project, and test script.
21
23
 
22
24
  4. **Summary Statistics:**
25
+
23
26
  - Provide summary statistics for total tests, passed tests, failed tests, skipped tests, and flaky tests.
24
27
  - Success Rate of test suite.
25
28
 
26
29
  5. **Chart Visualization:**
30
+
27
31
  - Visualize test results using a doughnut chart to represent the distribution of passed, failed, skipped and flaky tests.
28
32
 
29
33
  6. **Project Information:**
34
+
30
35
  - Include project name, author name, and test type information in the report.
31
36
 
32
37
  7. **Search Functionality:**
38
+
33
39
  - Search bar to filter and display specific tests based on user input.
34
40
 
35
41
  8. **Reset Functionality:**
42
+
36
43
  - Allow users to reset the search bar to show all tests when cleared.
37
44
 
38
45
  9. **Customization:**
46
+
39
47
  - Customize project name, author name, and test type displayed in the report.
40
- - Dark/Light theme based on the user browser/system setting.
48
+ - Dark/Light theme based on the user toggle.
41
49
 
42
50
  10. **Responsive Design:**
51
+
43
52
  - Design the report layout to be responsive and adaptable to different screen sizes.
44
53
 
45
54
  11. **Accessibility:**
55
+
46
56
  - Ensure accessibility by providing appropriate HTML attributes and semantic structure.
47
57
 
48
58
  12. **Ease of Use:**
59
+
49
60
  - Enable easy navigation between test results and summary sections.
50
61
 
51
62
  13. **Success Rate**
52
63
  - The success rate in this project is calculated based on the outcomes of the tests executed using Playwright. The calculation considers tests that pass initially as well as tests that initially fail but pass upon retry
53
64
  - Success Rate Formula
54
- The success rate (successRate) is calculated using the following formula:
65
+ The success rate (successRate) is calculated using the following formula:
55
66
  ```
56
67
  const successRate: string = (((passedTests + flakyTests) / totalTests) * 100).toFixed(2);
57
68
  ```
69
+ 14. **Project Filtering**: Implemented filtering of tests by projects (e.g., chromium, firefox) to streamline test result views.
58
70
 
59
- These features collectively enhance the readability, usability, and accessibility of the test report, providing valuable insights into test execution and results.
71
+ 15. **Screenshots**: Implemented screenshot attachment as base64 images for enhanced report details
72
+
73
+ These features collectively enhance the readability, usability, and accessibility of the test report, providing valuable insights into test execution and results.
60
74
 
61
75
  ### Configurable Report Generation
76
+
62
77
  - **Flexible Configuration:** The reporter can be easily configured within your Playwright configuration file. Example:
63
78
  ```JS/TS
64
- reporter: [["ortoni-report",
65
- {
66
- projectName: 'LetCode Playwright Report',
67
- authorName: 'Koushik',
68
- testType: 'E2E'
69
- }],
70
- ["dot"]],
79
+ import {OrtoniReportConfig} from "ortoni-report";
80
+ const reportConfig: OrtoniReportConfig = {
81
+ projectName: "Ortoni",
82
+ testType: "Regression",
83
+ authorName: "Koushik",
84
+ preferredTheme: "light"
85
+ };
86
+
87
+ reporter: [["ortoni-report", reportConfig],
88
+ ["dot"]],
71
89
  ```
72
90
 
73
- ### Screenshot Handling
74
- - **Screenshot Storage:** Screenshots are now saved in a structured directory within the root of your project, ensuring that visual evidence is easily accessible.
75
- - **Automatic Directory Creation:** The reporter automatically creates necessary directories for storing screenshots.
76
-
77
91
  ### Comprehensive Test Details
92
+
78
93
  - **Rich Test Information:** Each test result includes the test title, status, duration, errors, steps, logs, and screenshot paths.
79
94
  - **Color-coded Status:** Test statuses are color-coded (green for passed, red for failed, yellow for skipped) for quick visual identification.
80
95
 
81
96
  ### Handlebars Template Integration
97
+
82
98
  - **Customizable Reports:** The HTML report is generated using Handlebars templates, allowing for easy customization and styling.
83
99
  - **JSON Helper:** A custom Handlebars helper for JSON stringification is included to handle complex data structures.
84
100
 
@@ -94,17 +110,18 @@ npm install ortoni-report
94
110
 
95
111
  Configure OrtoniReport in your `playwright.config.ts`:
96
112
 
97
- ``` javascript/typescript
113
+ ```javascript/typescript
98
114
  import { defineConfig } from '@playwright/test';
99
-
115
+ import {OrtoniReportConfig} from "ortoni-report";
116
+ const reportConfig: OrtoniReportConfig = {
117
+ projectName: "Ortoni",
118
+ testType: "Regression",
119
+ authorName: "Koushik",
120
+ preferredTheme: "light"
121
+ };
100
122
  export default defineConfig({
101
- reporter: [["ortoni-report",
102
- {
103
- projectName: 'LetCode Playwright Report',
104
- authorName: 'Koushik',
105
- testType: 'E2E'
106
- }],
107
- ["dot"]],
123
+ reporter: [["ortoni-report", reportConfig],
124
+ ["dot"]],
108
125
  // Other Playwright configurations
109
126
  });
110
127
  ```
@@ -120,9 +137,11 @@ export default defineConfig({
120
137
  - **Advanced Filtering:** Additional filtering options to allow users to focus on specific subsets of test results.
121
138
 
122
139
  ## Change Logs:
140
+
123
141
  [log](https://github.com/ortoniKC/ortoni-report/blob/main/changelog.md)
124
142
 
125
143
  ## License:
144
+
126
145
  [LICENSE](https://github.com/ortoniKC/ortoni-report/blob/main/LICENSE.md)
127
146
 
128
147
  ## Feedback and Contributions
@@ -133,4 +152,4 @@ Thank you for using OrtoniReport! We hope it significantly enhances your Playwri
133
152
 
134
153
  ---
135
154
 
136
- **LetCode with Koushik**
155
+ **LetCode with Koushik**