@allurereport/plugin-testops 3.20.1 → 3.21.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 +10 -10
- package/dist/client.js +1 -1
- package/dist/plugin.js +2 -2
- package/dist/utils/fixtures.js +1 -15
- package/dist/utils/steps.d.ts +3 -0
- package/dist/utils/steps.js +18 -0
- package/dist/utils/testResults.js +1 -17
- package/package.json +12 -9
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ The plugin can create a new launch in Allure TestOps with all the tests data fro
|
|
|
16
16
|
|
|
17
17
|
## CI and local runs
|
|
18
18
|
|
|
19
|
-
The plugin is intended to run in a **CI environment**. When a supported CI is detected, upload to TestOps starts automatically (as long as `accessToken`, `endpoint`, and `projectId` are configured).
|
|
19
|
+
The plugin is intended to run in a **CI environment**. When a supported CI is detected, upload to Allure TestOps starts automatically (as long as `accessToken`, `endpoint`, and `projectId` are configured).
|
|
20
20
|
|
|
21
21
|
On a **local machine** (no CI detected), upload is disabled by default.
|
|
22
22
|
|
|
@@ -24,7 +24,7 @@ To upload from your machine anyway, opt in with one of these environment variabl
|
|
|
24
24
|
|
|
25
25
|
| Environment variable | Purpose |
|
|
26
26
|
|----------------------------|---------|
|
|
27
|
-
| `ALLURE_TESTOPS_ENABLED` | Explicitly enable TestOps upload outside CI |
|
|
27
|
+
| `ALLURE_TESTOPS_ENABLED` | Explicitly enable Allure TestOps upload outside CI |
|
|
28
28
|
| `CI` | Same effect; useful if your tooling already sets `CI` in non-CI workflows |
|
|
29
29
|
|
|
30
30
|
Example:
|
|
@@ -55,7 +55,7 @@ export default defineConfig({
|
|
|
55
55
|
plugins: {
|
|
56
56
|
+ testops: {
|
|
57
57
|
+ options: {
|
|
58
|
-
+ launchName: "Hello, TestOps!",
|
|
58
|
+
+ launchName: "Hello, Allure TestOps!",
|
|
59
59
|
+ launchTags: ["tag1", "tag2"],
|
|
60
60
|
+ accessToken: "your_testops_access_token",
|
|
61
61
|
+ endpoint: "https://your-testops-instance.com",
|
|
@@ -74,14 +74,14 @@ The plugin accepts the following options:
|
|
|
74
74
|
|--------------------|-----------------------------------------------------------------------------|-----------|-----------------|
|
|
75
75
|
| `launchName` | Name of the report which will be assigned to the new launch | `string` | `Allure Report` |
|
|
76
76
|
| `launchTags` | Tags to be assigned to the new launch | `string[]`| `[]` |
|
|
77
|
-
| `accessToken` | Access token for TestOps API
|
|
78
|
-
| `endpoint` | TestOps API endpoint
|
|
79
|
-
| `projectId` | TestOps project ID
|
|
77
|
+
| `accessToken` | Access token for Allure TestOps API | `string` | `undefined` |
|
|
78
|
+
| `endpoint` | Allure TestOps API endpoint | `string` | `undefined` |
|
|
79
|
+
| `projectId` | Allure TestOps project ID | `string` | `undefined` |
|
|
80
80
|
| `autocloseLaunch` | When `true` (default), the launch is closed automatically when the plugin finishes; set to `false` to keep the launch open | `boolean` | `true` |
|
|
81
|
-
| `gitFlow` | When `true`, collect Git metadata for TestOps Git Flow on CI uploads (opt-in)
|
|
82
|
-
| `ancestorLimit` | How many ancestor commits to attach to the launch for history linking in TestOps | `number` | `100` |
|
|
83
|
-
| `uploadRateLimit` | Caps how fast uploads are sent to TestOps within a rolling time window (requests/files/bytes per window); pass `false` to disable pacing entirely | `{ windowMs: number; maxRequestsPerWindow?: number; maxFilesPerWindow?: number; maxBytesPerWindow?: number } \| false` | `20` req/s, `1000` files/s, `1 GiB`/s |
|
|
84
|
-
| `reopenClosedLaunch` | When `true`, a launch that TestOps reports as closed is reopened automatically instead of failing the upload | `boolean` | `false` |
|
|
81
|
+
| `gitFlow` | When `true`, collect Git metadata for Allure TestOps Git Flow on CI uploads (opt-in) | `boolean` | `false` |
|
|
82
|
+
| `ancestorLimit` | How many ancestor commits to attach to the launch for history linking in Allure TestOps | `number` | `100` |
|
|
83
|
+
| `uploadRateLimit` | Caps how fast uploads are sent to Allure TestOps within a rolling time window (requests/files/bytes per window); pass `false` to disable pacing entirely | `{ windowMs: number; maxRequestsPerWindow?: number; maxFilesPerWindow?: number; maxBytesPerWindow?: number } \| false` | `20` req/s, `1000` files/s, `1 GiB`/s |
|
|
84
|
+
| `reopenClosedLaunch` | When `true`, a launch that Allure TestOps reports as closed is reopened automatically instead of failing the upload | `boolean` | `false` |
|
|
85
85
|
|
|
86
86
|
### Using options from environment variables
|
|
87
87
|
|
package/dist/client.js
CHANGED
|
@@ -300,7 +300,7 @@ export class TestOpsClient {
|
|
|
300
300
|
}
|
|
301
301
|
totalBytes += attachmentByteLength(attachment);
|
|
302
302
|
formData.append("file", attachment.content, {
|
|
303
|
-
filename: attachment.originalFileName,
|
|
303
|
+
filename: "name" in attachmentLink && attachmentLink.name ? attachmentLink.name : attachment.originalFileName,
|
|
304
304
|
contentType: attachment.contentType,
|
|
305
305
|
});
|
|
306
306
|
hasResolvedAttachments = true;
|
package/dist/plugin.js
CHANGED
|
@@ -12,7 +12,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
var _TestOpsPlugin_instances, _TestOpsPlugin_logger, _TestOpsPlugin_ci, _TestOpsPlugin_client, _TestOpsPlugin_launchName, _TestOpsPlugin_launchTags, _TestOpsPlugin_uploadedTestResultsIds, _TestOpsPlugin_uploadedGlobalAttachmentIds, _TestOpsPlugin_uploadedGlobalErrors, _TestOpsPlugin_autocloseLaunch, _TestOpsPlugin_launchStarted, _TestOpsPlugin_reopenClosedLaunch, _TestOpsPlugin_skippedUploadCycle, _TestOpsPlugin_launchId, _TestOpsPlugin_gitFlow, _TestOpsPlugin_enabledByConfig, _TestOpsPlugin_uploadQueue, _TestOpsPlugin_reopenLaunchIfClosed, _TestOpsPlugin_logDeferredUpload, _TestOpsPlugin_retryHooks, _TestOpsPlugin_logUploadFailure, _TestOpsPlugin_uploadQualityGateResults, _TestOpsPlugin_uploadGlobalErrors, _TestOpsPlugin_uploadGlobalAttachments, _TestOpsPlugin_uploadTestResults, _TestOpsPlugin_upload, _TestOpsPlugin_trsToUpload, _TestOpsPlugin_startUpload, _TestOpsPlugin_stopUpload;
|
|
13
13
|
import { env } from "node:process";
|
|
14
14
|
import { applyAllureCiEnv, detect, isLocalCiDescriptor } from "@allurereport/ci";
|
|
15
|
-
import { createProgressLogger } from "@allurereport/cli-commons";
|
|
15
|
+
import { createProgressLogger, getGlobalLogLevel } from "@allurereport/cli-commons";
|
|
16
16
|
import { getWorstStatus } from "@allurereport/core-api";
|
|
17
17
|
import { createPluginSummary, } from "@allurereport/plugin-api";
|
|
18
18
|
import { uniqBy, stubTrue } from "lodash-es";
|
|
@@ -120,7 +120,7 @@ export class TestOpsPlugin {
|
|
|
120
120
|
if (!this.enabled) {
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
if (context.realTime) {
|
|
123
|
+
if (context.realTime && getGlobalLogLevel() === undefined) {
|
|
124
124
|
__classPrivateFieldGet(this, _TestOpsPlugin_logger, "f").setLogLevel("info");
|
|
125
125
|
}
|
|
126
126
|
__classPrivateFieldGet(this, _TestOpsPlugin_logger, "f").verbose("Starting upload…");
|
package/dist/utils/fixtures.js
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const toUploadStepDto = (step) => step.type === "attachment"
|
|
3
|
-
? { type: "attachment", attachment: toUploadAttachmentDto(step.link) }
|
|
4
|
-
: {
|
|
5
|
-
type: "body",
|
|
6
|
-
body: step.name,
|
|
7
|
-
status: step.status,
|
|
8
|
-
start: step.start,
|
|
9
|
-
stop: step.stop,
|
|
10
|
-
duration: step.duration,
|
|
11
|
-
message: typeof step.message === "string" ? step.message : undefined,
|
|
12
|
-
trace: typeof step.trace === "string" ? step.trace : undefined,
|
|
13
|
-
parameters: step.parameters,
|
|
14
|
-
steps: step.steps?.map(toUploadStepDto),
|
|
15
|
-
};
|
|
1
|
+
import { toUploadStepDto } from "./steps.js";
|
|
16
2
|
export const toUploadFixtureResultDto = (fxt) => ({
|
|
17
3
|
type: fxt.type,
|
|
18
4
|
uuid: fxt.id,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { toUploadAttachmentDto } from "./attachments.js";
|
|
2
|
+
export const toUploadStepDto = (step) => {
|
|
3
|
+
if (step.type === "attachment") {
|
|
4
|
+
return { type: "attachment", attachment: toUploadAttachmentDto(step.link) };
|
|
5
|
+
}
|
|
6
|
+
return {
|
|
7
|
+
type: "body",
|
|
8
|
+
body: step.name,
|
|
9
|
+
status: step.status,
|
|
10
|
+
start: step.start,
|
|
11
|
+
stop: step.stop,
|
|
12
|
+
duration: step.duration,
|
|
13
|
+
message: typeof step.message === "string" ? step.message : undefined,
|
|
14
|
+
trace: typeof step.trace === "string" ? step.trace : undefined,
|
|
15
|
+
parameters: step.parameters,
|
|
16
|
+
steps: step.steps?.map(toUploadStepDto),
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { toUploadAttachmentDto } from "./attachments.js";
|
|
2
2
|
import { calculateLegacyHistoryId } from "./legacyHistory.js";
|
|
3
|
+
import { toUploadStepDto } from "./steps.js";
|
|
3
4
|
import { validateExecutableName } from "./validation.js";
|
|
4
5
|
export const normalizeTestStepsResults = (steps) => {
|
|
5
6
|
if (!steps) {
|
|
@@ -16,23 +17,6 @@ export const normalizeTestStepsResults = (steps) => {
|
|
|
16
17
|
}
|
|
17
18
|
return projected;
|
|
18
19
|
};
|
|
19
|
-
const toUploadStepDto = (step) => {
|
|
20
|
-
if (step.type === "attachment") {
|
|
21
|
-
return { type: "attachment", attachment: toUploadAttachmentDto(step.link) };
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
type: "body",
|
|
25
|
-
body: step.name,
|
|
26
|
-
status: step.status,
|
|
27
|
-
start: step.start,
|
|
28
|
-
stop: step.stop,
|
|
29
|
-
duration: step.duration,
|
|
30
|
-
message: typeof step.message === "string" ? step.message : undefined,
|
|
31
|
-
trace: typeof step.trace === "string" ? step.trace : undefined,
|
|
32
|
-
parameters: step.parameters,
|
|
33
|
-
steps: step.steps?.map(toUploadStepDto),
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
20
|
const isObject = (v) => typeof v === "object" && v !== null;
|
|
37
21
|
const hasString = (obj, key) => typeof obj[key] === "string";
|
|
38
22
|
const normalizeCategory = (category) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-testops",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "Allure Plugin
|
|
3
|
+
"version": "3.21.0",
|
|
4
|
+
"description": "Allure TestOps Plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
7
7
|
"html",
|
|
@@ -28,17 +28,18 @@
|
|
|
28
28
|
"build": "run clean && tsc --project ./tsconfig.json",
|
|
29
29
|
"clean": "rimraf ./dist",
|
|
30
30
|
"test": "rimraf ./out && vitest run",
|
|
31
|
+
"test:unit": "yarn test",
|
|
31
32
|
"lint": "oxlint --import-plugin src test features stories",
|
|
32
33
|
"lint:fix": "oxlint --import-plugin --fix src test features stories"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@allurereport/ci": "3.
|
|
36
|
-
"@allurereport/cli-commons": "3.
|
|
37
|
-
"@allurereport/core-api": "3.
|
|
38
|
-
"@allurereport/git": "3.
|
|
39
|
-
"@allurereport/plugin-api": "3.
|
|
40
|
-
"@allurereport/reader-api": "3.
|
|
41
|
-
"@allurereport/service": "3.
|
|
36
|
+
"@allurereport/ci": "3.21.0",
|
|
37
|
+
"@allurereport/cli-commons": "3.21.0",
|
|
38
|
+
"@allurereport/core-api": "3.21.0",
|
|
39
|
+
"@allurereport/git": "3.21.0",
|
|
40
|
+
"@allurereport/plugin-api": "3.21.0",
|
|
41
|
+
"@allurereport/reader-api": "3.21.0",
|
|
42
|
+
"@allurereport/service": "3.21.0",
|
|
42
43
|
"axios": "^1.20.0",
|
|
43
44
|
"form-data": "^4.0.6",
|
|
44
45
|
"lodash-es": "^4.18.1",
|
|
@@ -46,9 +47,11 @@
|
|
|
46
47
|
"yoctocolors": "^2"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
50
|
+
"@allurereport/test-config": "3.21.0",
|
|
49
51
|
"@types/d3-shape": "^3.1.8",
|
|
50
52
|
"@types/lodash-es": "^4",
|
|
51
53
|
"@types/node": "^20",
|
|
54
|
+
"@vitest/coverage-istanbul": "^4.1.0",
|
|
52
55
|
"@vitest/runner": "^2",
|
|
53
56
|
"@vitest/snapshot": "^5.0.1",
|
|
54
57
|
"allure-js-commons": "^3",
|