testcafe-reporter-qase 1.0.5 → 1.2.0-alpha.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/README.md CHANGED
@@ -1,14 +1,15 @@
1
- # [Qase TMS](https://qase.io) TestCafe Reporter
1
+ > # Qase TMS TestCafe reporter
2
+ >
3
+ > Publish results simple and easy.
2
4
 
3
- [![License](https://lxgaming.github.io/badges/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
4
-
5
- ## Installation
5
+ ## How to integrate
6
6
 
7
7
  ```
8
- npm install testcafe-reporter-qase
8
+ npm install testcafe testcafe-reporter-qase
9
9
  ```
10
10
 
11
- ## Usage
11
+ ## Example of usage
12
+
12
13
  In order to use reporter, you should add meta information to your tests. Meta key should be `CID`.
13
14
  You should assign list of case IDs to it, e.g.:
14
15
  ```js
@@ -24,12 +25,35 @@ test
24
25
  await t
25
26
  });
26
27
  ```
28
+ You should also have an active item in the project settings at
29
+
30
+ ```
31
+ https://app.qase.io/project/QASE_PROJECT_CODE/settings/options
32
+ ```
33
+
34
+ options in the `Test Runs` block:
27
35
 
28
- After that you can run your tests by providing custom reporter:
36
+ ```
37
+ Allow submitting results in bulk
38
+ ```
39
+ You can run your tests by providing custom reporter:
29
40
  ```bash
30
- npx testcafe chrome examples/use-page-model -r spec,qase
41
+ npx testcafe chrome test.js -r spec,qase
31
42
  ```
43
+ or
44
+ ```
45
+ npm test
46
+ ```
47
+
48
+ <p align="center">
49
+ <img width="65%" src="./examples/screenshots/screenshot.png">
50
+ </p>
51
+
52
+ A test run will be performed and available at:
32
53
 
54
+ ```
55
+ https://app.qase.io/run/QASE_PROJECT_CODE
56
+ ```
33
57
  ## Configuration
34
58
 
35
59
  Qase reporter supports passing parameters using two ways:
@@ -39,15 +63,19 @@ using `.qaserc` file and using ENV variables.
39
63
  - `enabled` - Enable reporter
40
64
  - `apiToken` - Token for API access, you can find more information
41
65
  [here](https://developers.qase.io/#authentication)
66
+ - `basePath` - Qase.io URL
42
67
  - `projectCode` - Code of your project (can be extracted from main
43
68
  page of your project: `https://app.qase.io/project/DEMOTR` -
44
69
  `DEMOTR` is project code here)
45
70
  - `runId` - Pass Run ID
71
+ - `environmentId` - Environment ID from Qase TMS
46
72
  - `runName` - Set custom Run name, when new run is created.
47
73
  Supports two parameters:
48
74
  - `%DATE%`
49
75
  - `%AGENTS%`
50
76
  - `runDescription` - Set custom Run description, when new run is created
77
+ - `uploadAttachments` - Uploading attachment to Qase TMS
78
+ - `runComplete` - Complete run after all tests are finished
51
79
  - `logging` - Enabled debug logging from reporter or not
52
80
 
53
81
  Example configuration file:
@@ -55,8 +83,8 @@ Example configuration file:
55
83
  {
56
84
  "enabled": true,
57
85
  "logging": true,
58
- "apiToken": "a786b45e371e1097c4c78a3211e3a1d23018ceb9",
59
- "projectCode": "PROJECTCODE",
86
+ "apiToken": "api_key",
87
+ "projectCode": "project_code",
60
88
  "runName": "TestCafe run %DATE% %AGENTS%"
61
89
  }
62
90
  ```
@@ -69,4 +97,10 @@ Supported ENV variables:
69
97
  - `QASE_RUN_ID` - Pass Run ID from ENV and override reporter options
70
98
  - `QASE_RUN_NAME` - Same as `runName`
71
99
  - `QASE_RUN_DESCRIPTION` - Same as `runDescription`
100
+ - `QASE_RUN_COMPLETE` - Same as `runComplete`
72
101
  - `QASE_LOGGING` - Same as `logging`
102
+ - `QASE_UPLOAD_ATTACHMENTS` - Same as `uploadAttachments`
103
+
104
+ <!-- references -->
105
+
106
+ [auth]: https://developers.qase.io/#authentication
@@ -0,0 +1,6 @@
1
+ import FormData from 'form-data';
2
+ export declare let customBoundary: string;
3
+ export declare class CustomBoundaryFormData extends FormData {
4
+ constructor();
5
+ getBoundary(): string;
6
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __importDefault = (this && this.__importDefault) || function (mod) {
16
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.CustomBoundaryFormData = exports.customBoundary = void 0;
20
+ var form_data_1 = __importDefault(require("form-data"));
21
+ var crypto_1 = __importDefault(require("crypto"));
22
+ exports.customBoundary = '----------------------------';
23
+ crypto_1.default.randomBytes(24).forEach(function (value) {
24
+ exports.customBoundary += Math.floor(value * 10).toString(16);
25
+ });
26
+ var CustomBoundaryFormData = /** @class */ (function (_super) {
27
+ __extends(CustomBoundaryFormData, _super);
28
+ function CustomBoundaryFormData() {
29
+ return _super.call(this) || this;
30
+ }
31
+ CustomBoundaryFormData.prototype.getBoundary = function () {
32
+ return exports.customBoundary;
33
+ };
34
+ return CustomBoundaryFormData;
35
+ }(form_data_1.default));
36
+ exports.CustomBoundaryFormData = CustomBoundaryFormData;
37
+ //# sourceMappingURL=CustomBoundaryFormData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomBoundaryFormData.js","sourceRoot":"","sources":["../src/CustomBoundaryFormData.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,wDAAiC;AACjC,kDAA4B;AAGjB,QAAA,cAAc,GAAG,8BAA8B,CAAC;AAC3D,gBAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,UAAC,KAAK;IACjC,sBAAc,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC1D,CAAC,CAAC,CAAC;AAEH;IAA4C,0CAAQ;IAChD;eACI,iBAAO;IACX,CAAC;IACM,4CAAW,GAAlB;QACI,OAAO,sBAAc,CAAC;IAC1B,CAAC;IACL,6BAAC;AAAD,CAAC,AAPD,CAA4C,mBAAQ,GAOnD;AAPY,wDAAsB"}
package/dist/index.d.ts CHANGED
@@ -23,7 +23,6 @@ interface TestRunInfo {
23
23
  skipped: boolean;
24
24
  }
25
25
  declare class TestcafeQaseReporter {
26
- private formatError;
27
26
  private config;
28
27
  private api;
29
28
  private enabled;
@@ -31,18 +30,25 @@ declare class TestcafeQaseReporter {
31
30
  private pending;
32
31
  private results;
33
32
  private screenshots;
33
+ private queued;
34
+ private sending;
34
35
  constructor();
36
+ private static getCaseId;
37
+ private static createHeaders;
38
+ private static createRunObject;
39
+ private static getPackageVersion;
35
40
  reportTaskStart: (_startTime: number, userAgents: string[]) => Promise<void>;
36
41
  reportTestDone: (name: string, testRunInfo: TestRunInfo, meta: Meta, formatError: (x: Record<string, unknown>) => string) => Promise<void>;
37
42
  reportTaskDone: () => Promise<void>;
43
+ private completeRun;
38
44
  private log;
39
45
  private checkProject;
40
46
  private createRun;
41
47
  private checkRun;
42
48
  private saveRunId;
43
- private getCaseId;
44
49
  private logTestItem;
45
- private publishCaseResult;
50
+ private prepareCaseResult;
51
+ private uploadAttachments;
46
52
  }
47
53
  declare const _default: () => {
48
54
  reportTaskStart: (_startTime: number, userAgents: string[]) => Promise<void>;