ortoni-report 1.0.5 → 1.0.6

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.
@@ -43,7 +43,7 @@ var OrtoniReport = class {
43
43
  }
44
44
  onBegin(config, suite) {
45
45
  this.results = [];
46
- const screenshotsDir = import_path.default.join(__dirname, "screenshots");
46
+ const screenshotsDir = import_path.default.join(process.cwd(), "screenshots");
47
47
  if (!import_fs.default.existsSync(screenshotsDir)) {
48
48
  import_fs.default.mkdirSync(screenshotsDir);
49
49
  }
@@ -71,7 +71,7 @@ var OrtoniReport = class {
71
71
  filePath: test.titlePath()[2]
72
72
  };
73
73
  if (result.attachments) {
74
- const screenshotsDir = import_path.default.join(__dirname, "screenshots\\" + test.id);
74
+ const screenshotsDir = import_path.default.join(process.cwd(), "screenshots\\" + test.id);
75
75
  if (!import_fs.default.existsSync(screenshotsDir)) {
76
76
  import_fs.default.mkdirSync(screenshotsDir);
77
77
  }
@@ -79,7 +79,7 @@ var OrtoniReport = class {
79
79
  if (screenshot && screenshot.path) {
80
80
  const screenshotContent = import_fs.default.readFileSync(screenshot.path, "base64");
81
81
  const screenshotFileName = `screenshots/${test.id}/${import_path.default.basename(screenshot.path)}`;
82
- import_fs.default.writeFileSync(import_path.default.join(__dirname, screenshotFileName), screenshotContent, "base64");
82
+ import_fs.default.writeFileSync(import_path.default.join(process.cwd(), screenshotFileName), screenshotContent, "base64");
83
83
  testResult.screenshotPath = screenshotFileName;
84
84
  }
85
85
  }
@@ -109,12 +109,12 @@ var OrtoniReport = class {
109
109
  return suiteName.split(" - ");
110
110
  });
111
111
  const html = this.generateHTML();
112
- const outputPath = import_path.default.join(__dirname, "ortoni-report.html");
112
+ const outputPath = import_path.default.join(process.cwd(), "ortoni-report.html");
113
113
  import_fs.default.writeFileSync(outputPath, html);
114
114
  console.log(`Ortoni HTML report generated at ${outputPath}`);
115
115
  }
116
116
  generateHTML() {
117
- const templateSource = import_fs.default.readFileSync(import_path.default.join(__dirname, "report-template.hbs"), "utf-8");
117
+ const templateSource = import_fs.default.readFileSync(import_path.default.join(process.cwd(), "report-template.hbs"), "utf-8");
118
118
  const template = import_handlebars.default.compile(templateSource);
119
119
  const data = {
120
120
  suiteName: this.suiteName,
@@ -9,7 +9,7 @@ var OrtoniReport = class {
9
9
  }
10
10
  onBegin(config, suite) {
11
11
  this.results = [];
12
- const screenshotsDir = path.join(__dirname, "screenshots");
12
+ const screenshotsDir = path.join(process.cwd(), "screenshots");
13
13
  if (!fs.existsSync(screenshotsDir)) {
14
14
  fs.mkdirSync(screenshotsDir);
15
15
  }
@@ -37,7 +37,7 @@ var OrtoniReport = class {
37
37
  filePath: test.titlePath()[2]
38
38
  };
39
39
  if (result.attachments) {
40
- const screenshotsDir = path.join(__dirname, "screenshots\\" + test.id);
40
+ const screenshotsDir = path.join(process.cwd(), "screenshots\\" + test.id);
41
41
  if (!fs.existsSync(screenshotsDir)) {
42
42
  fs.mkdirSync(screenshotsDir);
43
43
  }
@@ -45,7 +45,7 @@ var OrtoniReport = class {
45
45
  if (screenshot && screenshot.path) {
46
46
  const screenshotContent = fs.readFileSync(screenshot.path, "base64");
47
47
  const screenshotFileName = `screenshots/${test.id}/${path.basename(screenshot.path)}`;
48
- fs.writeFileSync(path.join(__dirname, screenshotFileName), screenshotContent, "base64");
48
+ fs.writeFileSync(path.join(process.cwd(), screenshotFileName), screenshotContent, "base64");
49
49
  testResult.screenshotPath = screenshotFileName;
50
50
  }
51
51
  }
@@ -75,12 +75,12 @@ var OrtoniReport = class {
75
75
  return suiteName.split(" - ");
76
76
  });
77
77
  const html = this.generateHTML();
78
- const outputPath = path.join(__dirname, "ortoni-report.html");
78
+ const outputPath = path.join(process.cwd(), "ortoni-report.html");
79
79
  fs.writeFileSync(outputPath, html);
80
80
  console.log(`Ortoni HTML report generated at ${outputPath}`);
81
81
  }
82
82
  generateHTML() {
83
- const templateSource = fs.readFileSync(path.join(__dirname, "report-template.hbs"), "utf-8");
83
+ const templateSource = fs.readFileSync(path.join(process.cwd(), "report-template.hbs"), "utf-8");
84
84
  const template = Handlebars.compile(templateSource);
85
85
  const data = {
86
86
  suiteName: this.suiteName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ortoni-report",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Playwright Report By LetCode Koushik",
5
5
  "scripts": {
6
6
  "build": "tsup",
package/readme.md ADDED
@@ -0,0 +1,77 @@
1
+ # Release Notes: OrtoniReport v1.0.5
2
+
3
+ ## Introduction
4
+
5
+ We are excited to announce the release of OrtoniReport v1.0.0, 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.
6
+
7
+ ## Features
8
+
9
+ ### Enhanced Grouping and Organization
10
+ - **Hierarchical Grouping:** 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.
11
+ - **Detailed Breakdown:** Each suite displays a sub-category for project names, with individual test cases listed under their respective projects.
12
+
13
+ ### Configurable Report Generation
14
+ - **Flexible Configuration:** The reporter can be easily configured within your Playwright configuration file. Example:
15
+ ```JS/TS
16
+ reporter: [
17
+ ['ortoni-report'],
18
+ ['dot']
19
+ ],
20
+ ```
21
+
22
+ ### Screenshot Handling
23
+ - **Screenshot Storage:** Screenshots are now saved in a structured directory within the root of your project, ensuring that visual evidence is easily accessible.
24
+ - **Automatic Directory Creation:** The reporter automatically creates necessary directories for storing screenshots.
25
+
26
+ ### Comprehensive Test Details
27
+ - **Rich Test Information:** Each test result includes the test title, status, duration, errors, steps, logs, and screenshot paths.
28
+ - **Color-coded Status:** Test statuses are color-coded (green for passed, red for failed, yellow for skipped) for quick visual identification.
29
+
30
+ ### Handlebars Template Integration
31
+ - **Customizable Reports:** The HTML report is generated using Handlebars templates, allowing for easy customization and styling.
32
+ - **JSON Helper:** A custom Handlebars helper for JSON stringification is included to handle complex data structures.
33
+
34
+ ## Installation
35
+
36
+ To install OrtoniReport, add it to your project using npm:
37
+
38
+ ```bash
39
+ npm install ortoni-report --save-dev
40
+ ```
41
+
42
+ ## Usage
43
+
44
+ Configure OrtoniReport in your `playwright.config.ts`:
45
+
46
+ ``` javascript/typescript
47
+ import { defineConfig } from '@playwright/test';
48
+ import OrtoniReport from 'ortoni-report';
49
+
50
+ export default defineConfig({
51
+ reporter: [
52
+ ['ortoni-report'],
53
+ ['dot']
54
+ ],
55
+ // Other Playwright configurations
56
+ });
57
+ ```
58
+
59
+ ## Known Issues
60
+
61
+ - **Compatibility:** Ensure that your Node.js environment supports ES6 modules, as OrtoniReport uses modern JavaScript features.
62
+
63
+ ## Future Plans
64
+
65
+ - **Additional Customization Options:** More options for customizing the appearance and structure of the HTML report.
66
+ - **Integration with CI/CD:** Enhanced support for continuous integration and deployment environments.
67
+ - **Advanced Filtering:** Additional filtering options to allow users to focus on specific subsets of test results.
68
+
69
+ ## Feedback and Contributions
70
+
71
+ We welcome feedback and contributions from the community. If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request on our GitHub repository.
72
+
73
+ Thank you for using OrtoniReport! We hope it significantly enhances your Playwright testing experience.
74
+
75
+ ---
76
+
77
+ **LetCode with Koushik**