testcafe-reporter-qase 1.2.1 → 2.0.0-beta.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
@@ -18,30 +18,34 @@ existing test cases from TMS before the executing tests. Meta key should be `CID
18
18
  You should assign list of case IDs to it, e.g.:
19
19
 
20
20
  ```js
21
- test
22
- .meta('CID', [1])
23
- ('Text typing basics', async (t) => {
24
- await t
25
- });
26
-
27
- test
28
- .meta({ CID: [2, 3] })
29
- ('Click check boxes and then verify their state', async (t) => {
30
- await t
31
- });
21
+ test.meta('CID', [1])('Text typing basics', async (t) => {
22
+ await t;
23
+ });
24
+
25
+ test.meta({ CID: [2, 3] })(
26
+ 'Click check boxes and then verify their state',
27
+ async (t) => {
28
+ await t;
29
+ },
30
+ );
32
31
  ```
32
+
33
33
  ---
34
+
34
35
  To run tests and create a test run, execute the command (for example from folder examples):
36
+
35
37
  ```bash
36
- npx testcafe chrome test.js -r spec,qase
38
+ QASE_MODE=testops npx testcafe chrome test.js -r spec,qase
37
39
  ```
40
+
38
41
  or
42
+
39
43
  ```bash
40
44
  npm test
41
45
  ```
42
46
 
43
47
  <p align="center">
44
- <img width="65%" src="./examples/screenshots/screenshot.png">
48
+ <img width="65%" src="./screenshots/screenshot.png">
45
49
  </p>
46
50
 
47
51
  A test run will be performed and available at:
@@ -51,62 +55,62 @@ https://app.qase.io/run/QASE_PROJECT_CODE
51
55
  ```
52
56
 
53
57
  <p align="center">
54
- <img src="./examples/screenshots/demo.gif">
58
+ <img src="./screenshots/demo.gif">
55
59
  </p>
56
60
 
57
61
  ## Configuration
58
62
 
59
- Qase reporter supports passing parameters using two ways:
60
- using `.qaserc` file and using ENV variables.
63
+ Qase reporter supports passing parameters using two ways:
64
+ using `.qaserc`/`qase.config.json` file and using ENV variables.
65
+
66
+ `.qaserc` parameters, (* - required):
61
67
 
62
- `.qaserc` parameters:
63
- - `enabled` - Enable reporter
64
- - `apiToken` - Token for API access, you can find more information
68
+ - `mode` - `testops`/`off` Enables reporter, default - `off`
69
+ - `debug` - Enables debug logging, defaule - `false`
70
+ - `environment` - To execute with the sending of the envinroment information
71
+ - *`testops.api.token` - Token for API access, you can find more information
65
72
  [here](https://developers.qase.io/#authentication)
66
- - `basePath` - Qase.io URL
67
- - `projectCode` - Code of your project (can be extracted from main
73
+ - *`testops.project` - Code of your project (can be extracted from main
68
74
  page of your project: `https://app.qase.io/project/DEMOTR` -
69
75
  `DEMOTR` is project code here)
70
- - `runId` - Pass Run ID
71
- - `environmentId` - Environment ID from Qase TMS
72
- - `runName` - Set custom Run name, when new run is created.
73
- Supports two parameters:
74
- - `%DATE%`
75
- - `%AGENTS%`
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
79
- - `logging` - Enabled debug logging from reporter or not
80
- - `rootSuiteTitle` - A parent suite for your autocreated tests
76
+ - `testops.uploadAttachments` - Permission to send screenshots to Qase TMS
77
+ - `testops.run.id` - Pass Run ID
78
+ - `testops.run.title` - Set custom Run name, when new run is created
79
+ - `testops.run.description` - Set custom Run description, when new run is created
80
+ - `testops.run.complete` - Whether the run should be completed
81
81
 
82
82
  Example configuration file:
83
+
83
84
  ```json
84
85
  {
85
- "enabled": true,
86
- "logging": true,
87
- "apiToken": "api_key",
88
- "projectCode": "project_code",
89
- "runName": "TestCafe run %DATE% %AGENTS%"
86
+ "debug": true,
87
+ "environment": 1,
88
+ "testops": {
89
+ "api": {
90
+ "token": "api_key"
91
+ },
92
+ "project": "project_code"
93
+ }
90
94
  }
91
95
  ```
92
96
 
93
97
  Supported ENV variables:
94
98
 
95
- - `QASE_ENABLED` - Same as `enabled`
96
- - `QASE_API_TOKEN` - Same as `apiToken`
97
- - `QASE_PROJECT` - Same as `projectCode`
98
- - `QASE_RUN_ID` - Pass Run ID from ENV and override reporter options
99
- - `QASE_RUN_NAME` - Same as `runName`
100
- - `QASE_RUN_DESCRIPTION` - Same as `runDescription`
101
- - `QASE_RUN_COMPLETE` - Same as `runComplete`
102
- - `QASE_LOGGING` - Same as `logging`
103
- - `QASE_UPLOAD_ATTACHMENTS` - Same as `uploadAttachments`
104
- - `QASE_ROOT_SUITE_TITLE` - Same as `rootSuiteTitle`
99
+ - `QASE_MODE` - Same as `mode`
100
+ - `QASE_DEBUG` - Same as `debug`
101
+ - `QASE_ENVIRONMENT` - Same as `environment`
102
+ - `QASE_TESTOPS_API_TOKEN` - Same as `testops.api.token`
103
+ - `QASE_TESTOPS_PROJECT` - Same as `testops.project`
104
+ - `QASE_TESTOPS_RUN_ID` - Pass Run ID from ENV and override reporter option `testops.run.id`
105
+ - `QASE_TESTOPS_RUN_TITLE` - Same as `testops.run.title`
106
+ - `QASE_TESTOPS_RUN_DESCRIPTION` - Same as `testops.run.description`
105
107
 
106
108
  ## Requirements
107
109
 
108
110
  We maintain the reporter on LTS versions of Node. You can find the current versions by following the [link](https://nodejs.org/en/about/releases/)
109
111
 
112
+ `testcafe >= 2.0.0`
113
+
110
114
  <!-- references -->
111
115
 
112
116
  [auth]: https://developers.qase.io/#authentication
@@ -0,0 +1,12 @@
1
+ import { TestcafeQaseOptionsType, TestcafeQaseReporter } from './reporter';
2
+ /**
3
+ * @param {TestcafeQaseOptionsType} options
4
+ * @returns {object}
5
+ */
6
+ export declare const factory: (options: TestcafeQaseOptionsType) => {
7
+ reportTaskStart: () => void;
8
+ reportFixtureStart: () => void;
9
+ reportTestDone: (title: string, testRunInfo: import("./reporter").TestRunInfoType, meta: Record<string, string>) => void;
10
+ reportTaskDone: () => Promise<void>;
11
+ reporter: TestcafeQaseReporter;
12
+ };
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.factory = void 0;
4
+ const reporter_1 = require("./reporter");
5
+ /**
6
+ * @param {TestcafeQaseOptionsType} options
7
+ * @returns {object}
8
+ */
9
+ const factory = (options) => {
10
+ const reporter = new reporter_1.TestcafeQaseReporter(options);
11
+ return {
12
+ reportTaskStart: () => {
13
+ /* empty */
14
+ },
15
+ reportFixtureStart: () => {
16
+ /* empty */
17
+ },
18
+ reportTestDone: reporter.reportTestDone,
19
+ reportTaskDone: reporter.reportTaskDone,
20
+ reporter,
21
+ };
22
+ };
23
+ exports.factory = factory;
package/dist/index.d.ts CHANGED
@@ -1,61 +1,2 @@
1
- interface Meta {
2
- [key: string]: string;
3
- }
4
- interface Screenshot {
5
- screenshotPath: string;
6
- thumbnailPath: string;
7
- userAgent: string;
8
- quarantineAttempt: number;
9
- takenOnFail: boolean;
10
- }
11
- interface TestRunInfo {
12
- errs: Array<Record<string, unknown>>;
13
- warnings: string[];
14
- durationMs: number;
15
- unstable: boolean;
16
- screenshotPath: string;
17
- screenshots: Screenshot[];
18
- quarantine: {
19
- [key: string]: {
20
- passed: boolean;
21
- };
22
- };
23
- skipped: boolean;
24
- }
25
- declare class TestcafeQaseReporter {
26
- private config;
27
- private api;
28
- private enabled;
29
- private userAgents;
30
- private pending;
31
- private results;
32
- private screenshots;
33
- private queued;
34
- private fixtureName;
35
- constructor();
36
- private static getCaseId;
37
- private static createHeaders;
38
- private static createRunObject;
39
- private static getPackageVersion;
40
- reportTaskStart: (_startTime: number, userAgents: string[]) => Promise<void>;
41
- reportFixtureStart: (name: any) => Promise<void>;
42
- reportTestDone: (name: string, testRunInfo: TestRunInfo, meta: Meta, formatError: (x: Record<string, unknown>) => string) => Promise<void>;
43
- reportTaskDone: () => Promise<void>;
44
- private completeRun;
45
- private log;
46
- private checkProject;
47
- private createRun;
48
- private checkRun;
49
- private saveRunId;
50
- private logTestItem;
51
- private prepareCaseResult;
52
- private uploadAttachments;
53
- }
54
- declare const _default: () => {
55
- reportTaskStart: (_startTime: number, userAgents: string[]) => Promise<void>;
56
- reportFixtureStart: (name: any) => Promise<void>;
57
- reportTestDone(name: string, testRunInfo: TestRunInfo, meta: Meta): Promise<void>;
58
- reportTaskDone: () => Promise<void>;
59
- reporter: TestcafeQaseReporter;
60
- };
61
- export = _default;
1
+ import { factory } from './factory';
2
+ export = factory;