ortoni-report 1.1.1 → 1.1.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.
@@ -0,0 +1,76 @@
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();
35
+ }
36
+
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);
47
+ }
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);
56
+ }
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
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.formatDate = exports.normalizeFilePath = exports.msToTime = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ function msToTime(duration) {
9
+ const milliseconds = Math.floor((duration % 1000));
10
+ const seconds = Math.floor((duration / 1000) % 60);
11
+ const minutes = Math.floor((duration / (1000 * 60)) % 60);
12
+ const hours = Math.floor((duration / (1000 * 60 * 60)) % 24);
13
+ let result = '';
14
+ if (hours > 0) {
15
+ result += (hours < 10 ? "0" + hours : hours) + "h:";
16
+ }
17
+ if (minutes > 0 || hours > 0) { // Include minutes if hours are included
18
+ result += (minutes < 10 ? "0" + minutes : minutes) + "m:";
19
+ }
20
+ if (seconds > 0 || minutes > 0 || hours > 0) { // Include seconds if minutes or hours are included
21
+ result += (seconds < 10 ? "0" + seconds : seconds) + "s";
22
+ }
23
+ if (milliseconds > 0) {
24
+ result += ":" + (milliseconds < 100 ? "0" + milliseconds : milliseconds) + "ms";
25
+ }
26
+ return result;
27
+ }
28
+ exports.msToTime = msToTime;
29
+ function normalizeFilePath(filePath) {
30
+ // Normalize the path to handle different separators
31
+ const normalizedPath = path_1.default.normalize(filePath);
32
+ // Get the base name of the file (removes any leading directories)
33
+ return path_1.default.basename(normalizedPath);
34
+ }
35
+ exports.normalizeFilePath = normalizeFilePath;
36
+ function formatDate(date) {
37
+ const day = String(date.getDate()).padStart(2, '0');
38
+ const month = date.toLocaleString('default', { month: 'short' });
39
+ const year = date.getFullYear();
40
+ const time = date.toLocaleTimeString();
41
+ return `${day}-${month}-${year} ${time}`;
42
+ }
43
+ exports.formatDate = formatDate;
44
+ ;
package/package.json CHANGED
@@ -1,49 +1,47 @@
1
- {
2
- "name": "ortoni-report",
3
- "version": "1.1.1",
4
- "description": "Playwright Report By LetCode with Koushik",
5
- "scripts": {
6
- "test": "npx playwright test",
7
- "build": "tsup",
8
- "release": "npm publish",
9
- "lint": "tsc"
10
- },
11
- "files": [
12
- "dist",
13
- "README.md",
14
- "CHANGELOG.md"
15
- ],
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/ortoniKC/ortoni-report"
19
- },
20
- "keywords": [
21
- "playwright report",
22
- "playwright letcode",
23
- "letcode koushik",
24
- "ortoni report",
25
- "ortoni"
26
- ],
27
- "author": "Koushik Chatterjee (LetCode with Koushik)",
28
- "license": "GPL-3.0-only",
29
- "bugs": {
30
- "url": "https://github.com/ortoniKC/ortoni-report/issues"
31
- },
32
- "homepage": "https://github.com/ortoniKC/ortoni-report#readme",
33
- "dependencies": {
34
- "colors": "^1.4.0",
35
- "handlebars": "^4.7.8",
36
- "hiq": "^4.2.3",
37
- "rimraf": "^5.0.7"
38
- },
39
- "devDependencies": {
40
- "@changesets/cli": "^2.26.0",
41
- "@playwright/test": "^1.44.1",
42
- "@types/node": "^20.14.2",
43
- "tsup": "^6.5.0",
44
- "typescript": "^4.9.4"
45
- },
46
- "main": "dist/ortoni-report.js",
47
- "module": "dist/ortoni-report.mjs",
48
- "types": "dist/ortoni-report.d.ts"
49
- }
1
+ {
2
+ "name": "ortoni-report",
3
+ "version": "1.1.3",
4
+ "description": "Playwright Report By LetCode with Koushik",
5
+ "scripts": {
6
+ "test": "npx playwright test",
7
+ "build": "tsup",
8
+ "release": "npm publish",
9
+ "lint": "tsc"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "README.md",
14
+ "CHANGELOG.md"
15
+ ],
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/ortoniKC/ortoni-report"
19
+ },
20
+ "keywords": [
21
+ "playwright report",
22
+ "playwright letcode",
23
+ "letcode koushik",
24
+ "ortoni report",
25
+ "ortoni-report",
26
+ "playwright html"
27
+ ],
28
+ "author": "Koushik Chatterjee (LetCode with Koushik)",
29
+ "license": "GPL-3.0-only",
30
+ "bugs": {
31
+ "url": "https://github.com/ortoniKC/ortoni-report/issues"
32
+ },
33
+ "homepage": "https://github.com/ortoniKC/ortoni-report#readme",
34
+ "dependencies": {
35
+ "colors": "^1.4.0",
36
+ "handlebars": "^4.7.8"
37
+ },
38
+ "devDependencies": {
39
+ "@playwright/test": "^1.44.1",
40
+ "@types/node": "^20.14.2",
41
+ "tsup": "^6.5.0",
42
+ "typescript": "^4.9.4"
43
+ },
44
+ "main": "dist/ortoni-report.js",
45
+ "module": "dist/ortoni-report.mjs",
46
+ "types": "dist/ortoni-report.d.ts"
47
+ }
package/readme.md CHANGED
@@ -2,9 +2,10 @@
2
2
 
3
3
  We are excited to announce the release of OrtoniReport (Playwright report - unofficial), a powerful and customizable HTML report generator for Playwright tests. This release includes key features that enhance the reporting capabilities and make it easier to visualize and organize test results.
4
4
 
5
- ![Report](https://github.com/ortoniKC/ortoni-report/assets/58769833/da8c6b65-5f35-4fad-802a-039a72999cb1)
5
+ [Click here to check the live Demo](https://ortoni.netlify.app/)
6
6
 
7
7
 
8
+ ![Ortoni Report](https://github.com/ortoniKC/ortoni-report/assets/58769833/88237970-b97f-4339-94cd-a1e4f3488b10)
8
9
 
9
10
  ## Features
10
11
 
@@ -20,9 +21,10 @@ We are excited to announce the release of OrtoniReport (Playwright report - unof
20
21
 
21
22
  4. **Summary Statistics:**
22
23
  - Provide summary statistics for total tests, passed tests, failed tests, skipped tests, and flaky tests.
24
+ - Success Rate of test suite.
23
25
 
24
26
  5. **Chart Visualization:**
25
- - Visualize test results using a doughnut chart to represent the distribution of passed, failed, and skipped tests.
27
+ - Visualize test results using a doughnut chart to represent the distribution of passed, failed, skipped and flaky tests.
26
28
 
27
29
  6. **Project Information:**
28
30
  - Include project name, author name, and test type information in the report.
@@ -46,6 +48,14 @@ We are excited to announce the release of OrtoniReport (Playwright report - unof
46
48
  12. **Ease of Use:**
47
49
  - Enable easy navigation between test results and summary sections.
48
50
 
51
+ 13. **Success Rate**
52
+ - 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
+ - Success Rate Formula
54
+ The success rate (successRate) is calculated using the following formula:
55
+ ```
56
+ const successRate: string = (((passedTests + flakyTests) / totalTests) * 100).toFixed(2);
57
+ ```
58
+
49
59
  These features collectively enhance the readability, usability, and accessibility of the test report, providing valuable insights into test execution and results.
50
60
 
51
61
  ### Configurable Report Generation
@@ -53,7 +63,7 @@ These features collectively enhance the readability, usability, and accessibilit
53
63
  ```JS/TS
54
64
  reporter: [["ortoni-report",
55
65
  {
56
- projectName: 'Plawright Sample',
66
+ projectName: 'LetCode Playwright Report',
57
67
  authorName: 'Koushik',
58
68
  testType: 'E2E'
59
69
  }],
@@ -86,12 +96,11 @@ Configure OrtoniReport in your `playwright.config.ts`:
86
96
 
87
97
  ``` javascript/typescript
88
98
  import { defineConfig } from '@playwright/test';
89
- import OrtoniReport from 'ortoni-report';
90
99
 
91
100
  export default defineConfig({
92
101
  reporter: [["ortoni-report",
93
102
  {
94
- projectName: 'Plawright Sample',
103
+ projectName: 'LetCode Playwright Report',
95
104
  authorName: 'Koushik',
96
105
  testType: 'E2E'
97
106
  }],
@@ -124,4 +133,4 @@ Thank you for using OrtoniReport! We hope it significantly enhances your Playwri
124
133
 
125
134
  ---
126
135
 
127
- **LetCode with Koushik**
136
+ **LetCode with Koushik**