html-reporter 9.0.0 → 9.1.1

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
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ <a name="9.1.1"></a>
6
+ ## [9.1.1](https://github.com/gemini-testing/html-reporter/compare/v9.1.0...v9.1.1) (2022-08-04)
7
+
8
+
9
+
10
+ <a name="9.1.0"></a>
11
+ # [9.1.0](https://github.com/gemini-testing/html-reporter/compare/v9.0.0...v9.1.0) (2022-08-04)
12
+
13
+
14
+ ### Features
15
+
16
+ * add TEST_SCREENSHOTS_SAVED event ([e50ab0f](https://github.com/gemini-testing/html-reporter/commit/e50ab0f))
17
+
18
+
19
+
5
20
  <a name="9.0.0"></a>
6
21
  # [9.0.0](https://github.com/gemini-testing/html-reporter/compare/v8.4.4...v9.0.0) (2022-05-20)
7
22
 
package/README.md CHANGED
@@ -534,6 +534,7 @@ Property name | Description
534
534
  Event | Description
535
535
  ------------------------- | -------------
536
536
  `DATABASE_CREATED` | Will be triggered after sqlite database is created. The handler accepts a database instance. The event is synchronous.
537
+ `TEST_SCREENSHOTS_SAVED` | Will be triggered after test screenshots were saved. The handler accepts test id and screenshots info. The event is synchronous.
537
538
 
538
539
  ### events
539
540
 
@@ -554,6 +555,29 @@ module.exports = (hermione, opts) => {
554
555
  };
555
556
  ```
556
557
 
558
+ Example of a subscription to an event `TEST_SCREENSHOTS_SAVED`:
559
+
560
+ ```js
561
+ hermione.htmlReporter.on(hermione.htmlReporter.events.TEST_SCREENSHOTS_SAVED, ({testId, attempt, imagesInfo}) => {
562
+ console.log(`Screenshots for test "${testId}" (attempt #${attempt}) were saved:`, imagesInfo);
563
+ /* Expected output:
564
+ Screenshots for test "Feature Test.chrome-desktop" (attempt #0) were saved:
565
+ [
566
+ {
567
+ stateName: 'plain',
568
+ refImg: { path: '...', size: { width: 400, height: 200 } },
569
+ status: 'fail',
570
+ error: undefined,
571
+ diffClusters: [...],
572
+ expectedImg: { path: '...', size: { width: 400, height: 200 } }
573
+ actualImg: { path: '...', size: { width: 400, height: 200 } }
574
+ diffImg: { path: '...', size: { width: 400, height: 200 } }
575
+ }
576
+ ]
577
+ */
578
+ });
579
+ ```
580
+
557
581
  ### addExtraItem
558
582
 
559
583
  Adds item to html report as link:
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  const getSyncEvents = () => ({
4
- DATABASE_CREATED: 'databaseCreated'
4
+ DATABASE_CREATED: 'databaseCreated',
5
+ TEST_SCREENSHOTS_SAVED: 'testScreenshotsSaved'
5
6
  });
6
7
 
7
8
  const events = getSyncEvents();
@@ -330,8 +330,8 @@ module.exports = class TestAdapter {
330
330
  await fs.writeFile(detailsFilePath, detailsData);
331
331
  }
332
332
 
333
- saveTestImages(reportPath, workers) {
334
- return Promise.map(this.assertViewResults, async (assertResult) => {
333
+ async saveTestImages(reportPath, workers) {
334
+ const result = await Promise.map(this.assertViewResults, async (assertResult) => {
335
335
  const {stateName} = assertResult;
336
336
  const destRefPath = utils.getReferencePath(this, stateName);
337
337
  const srcRefPath = this.getRefImg(stateName).path;
@@ -363,6 +363,15 @@ module.exports = class TestAdapter {
363
363
 
364
364
  return Promise.all(actions);
365
365
  });
366
+
367
+ const htmlReporter = this._hermione.htmlReporter;
368
+ htmlReporter.emit(htmlReporter.events.TEST_SCREENSHOTS_SAVED, {
369
+ testId: this._testId,
370
+ attempt: this.attempt,
371
+ imagesInfo: this.getImagesInfo()
372
+ });
373
+
374
+ return result;
366
375
  }
367
376
 
368
377
  //parallelize and cache of 'gemini-core.Image.buildDiff' (because it is very slow)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-reporter",
3
- "version": "9.0.0",
3
+ "version": "9.1.1",
4
4
  "description": "Plugin for hermione which is intended to aggregate the results of tests running into html report",
5
5
  "scripts": {
6
6
  "coverage": "nyc npm run test-unit",
@@ -71,7 +71,7 @@
71
71
  "react-html-parser": "^2.0.2",
72
72
  "react-markdown": "^3.2.0",
73
73
  "reapop": "2.1.0",
74
- "reapop-theme-wybo": "1.0.2",
74
+ "reapop-theme-wybo": "^1.1.0",
75
75
  "reduce-reducers": "^1.0.4",
76
76
  "reselect": "^4.0.0",
77
77
  "resolve": "^1.5.0",