@allurereport/plugin-testops 3.13.1 → 3.13.2

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/dist/client.d.ts CHANGED
@@ -27,6 +27,7 @@ export declare class TestOpsClient {
27
27
  startUpload(ci: CiDescriptor): Promise<void>;
28
28
  stopUpload(ci: CiDescriptor, status: TestStatus): Promise<void>;
29
29
  createLaunch(launchName: string, launchTags: string[], gitContext?: LaunchGitContextDto): Promise<void>;
30
+ checkLaunchProgress(): Promise<boolean>;
30
31
  createSession(environment?: Record<string, unknown>): Promise<void>;
31
32
  get namedEnvs(): MapIterator<TestOpsNamedEnv>;
32
33
  getNamedEnvFor(id: string): TestOpsNamedEnv | undefined;
package/dist/client.js CHANGED
@@ -168,6 +168,14 @@ export class TestOpsClient {
168
168
  __classPrivateFieldSet(this, _TestOpsClient_launch, data, "f");
169
169
  __classPrivateFieldGet(this, _TestOpsClient_logger, "f").debug(`Launch created: id=${bold(data.id.toString())}`);
170
170
  }
171
+ async checkLaunchProgress() {
172
+ if (!__classPrivateFieldGet(this, _TestOpsClient_launch, "f")) {
173
+ throw new Error("Launch isn't created! Call createLaunch first");
174
+ }
175
+ __classPrivateFieldGet(this, _TestOpsClient_logger, "f").verbose("Retrieving launch progress status…");
176
+ const data = await __classPrivateFieldGet(this, _TestOpsClient_client, "f").get(`/api/launch/${__classPrivateFieldGet(this, _TestOpsClient_launch, "f").id}/progress`);
177
+ return data.ready;
178
+ }
171
179
  async createSession(environment = {}) {
172
180
  if (!__classPrivateFieldGet(this, _TestOpsClient_launch, "f")) {
173
181
  throw new Error("Launch isn't created! Call createLaunch first");
package/dist/plugin.js CHANGED
@@ -22,6 +22,8 @@ import { Logger } from "./logger.js";
22
22
  import { attachmentsResolverFactory, fixturesResolverFactory, resolvePluginOptions, unwrapStepsAttachments, } from "./utils/index.js";
23
23
  import { toUploadCategory } from "./utils/uploadCategory.js";
24
24
  import { uploadFilenameForLink } from "./utils/uploaderDto.js";
25
+ const LAUNCH_PROGRESS_POLL_DELAY_MS = 500;
26
+ const LAUNCH_PROGRESS_ATTEMPTS_LIMIT = 10;
25
27
  const categoryDisplayName = (cat) => cat.name ?? cat.grouping?.[0]?.name ?? cat.grouping?.[0]?.value ?? cat.grouping?.[0]?.key ?? cat.externalId;
26
28
  export class TestOpsPlugin {
27
29
  constructor(options, context = {}) {
@@ -132,15 +134,27 @@ export class TestOpsPlugin {
132
134
  __classPrivateFieldGet(this, _TestOpsPlugin_logger, "f").info(`Upload finished. Allure TestOps Launch: ${__classPrivateFieldGet(this, _TestOpsPlugin_client, "f").launchUrl}`);
133
135
  return;
134
136
  }
135
- try {
136
- await __classPrivateFieldGet(this, _TestOpsPlugin_client, "f").closeLaunch(launchId);
137
+ let launchIsReady = false;
138
+ for (let attempt = 0; attempt < LAUNCH_PROGRESS_ATTEMPTS_LIMIT; attempt += 1) {
139
+ launchIsReady = await __classPrivateFieldGet(this, _TestOpsPlugin_client, "f").checkLaunchProgress();
140
+ if (launchIsReady) {
141
+ break;
142
+ }
143
+ if (attempt < LAUNCH_PROGRESS_ATTEMPTS_LIMIT - 1) {
144
+ await new Promise((resolve) => setTimeout(resolve, LAUNCH_PROGRESS_POLL_DELAY_MS));
145
+ }
137
146
  }
138
- catch (err) {
139
- if (err instanceof Error) {
140
- __classPrivateFieldGet(this, _TestOpsPlugin_logger, "f").debug(`Failed to close launch: ${err.message}`);
147
+ if (launchIsReady) {
148
+ try {
149
+ await __classPrivateFieldGet(this, _TestOpsPlugin_client, "f").closeLaunch(launchId);
141
150
  }
142
- else {
143
- __classPrivateFieldGet(this, _TestOpsPlugin_logger, "f").debug("Failed to close launch");
151
+ catch (err) {
152
+ if (err instanceof Error) {
153
+ __classPrivateFieldGet(this, _TestOpsPlugin_logger, "f").debug(`Failed to close launch: ${err.message}`);
154
+ }
155
+ else {
156
+ __classPrivateFieldGet(this, _TestOpsPlugin_logger, "f").debug("Failed to close launch");
157
+ }
144
158
  }
145
159
  }
146
160
  __classPrivateFieldGet(this, _TestOpsPlugin_logger, "f").info(`Upload finished. Allure TestOps Launch: ${__classPrivateFieldGet(this, _TestOpsPlugin_client, "f").launchUrl}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/plugin-testops",
3
- "version": "3.13.1",
3
+ "version": "3.13.2",
4
4
  "description": "Allure Plugin TestOps",
5
5
  "keywords": [
6
6
  "allure",
@@ -32,14 +32,14 @@
32
32
  "lint:fix": "oxlint --import-plugin --fix src test features stories"
33
33
  },
34
34
  "dependencies": {
35
- "@allurereport/ci": "3.13.1",
36
- "@allurereport/core-api": "3.13.1",
37
- "@allurereport/git": "3.13.1",
38
- "@allurereport/plugin-api": "3.13.1",
39
- "@allurereport/reader-api": "3.13.1",
40
- "@allurereport/service": "3.13.1",
41
- "axios": "^1.15.2",
42
- "form-data": "^4.0.5",
35
+ "@allurereport/ci": "3.13.2",
36
+ "@allurereport/core-api": "3.13.2",
37
+ "@allurereport/git": "3.13.2",
38
+ "@allurereport/plugin-api": "3.13.2",
39
+ "@allurereport/reader-api": "3.13.2",
40
+ "@allurereport/service": "3.13.2",
41
+ "axios": "^1.18.1",
42
+ "form-data": "^4.0.6",
43
43
  "lodash-es": "^4.18.1",
44
44
  "p-limit": "^7.3.0",
45
45
  "progress": "^2.0.3",