testcafe-reporter-qase 1.2.0-alpha.2 → 2.0.0-beta.0

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,45 +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
  ```
33
- You should also have an active item in the project settings at
34
- ```
35
- https://app.qase.io/project/QASE_PROJECT_CODE/settings/options
36
- ```
37
-
38
- options in the `Test Runs` block:
39
32
 
40
- ```
41
- Auto create test cases
42
- ```
43
- and
44
-
45
- ```
46
- Allow submitting results in bulk
47
- ```
48
33
  ---
34
+
49
35
  To run tests and create a test run, execute the command (for example from folder examples):
36
+
50
37
  ```bash
51
- npx testcafe chrome test.js -r spec,qase
38
+ QASE_MODE=testops npx testcafe chrome test.js -r spec,qase
52
39
  ```
40
+
53
41
  or
42
+
54
43
  ```bash
55
44
  npm test
56
45
  ```
57
46
 
58
47
  <p align="center">
59
- <img width="65%" src="./examples/screenshots/screenshot.png">
48
+ <img width="65%" src="./screenshots/screenshot.png">
60
49
  </p>
61
50
 
62
51
  A test run will be performed and available at:
@@ -66,57 +55,61 @@ https://app.qase.io/run/QASE_PROJECT_CODE
66
55
  ```
67
56
 
68
57
  <p align="center">
69
- <img src="./examples/screenshots/demo.gif">
58
+ <img src="./screenshots/demo.gif">
70
59
  </p>
71
60
 
72
61
  ## Configuration
73
62
 
74
- Qase reporter supports passing parameters using two ways:
75
- 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):
76
67
 
77
- `.qaserc` parameters:
78
- - `enabled` - Enable reporter
79
- - `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
80
72
  [here](https://developers.qase.io/#authentication)
81
- - `basePath` - Qase.io URL
82
- - `projectCode` - Code of your project (can be extracted from main
73
+ - *`testops.project` - Code of your project (can be extracted from main
83
74
  page of your project: `https://app.qase.io/project/DEMOTR` -
84
75
  `DEMOTR` is project code here)
85
- - `runId` - Pass Run ID
86
- - `environmentId` - Environment ID from Qase TMS
87
- - `runName` - Set custom Run name, when new run is created.
88
- Supports two parameters:
89
- - `%DATE%`
90
- - `%AGENTS%`
91
- - `runDescription` - Set custom Run description, when new run is created
92
- - `uploadAttachments` - Uploading attachment to Qase TMS
93
- - `runComplete` - Complete run after all tests are finished
94
- - `logging` - Enabled debug logging from reporter or not
95
- - `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
96
81
 
97
82
  Example configuration file:
83
+
98
84
  ```json
99
85
  {
100
- "enabled": true,
101
- "logging": true,
102
- "apiToken": "api_key",
103
- "projectCode": "project_code",
104
- "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
+ }
105
94
  }
106
95
  ```
107
96
 
108
97
  Supported ENV variables:
109
98
 
110
- - `QASE_ENABLED` - Same as `enabled`
111
- - `QASE_API_TOKEN` - Same as `apiToken`
112
- - `QASE_PROJECT` - Same as `projectCode`
113
- - `QASE_RUN_ID` - Pass Run ID from ENV and override reporter options
114
- - `QASE_RUN_NAME` - Same as `runName`
115
- - `QASE_RUN_DESCRIPTION` - Same as `runDescription`
116
- - `QASE_RUN_COMPLETE` - Same as `runComplete`
117
- - `QASE_LOGGING` - Same as `logging`
118
- - `QASE_UPLOAD_ATTACHMENTS` - Same as `uploadAttachments`
119
- - `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`
107
+
108
+ ## Requirements
109
+
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/)
111
+
112
+ `testcafe >= 2.0.0`
120
113
 
121
114
  <!-- references -->
122
115
 
package/package.json CHANGED
@@ -1,58 +1,54 @@
1
1
  {
2
2
  "name": "testcafe-reporter-qase",
3
- "version": "v1.2.0-alpha.2",
3
+ "version": "2.0.0-beta.0",
4
4
  "description": "Qase TMS TestCafe Reporter",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
- "homepage": "https://github.com/qase-tms/qase-testcafe",
7
+ "exports": {
8
+ ".": "./dist/index.js",
9
+ "./reporter": "./dist/reporter.js",
10
+ "./package.json": "./package.json"
11
+ },
12
+ "typesVersions": {
13
+ "*": {
14
+ ".": [
15
+ "./dist/index.d.ts"
16
+ ],
17
+ "reporter": [
18
+ "./dist/reporter.d.ts"
19
+ ]
20
+ }
21
+ },
22
+ "homepage": "https://github.com/qase-tms/qase-javascript",
8
23
  "bugs": {
9
- "url": "https://github.com/qase-tms/qase-testcafe"
24
+ "url": "https://github.com/qase-tms/qase-javascript/issues"
10
25
  },
11
26
  "repository": {
12
27
  "type": "git",
13
- "url": "https://github.com/qase-tms/qase-testcafe.git"
28
+ "url": "git+https://github.com/qase-tms/qase-javascript.git"
14
29
  },
15
30
  "engines": {
16
31
  "node": ">=14"
17
32
  },
18
33
  "scripts": {
19
- "dev": "npm run lint && tsc",
20
- "dev:watch": "nodemon --exec 'npm run dev || exit 1'",
21
- "lint": "eslint src/**",
22
- "lint:fix": "eslint --fix src/**",
23
- "build": "npm run clean && npm run dev",
24
- "test": "jest --coverage",
25
- "clean": "rm -rf dist || true"
26
- },
27
- "author": {
28
- "name": "Parviz Khavari",
29
- "email": "havaripa@gmail.com"
34
+ "build": "npm run clean && tsc --project tsconfig.build.json",
35
+ "lint": "eslint .",
36
+ "test": "jest --passWithNoTests",
37
+ "clean": "rm -rf dist"
30
38
  },
39
+ "author": "Parviz Khavari <havaripa@gmail.com>",
31
40
  "license": "Apache-2.0",
32
- "devDependencies": {
33
- "@hutson/npm-deploy-git-tag": "^6.0.0",
34
- "@types/jest": "^23.3.7",
35
- "@types/node-fetch": "^2.5.7",
36
- "@typescript-eslint/eslint-plugin": "^3.10.1",
37
- "@typescript-eslint/eslint-plugin-tslint": "^3.10.1",
38
- "@typescript-eslint/parser": "^3.10.1",
39
- "ansi-regex": "^6.0.1",
40
- "axios-mock-adapter": "^1.19.0",
41
- "eslint": "^7.17.0",
42
- "eslint-plugin-jsdoc": "^26.0.1",
43
- "eslint-plugin-prefer-arrow": "^1.2.1",
44
- "handlebars": "^4.7.7",
45
- "jest": "^26.6.3",
46
- "json-schema": "^0.4.0",
47
- "moment": "^2.29.1",
48
- "node-fetch": "^3.1.1",
49
- "nodemon": "^2.0.7",
50
- "ts-jest": "^26.4.4",
51
- "typescript": "^3.9.3"
52
- },
53
41
  "dependencies": {
54
- "chalk": "^4.1.0",
55
- "form-data": "^3.0.0",
56
- "qaseio": "^2.0.1"
42
+ "qase-javascript-commons": "^2.0.0-beta.0",
43
+ "uuid": "^9.0.0"
44
+ },
45
+ "peerDependencies": {
46
+ "testcafe": ">=2.0.0"
47
+ },
48
+ "devDependencies": {
49
+ "@jest/globals": "^29.5.0",
50
+ "@types/jest": "^29.5.2",
51
+ "jest": "^29.5.0",
52
+ "ts-jest": "^29.1.0"
57
53
  }
58
54
  }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+
4
+ "compilerOptions": {
5
+ "noEmit": false
6
+ },
7
+
8
+ "include": ["./src/**/*.ts"]
9
+ }
@@ -1,6 +0,0 @@
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
- }
@@ -1,37 +0,0 @@
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
@@ -1 +0,0 @@
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 DELETED
@@ -1,61 +0,0 @@
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;