ortoni-report 1.1.1 → 1.1.2

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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ortoni-report",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Playwright Report By LetCode with Koushik",
5
5
  "scripts": {
6
6
  "test": "npx playwright test",
@@ -22,7 +22,8 @@
22
22
  "playwright letcode",
23
23
  "letcode koushik",
24
24
  "ortoni report",
25
- "ortoni"
25
+ "ortoni-report",
26
+ "playwright html"
26
27
  ],
27
28
  "author": "Koushik Chatterjee (LetCode with Koushik)",
28
29
  "license": "GPL-3.0-only",
@@ -37,7 +38,6 @@
37
38
  "rimraf": "^5.0.7"
38
39
  },
39
40
  "devDependencies": {
40
- "@changesets/cli": "^2.26.0",
41
41
  "@playwright/test": "^1.44.1",
42
42
  "@types/node": "^20.14.2",
43
43
  "tsup": "^6.5.0",
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/f96b7697-8ec0-4c6d-a681-b305e6d5843a)
8
9
 
9
10
  ## Features
10
11
 
@@ -53,7 +54,7 @@ These features collectively enhance the readability, usability, and accessibilit
53
54
  ```JS/TS
54
55
  reporter: [["ortoni-report",
55
56
  {
56
- projectName: 'Plawright Sample',
57
+ projectName: 'LetCode Playwright Report',
57
58
  authorName: 'Koushik',
58
59
  testType: 'E2E'
59
60
  }],
@@ -86,12 +87,11 @@ Configure OrtoniReport in your `playwright.config.ts`:
86
87
 
87
88
  ``` javascript/typescript
88
89
  import { defineConfig } from '@playwright/test';
89
- import OrtoniReport from 'ortoni-report';
90
90
 
91
91
  export default defineConfig({
92
92
  reporter: [["ortoni-report",
93
93
  {
94
- projectName: 'Plawright Sample',
94
+ projectName: 'LetCode Playwright Report',
95
95
  authorName: 'Koushik',
96
96
  testType: 'E2E'
97
97
  }],