cypress-qase-reporter 1.4.3 → 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 +32 -28
- package/dist/configSchema.d.ts +4 -0
- package/dist/configSchema.js +25 -0
- package/dist/index.cjs.d.ts +1 -0
- package/dist/index.cjs.js +5 -0
- package/dist/index.d.ts +1 -27
- package/dist/index.js +2 -422
- package/dist/mocha.d.ts +2 -4
- package/dist/mocha.js +7 -18
- package/dist/options.d.ts +3 -0
- package/dist/options.js +2 -0
- package/dist/reporter.d.ts +65 -0
- package/dist/reporter.js +130 -0
- package/dist/utils/traverse-dir.d.ts +1 -0
- package/dist/utils/traverse-dir.js +25 -0
- package/package.json +44 -41
- package/tsconfig.build.json +9 -0
- package/dist/index.js.map +0 -1
- package/dist/mocha.js.map +0 -1
- package/dist/reportBulk.js +0 -174
- package/examples_cypress_v10/cypress/e2e/second.cy.js +0 -59
- package/examples_cypress_v10/cypress/fixtures/example.json +0 -5
- package/examples_cypress_v10/cypress/plugins/index.js +0 -21
- package/examples_cypress_v10/cypress/support/commands.js +0 -25
- package/examples_cypress_v10/cypress/support/e2e.js +0 -20
- package/examples_cypress_v10/cypress.config.js +0 -30
- package/examples_cypress_v10/package-lock.json +0 -5198
- package/examples_cypress_v10/package.json +0 -17
- package/examples_cypress_v6/cypress/fixtures/example.json +0 -5
- package/examples_cypress_v6/cypress/integration/sample_spec.js +0 -39
- package/examples_cypress_v6/cypress/plugins/index.js +0 -21
- package/examples_cypress_v6/cypress/support/commands.js +0 -25
- package/examples_cypress_v6/cypress/support/index.js +0 -20
- package/examples_cypress_v6/cypress.json +0 -20
- package/examples_cypress_v6/package-lock.json +0 -6283
- package/examples_cypress_v6/package.json +0 -17
- package/test/plugin.test.ts +0 -179
- /package/{examples_cypress_v10/screenshots → screenshots}/screenshot.png +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { MochaOptions, reporters, Runner } from 'mocha';
|
|
2
|
+
import { ConfigLoader, TestStatusEnum } from 'qase-javascript-commons';
|
|
3
|
+
import { ReporterOptionsType } from './options';
|
|
4
|
+
type CypressState = 'failed' | 'passed' | 'pending';
|
|
5
|
+
export type CypressQaseOptionsType = Omit<MochaOptions, 'reporterOptions'> & {
|
|
6
|
+
reporterOptions: ReporterOptionsType;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* @class CypressQaseReporter
|
|
10
|
+
* @extends reporters.Base
|
|
11
|
+
*/
|
|
12
|
+
export declare class CypressQaseReporter extends reporters.Base {
|
|
13
|
+
/**
|
|
14
|
+
* @type {RegExp}
|
|
15
|
+
*/
|
|
16
|
+
static qaseIdRegExp: RegExp;
|
|
17
|
+
/**
|
|
18
|
+
* @type {Record<CypressState, TestStatusEnum>}
|
|
19
|
+
*/
|
|
20
|
+
static statusMap: Record<CypressState, TestStatusEnum>;
|
|
21
|
+
/**
|
|
22
|
+
* @param {string} title
|
|
23
|
+
* @returns {number[]}
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
private static getCaseId;
|
|
27
|
+
/**
|
|
28
|
+
* @param {number[]} ids
|
|
29
|
+
* @param {string} dir
|
|
30
|
+
* @returns {string[]}
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
private static findAttachments;
|
|
34
|
+
/**
|
|
35
|
+
* @type {string | undefined}
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
private screenshotsFolder;
|
|
39
|
+
/**
|
|
40
|
+
* @type {ReporterInterface}
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
43
|
+
private reporter;
|
|
44
|
+
/**
|
|
45
|
+
* @param {Runner} runner
|
|
46
|
+
* @param {CypressQaseOptionsType} options
|
|
47
|
+
* @param {ConfigLoaderInterface} configLoader
|
|
48
|
+
*/
|
|
49
|
+
constructor(runner: Runner, options: CypressQaseOptionsType, configLoader?: ConfigLoader<import("qase-javascript-commons").FrameworkOptionsType<"cypress", ReporterOptionsType>>);
|
|
50
|
+
/**
|
|
51
|
+
* @param {Runner} runner
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
private addRunnerListeners;
|
|
55
|
+
/**
|
|
56
|
+
* @param {Test} test
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
private addTestResult;
|
|
60
|
+
/**
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
private preventExit;
|
|
64
|
+
}
|
|
65
|
+
export {};
|
package/dist/reporter.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CypressQaseReporter = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const mocha_1 = require("mocha");
|
|
9
|
+
const qase_javascript_commons_1 = require("qase-javascript-commons");
|
|
10
|
+
const traverse_dir_1 = require("./utils/traverse-dir");
|
|
11
|
+
const configSchema_1 = require("./configSchema");
|
|
12
|
+
const { EVENT_TEST_FAIL, EVENT_TEST_PASS, EVENT_TEST_PENDING, EVENT_RUN_END, } = mocha_1.Runner.constants;
|
|
13
|
+
/**
|
|
14
|
+
* @class CypressQaseReporter
|
|
15
|
+
* @extends reporters.Base
|
|
16
|
+
*/
|
|
17
|
+
class CypressQaseReporter extends mocha_1.reporters.Base {
|
|
18
|
+
/**
|
|
19
|
+
* @param {string} title
|
|
20
|
+
* @returns {number[]}
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
static getCaseId(title) {
|
|
24
|
+
const [, ids] = title.match(CypressQaseReporter.qaseIdRegExp) ?? [];
|
|
25
|
+
return ids ? ids.split(',').map((id) => Number(id)) : [];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @param {number[]} ids
|
|
29
|
+
* @param {string} dir
|
|
30
|
+
* @returns {string[]}
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
static findAttachments(ids, dir) {
|
|
34
|
+
const idSet = new Set(ids);
|
|
35
|
+
const attachments = [];
|
|
36
|
+
try {
|
|
37
|
+
(0, traverse_dir_1.traverseDir)(path_1.default.join(process.cwd(), dir), (filePath) => {
|
|
38
|
+
if (CypressQaseReporter.getCaseId(filePath).some((item) => idSet.has(item))) {
|
|
39
|
+
attachments.push(filePath);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
catch (error) { /* ignore */ }
|
|
44
|
+
return attachments;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @param {Runner} runner
|
|
48
|
+
* @param {CypressQaseOptionsType} options
|
|
49
|
+
* @param {ConfigLoaderInterface} configLoader
|
|
50
|
+
*/
|
|
51
|
+
constructor(runner, options, configLoader = new qase_javascript_commons_1.ConfigLoader(configSchema_1.configSchema)) {
|
|
52
|
+
super(runner, options);
|
|
53
|
+
const { reporterOptions } = options;
|
|
54
|
+
const config = configLoader.load();
|
|
55
|
+
const { framework, ...composedOptions } = (0, qase_javascript_commons_1.composeOptions)(reporterOptions, config);
|
|
56
|
+
this.screenshotsFolder = framework?.cypress?.screenshotsFolder;
|
|
57
|
+
this.reporter = new qase_javascript_commons_1.QaseReporter({
|
|
58
|
+
...composedOptions,
|
|
59
|
+
frameworkPackage: 'cypress',
|
|
60
|
+
frameworkName: 'cypress',
|
|
61
|
+
reporterName: 'cypress-qase-reporter',
|
|
62
|
+
});
|
|
63
|
+
this.addRunnerListeners(runner);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @param {Runner} runner
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
addRunnerListeners(runner) {
|
|
70
|
+
runner.on(EVENT_TEST_PASS, (test) => this.addTestResult(test));
|
|
71
|
+
runner.on(EVENT_TEST_PENDING, (test) => this.addTestResult(test));
|
|
72
|
+
runner.on(EVENT_TEST_FAIL, (test) => this.addTestResult(test));
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
74
|
+
runner.once(EVENT_RUN_END, async () => {
|
|
75
|
+
this.preventExit();
|
|
76
|
+
await this.reporter.publish();
|
|
77
|
+
if (process.exitCode !== undefined) {
|
|
78
|
+
process.exit(process.exitCode);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @param {Test} test
|
|
84
|
+
* @private
|
|
85
|
+
*/
|
|
86
|
+
addTestResult(test) {
|
|
87
|
+
const ids = CypressQaseReporter.getCaseId(test.title);
|
|
88
|
+
const attachments = this.screenshotsFolder
|
|
89
|
+
? CypressQaseReporter.findAttachments(ids, this.screenshotsFolder)
|
|
90
|
+
: undefined;
|
|
91
|
+
const result = {
|
|
92
|
+
id: test.id,
|
|
93
|
+
testOpsId: ids,
|
|
94
|
+
title: test.title,
|
|
95
|
+
suiteTitle: test.parent?.titlePath(),
|
|
96
|
+
status: test.state
|
|
97
|
+
? CypressQaseReporter.statusMap[test.state]
|
|
98
|
+
: qase_javascript_commons_1.TestStatusEnum.invalid,
|
|
99
|
+
duration: test.duration ?? 0,
|
|
100
|
+
error: test.err,
|
|
101
|
+
attachments,
|
|
102
|
+
};
|
|
103
|
+
this.reporter.addTestResult(result);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* @private
|
|
107
|
+
*/
|
|
108
|
+
preventExit() {
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
110
|
+
const _exit = process.exit;
|
|
111
|
+
const mutableProcess = process;
|
|
112
|
+
mutableProcess.exit = (code) => {
|
|
113
|
+
process.exitCode = code || 0;
|
|
114
|
+
process.exit = _exit;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.CypressQaseReporter = CypressQaseReporter;
|
|
119
|
+
/**
|
|
120
|
+
* @type {RegExp}
|
|
121
|
+
*/
|
|
122
|
+
CypressQaseReporter.qaseIdRegExp = /\(Qase ID:? ([\d,]+)\)/;
|
|
123
|
+
/**
|
|
124
|
+
* @type {Record<CypressState, TestStatusEnum>}
|
|
125
|
+
*/
|
|
126
|
+
CypressQaseReporter.statusMap = {
|
|
127
|
+
failed: qase_javascript_commons_1.TestStatusEnum.failed,
|
|
128
|
+
passed: qase_javascript_commons_1.TestStatusEnum.passed,
|
|
129
|
+
pending: qase_javascript_commons_1.TestStatusEnum.blocked,
|
|
130
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const traverseDir: (dirPath: string, callback: (filePath: string) => void) => void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.traverseDir = void 0;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
// TODO: get rid of recursion
|
|
10
|
+
const traverseDir = (dirPath, callback) => {
|
|
11
|
+
const items = (0, fs_1.readdirSync)(dirPath, { withFileTypes: true });
|
|
12
|
+
items.forEach((item) => {
|
|
13
|
+
const itemPath = path_1.default.join(dirPath, item.name);
|
|
14
|
+
if (item.isFile()) {
|
|
15
|
+
callback(itemPath);
|
|
16
|
+
}
|
|
17
|
+
else if (item.isDirectory()) {
|
|
18
|
+
try {
|
|
19
|
+
(0, exports.traverseDir)(itemPath, callback);
|
|
20
|
+
}
|
|
21
|
+
catch (error) { /* ignore */ }
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
exports.traverseDir = traverseDir;
|
package/package.json
CHANGED
|
@@ -1,58 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cypress-qase-reporter",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Qase
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
|
+
"description": "Qase Cypress Reporter",
|
|
5
|
+
"homepage": "https://github.com/qase-tms/qase-javascript",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "./dist/index.cjs.js",
|
|
8
|
+
"types": "./dist/index.cjs.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./dist/index.js",
|
|
11
|
+
"./mocha": "./dist/mocha.js",
|
|
12
|
+
"./reporter": "./dist/reporter.js",
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"typesVersions": {
|
|
16
|
+
"*": {
|
|
17
|
+
".": [
|
|
18
|
+
"./dist/index.d.ts"
|
|
19
|
+
],
|
|
20
|
+
"mocha": [
|
|
21
|
+
"./dist/mocha.d.ts"
|
|
22
|
+
],
|
|
23
|
+
"reporter": [
|
|
24
|
+
"./dist/reporter.d.ts"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
8
28
|
"bugs": {
|
|
9
|
-
"url": "https://github.com/qase-tms/qase-
|
|
29
|
+
"url": "https://github.com/qase-tms/qase-javascript/issues"
|
|
10
30
|
},
|
|
11
31
|
"repository": {
|
|
12
32
|
"type": "git",
|
|
13
|
-
"url": "https://github.com/qase-tms/qase-
|
|
33
|
+
"url": "git+https://github.com/qase-tms/qase-javascript.git"
|
|
14
34
|
},
|
|
15
35
|
"engines": {
|
|
16
|
-
"node": ">=
|
|
36
|
+
"node": ">=14"
|
|
17
37
|
},
|
|
18
38
|
"scripts": {
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"test": "jest --coverage",
|
|
24
|
-
"clean": "rm -rf dist || true"
|
|
25
|
-
},
|
|
26
|
-
"author": {
|
|
27
|
-
"name": "Parviz Khavari",
|
|
28
|
-
"email": "csctclan@gmail.com"
|
|
39
|
+
"build": "npm run clean && tsc --project tsconfig.build.json",
|
|
40
|
+
"lint": "eslint .",
|
|
41
|
+
"test": "jest --passWithNoTests",
|
|
42
|
+
"clean": "rm -rf dist"
|
|
29
43
|
},
|
|
44
|
+
"author": "Nikita Fedorov <nik333r@gmail.com>",
|
|
30
45
|
"license": "Apache-2.0",
|
|
31
46
|
"dependencies": {
|
|
32
|
-
"
|
|
33
|
-
|
|
47
|
+
"qase-javascript-commons": "^2.0.0-beta.1"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"cypress": ">=8.0.0"
|
|
34
51
|
},
|
|
35
52
|
"devDependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"@types/
|
|
38
|
-
"@types/
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"ansi-regex": "^6.0.1",
|
|
44
|
-
"axios-mock-adapter": "^1.19.0",
|
|
45
|
-
"chalk": "^4.1.0",
|
|
46
|
-
"cypress": "^4.12.1",
|
|
47
|
-
"eslint": "^7.14.0",
|
|
48
|
-
"eslint-plugin-jsdoc": "^26.0.1",
|
|
49
|
-
"eslint-plugin-prefer-arrow": "^1.2.2",
|
|
50
|
-
"handlebars": "^4.7.7",
|
|
51
|
-
"jest": "^26.6.3",
|
|
52
|
-
"json-schema": "^0.4.0",
|
|
53
|
-
"mocha": "^9.0.0",
|
|
54
|
-
"nodemon": "^2.0.6",
|
|
55
|
-
"ts-jest": "^26.4.4",
|
|
56
|
-
"typescript": "^3.9.7"
|
|
53
|
+
"@jest/globals": "^29.5.0",
|
|
54
|
+
"@types/jest": "^29.5.2",
|
|
55
|
+
"@types/mocha": "^10.0.1",
|
|
56
|
+
"ajv": "^8.12.0",
|
|
57
|
+
"jest": "^29.5.0",
|
|
58
|
+
"mocha": "^10.2.0",
|
|
59
|
+
"ts-jest": "^29.1.0"
|
|
57
60
|
}
|
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A,qCAAsC,EAAU,IAAI,KAAd,IAAI,CAAC,KAAK,EACxD,CAAC;SACL;aAAM;YACH,OAAO,CAAC,OAAO,CAAC,UAAC,MAAM;gBACnB,IAAM,gBAAgB,cAAK,OAAO,EAAE,MAAM,IAAK,UAAU,CAAE,CAAC;gBAC5D,KAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACrD,CAAC,CAAC,CAAC;SACN;IAGL,CAAC;IACL,0BAAC;AAAD,CAAC,AA9VD,CAAkC,iBAAS,CAAC,IAAI,GA8V/C;;AAED,iBAAS,mBAAmB,CAAC"}
|
package/dist/mocha.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mocha.js","sourceRoot":"","sources":["../src/mocha.ts"],"names":[],"mappings":";AACA,iBAAS;IACL,IAAI,EAAE,UAAI,MAA6C,EAAE,IAAO;QAC5D,IAAI,CAAC,IAAI,EAAE;YACP,OAAO,IAAI,CAAC;SACf;QACD,IAAM,OAAO,GAAG,IAAwC,CAAC;QACzD,IAAI,OAA4B,CAAC;QACjC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;YAC1D,OAAO,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;SACjC;aAAM;YACH,OAAO,GAAG,MAAM,CAAC;SACpB;QACD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAK,OAAO,CAAC,KAAK,mBAAc,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAG,EAAE,CAAC,CAAC;QACnF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAC"}
|
package/dist/reportBulk.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
/* eslint-disable camelcase */
|
|
3
|
-
/* eslint-disable @typescript-eslint/explicit-member-accessibility */
|
|
4
|
-
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
6
|
-
|
|
7
|
-
const { QaseApi } = require('qaseio');
|
|
8
|
-
const FormData = require('form-data');
|
|
9
|
-
const chalk = require('chalk');
|
|
10
|
-
const crypto = require('crypto');
|
|
11
|
-
const fs = require('fs');
|
|
12
|
-
const path = require('path');
|
|
13
|
-
|
|
14
|
-
const config = JSON.parse(process.env?.reporting_config);
|
|
15
|
-
const screenshotsConfig = JSON.parse(process.env?.screenshots_config);
|
|
16
|
-
|
|
17
|
-
let hashesMap = {};
|
|
18
|
-
|
|
19
|
-
let customBoundary = '----------------------------';
|
|
20
|
-
crypto.randomBytes(24).forEach((value) => {
|
|
21
|
-
customBoundary += Math.floor(value * 10).toString(16);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
class CustomBoundaryFormData extends FormData {
|
|
25
|
-
constructor() {
|
|
26
|
-
super();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
getBoundary() {
|
|
30
|
-
return customBoundary;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const getCaseId = (str) => {
|
|
35
|
-
const regexp = /(\(Qase ID ([\d,]+)\))/;
|
|
36
|
-
const results = regexp.exec(str);
|
|
37
|
-
if (results && results.length === 3) {
|
|
38
|
-
return results[2].split(',').map((value) => Number.parseInt(value, 10));
|
|
39
|
-
}
|
|
40
|
-
return [];
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const getFiles = (pathToFile) => {
|
|
44
|
-
const files = [];
|
|
45
|
-
for (const file of fs.readdirSync(pathToFile)) {
|
|
46
|
-
const fullPath = `${pathToFile}/${file}`;
|
|
47
|
-
|
|
48
|
-
if(fs.lstatSync(fullPath).isDirectory()) {
|
|
49
|
-
getFiles(fullPath).forEach((x) => files.push(`${file}/${x}`));
|
|
50
|
-
} else {
|
|
51
|
-
files.push(file);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return files;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const parseScreenshotDirectory = () => {
|
|
58
|
-
const pathToScreenshotDir = path.join(process.cwd(), `cypress/${screenshotsConfig.screenshotFolder}`);
|
|
59
|
-
const files = getFiles(pathToScreenshotDir);
|
|
60
|
-
const filePathesByCaseIdMap = {};
|
|
61
|
-
|
|
62
|
-
files.forEach((file) => {
|
|
63
|
-
if(file.includes('Qase ID')) {
|
|
64
|
-
const caseIds = getCaseId(file);
|
|
65
|
-
|
|
66
|
-
if (caseIds) {
|
|
67
|
-
caseIds.forEach((caseId) => {
|
|
68
|
-
const attachmentObject = {
|
|
69
|
-
caseId,
|
|
70
|
-
file: [file],
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
filePathesByCaseIdMap[caseId] = attachmentObject;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
return filePathesByCaseIdMap;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const publishBulkResult = async () => {
|
|
83
|
-
if (config) {
|
|
84
|
-
console.log('Publication is started');
|
|
85
|
-
|
|
86
|
-
const api = new QaseApi(config.apiToken, config.basePath, config.headers, CustomBoundaryFormData);
|
|
87
|
-
|
|
88
|
-
if (screenshotsConfig.screenshotFolder && screenshotsConfig.sendScreenshot) {
|
|
89
|
-
try {
|
|
90
|
-
const filePathesByCaseIdMap = parseScreenshotDirectory();
|
|
91
|
-
|
|
92
|
-
if (filePathesByCaseIdMap) {
|
|
93
|
-
const filesMap = Object.values(filePathesByCaseIdMap);
|
|
94
|
-
const uploadAttachmentsPromisesArray = filesMap.map(async (failedCase) => {
|
|
95
|
-
const caseId = failedCase.caseId;
|
|
96
|
-
|
|
97
|
-
const pathToFile = `./cypress/${screenshotsConfig.screenshotFolder}/${failedCase.file[0]}`;
|
|
98
|
-
|
|
99
|
-
const data = fs.createReadStream(pathToFile);
|
|
100
|
-
|
|
101
|
-
const options = {
|
|
102
|
-
headers: {
|
|
103
|
-
'Content-Type':
|
|
104
|
-
'multipart/form-data; boundary=' + customBoundary,
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
if (data) {
|
|
109
|
-
const resp = await api.attachments.uploadAttachment(
|
|
110
|
-
config.code,
|
|
111
|
-
[data],
|
|
112
|
-
options
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
hash: resp.data.result?.[0].hash,
|
|
117
|
-
caseId,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
const responses = await Promise.all(uploadAttachmentsPromisesArray);
|
|
123
|
-
|
|
124
|
-
hashesMap = responses.reduce((accum, value) => {
|
|
125
|
-
accum[value.caseId] = value.hash;
|
|
126
|
-
return accum;
|
|
127
|
-
}, {});
|
|
128
|
-
}
|
|
129
|
-
} catch (error) {
|
|
130
|
-
console.log(chalk`{red Error during sending screenshots ${error}}`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
try {
|
|
135
|
-
const { body } = config;
|
|
136
|
-
|
|
137
|
-
if (hashesMap) {
|
|
138
|
-
const results = body.results;
|
|
139
|
-
|
|
140
|
-
const resultsWithAttachmentHashes = results.map(((result) => {
|
|
141
|
-
if (hashesMap[result.case_id]) {
|
|
142
|
-
return {
|
|
143
|
-
...result,
|
|
144
|
-
attachments: [hashesMap[result.case_id]],
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return result;
|
|
149
|
-
}));
|
|
150
|
-
|
|
151
|
-
body.results = resultsWithAttachmentHashes;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const res = await api.results.createResultBulk(
|
|
155
|
-
config.code,
|
|
156
|
-
config.runId,
|
|
157
|
-
body
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
if (res.status === 200) {
|
|
161
|
-
console.log(chalk`{green Results sent}`);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if(config.runComplete) {
|
|
165
|
-
await api.runs.completeRun(config.code, config.runId);
|
|
166
|
-
console.log(chalk`{green Run compleated}`);
|
|
167
|
-
}
|
|
168
|
-
} catch (error) {
|
|
169
|
-
console.log('Error till publishing', error);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
publishBulkResult();
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { qase } from 'cypress-qase-reporter/dist/mocha';
|
|
2
|
-
|
|
3
|
-
describe('My First Test', () => {
|
|
4
|
-
qase(1, it('clicking "type" navigates to a new url', () => {
|
|
5
|
-
cy.visit('https://example.cypress.io');
|
|
6
|
-
|
|
7
|
-
cy.contains('type').click();
|
|
8
|
-
|
|
9
|
-
// Should be on a new URL which includes '/commands/actions'
|
|
10
|
-
cy.url().should('include', '/commands/actions');
|
|
11
|
-
}));
|
|
12
|
-
|
|
13
|
-
qase(2, it('Gets, types and asserts', () => {
|
|
14
|
-
cy.visit('https://example.cypress.io');
|
|
15
|
-
|
|
16
|
-
cy.contains('type').click();
|
|
17
|
-
|
|
18
|
-
// Should be on a new URL which includes '/commands/actions'
|
|
19
|
-
cy.url().should('include', '/commands/actions');
|
|
20
|
-
// Get an input, type into it and verify that the value has been updated
|
|
21
|
-
cy.get('.action-email')
|
|
22
|
-
.type('fake@email.com')
|
|
23
|
-
.should('have.value', 'unexpected@email.com');
|
|
24
|
-
}));
|
|
25
|
-
|
|
26
|
-
qase(3, it.skip('Gets, types and asserts', () => {
|
|
27
|
-
cy.visit('https://example.cypress.io');
|
|
28
|
-
|
|
29
|
-
cy.contains('type').click();
|
|
30
|
-
|
|
31
|
-
// Should be on a new URL which includes '/commands/actions'
|
|
32
|
-
cy.url().should('include', '/commands/actions');
|
|
33
|
-
|
|
34
|
-
// Get an input, type into it and verify that the value has been updated
|
|
35
|
-
cy.get('.action-email')
|
|
36
|
-
.type('fake@email.com')
|
|
37
|
-
.should('have.value', 'unexpected@email.com');
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
|
-
it('Go to utilities', () => {
|
|
41
|
-
cy.visit('https://example.cypress.io');
|
|
42
|
-
|
|
43
|
-
cy.contains('Utilities').click();
|
|
44
|
-
|
|
45
|
-
// Should be on a new URL which includes 'utilities'
|
|
46
|
-
cy.url().should('include', 'utilities');
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
describe('Test Suite - Level 2', () => {
|
|
50
|
-
it('Go to Cypress API', () => {
|
|
51
|
-
cy.visit('https://example.cypress.io');
|
|
52
|
-
|
|
53
|
-
cy.contains('Cypress API').click();
|
|
54
|
-
|
|
55
|
-
// Should be on a new URL which includes 'utilities'
|
|
56
|
-
cy.url().should('include', 'cypress-api');
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/// <reference types="cypress" />
|
|
2
|
-
// ***********************************************************
|
|
3
|
-
// This example plugins/index.js can be used to load plugins
|
|
4
|
-
//
|
|
5
|
-
// You can change the location of this file or turn off loading
|
|
6
|
-
// the plugins file with the 'pluginsFile' configuration option.
|
|
7
|
-
//
|
|
8
|
-
// You can read more here:
|
|
9
|
-
// https://on.cypress.io/plugins-guide
|
|
10
|
-
// ***********************************************************
|
|
11
|
-
|
|
12
|
-
// This function is called when a project is opened or re-opened (e.g. due to
|
|
13
|
-
// the project's config changing)
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @type {Cypress.PluginConfig}
|
|
17
|
-
*/
|
|
18
|
-
module.exports = (on, config) => {
|
|
19
|
-
// `on` is used to hook into various events Cypress emits
|
|
20
|
-
// `config` is the resolved Cypress config
|
|
21
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// ***********************************************
|
|
2
|
-
// This example commands.js shows you how to
|
|
3
|
-
// create various custom commands and overwrite
|
|
4
|
-
// existing commands.
|
|
5
|
-
//
|
|
6
|
-
// For more comprehensive examples_cypress_v10 of custom
|
|
7
|
-
// commands please read more here:
|
|
8
|
-
// https://on.cypress.io/custom-commands
|
|
9
|
-
// ***********************************************
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// -- This is a parent command --
|
|
13
|
-
// Cypress.Commands.add("login", (email, password) => { ... })
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
// -- This is a child command --
|
|
17
|
-
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
// -- This is a dual command --
|
|
21
|
-
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
// -- This will overwrite an existing command --
|
|
25
|
-
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|