testit-adapter-cypress 5.0.9-TMS-5.8 → 5.1.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
@@ -137,11 +137,13 @@ first-job:
137
137
  Methods can be used to specify information about autotest.
138
138
 
139
139
  Description of methods:
140
- - `tms.addWorkItemIds` - a dynamic method that links autotests with manual tests. Receives the array of manual tests' IDs
140
+ - `tms.addWorkItemId` - a dynamic method that links an autotest with a manual test. Receives a single globalId
141
+ - `tms.addWorkItemIds` - deprecated, use `tms.addWorkItemId` instead
141
142
  - `tms.addDisplayName` - a dynamic method for adding internal autotest name (used in Test IT)
142
143
  - `tms.addTitle` - a dynamic method for adding autotest name specified in the autotest card. If not specified, the name from the displayName method is used
143
144
  - `tms.addDescription` - a dynamic method for adding autotest description specified in the autotest card
144
145
  - `tms.addLabels` - a dynamic method for adding labels listed in the autotest card
146
+ - `tms.addLayer` - test pyramid layer in the autotest card (source **Run**). Use `TestLayers` from `testit-js-commons` for recommended values, or any custom string
145
147
  - `tms.addTags` - a dynamic method for adding tags listed in the autotest card
146
148
  - `tms.addLinks` - links in the autotest result
147
149
  - `tms.addAttachments` - uploading files in the autotest result
@@ -156,16 +158,18 @@ Description of methods:
156
158
  #### Simple test
157
159
  ```ts
158
160
  import { getTestRuntime } from "testit-adapter-cypress/runtime";
161
+ import { TestLayers } from "testit-js-commons";
159
162
 
160
163
  describe('example to-do app', () => {
161
164
  it('displays two todo items by default', () => {
162
165
  const tms = getTestRuntime();
163
166
 
164
- tms.addWorkItemIds('123', '321');
167
+ tms.addWorkItemId('123');
165
168
  tms.addDisplayName('display name');
166
169
  tms.addTitle('test title');
167
170
  tms.addDescription('Test description');
168
171
  tms.addLabels('label1', 'label2');
172
+ tms.addLayer(TestLayers.API);
169
173
  tms.addTags('tag1', 'tag2');
170
174
  tms.addLinks(
171
175
  {
@@ -6,8 +6,13 @@ declare class TmsCypressTestRuntime implements TestRuntime {
6
6
  #private;
7
7
  constructor();
8
8
  addLabels(...labels: string[]): PromiseLike<void>;
9
+ addLayer(layer: string): PromiseLike<void>;
9
10
  addTags(...tags: string[]): PromiseLike<void>;
10
11
  addLinks(...links: Link[]): PromiseLike<void>;
12
+ addWorkItemId(globalId: string): PromiseLike<void>;
13
+ /**
14
+ * @deprecated Use addWorkItemId with a single globalId instead.
15
+ */
11
16
  addWorkItemIds(...workItemIds: string[]): PromiseLike<void>;
12
17
  addParameter(name: string, value: string): PromiseLike<void>;
13
18
  addDescription(description: string): PromiseLike<void>;
@@ -27,6 +27,14 @@ class TmsCypressTestRuntime {
27
27
  },
28
28
  });
29
29
  }
30
+ addLayer(layer) {
31
+ return __classPrivateFieldGet(this, _TmsCypressTestRuntime_instances, "m", _TmsCypressTestRuntime_enqueueMessageAsync).call(this, {
32
+ type: "metadata",
33
+ data: {
34
+ layer,
35
+ },
36
+ });
37
+ }
30
38
  addTags(...tags) {
31
39
  return __classPrivateFieldGet(this, _TmsCypressTestRuntime_instances, "m", _TmsCypressTestRuntime_enqueueMessageAsync).call(this, {
32
40
  type: "metadata",
@@ -43,7 +51,19 @@ class TmsCypressTestRuntime {
43
51
  },
44
52
  });
45
53
  }
54
+ addWorkItemId(globalId) {
55
+ return __classPrivateFieldGet(this, _TmsCypressTestRuntime_instances, "m", _TmsCypressTestRuntime_enqueueMessageAsync).call(this, {
56
+ type: "metadata",
57
+ data: {
58
+ workItemId: globalId,
59
+ },
60
+ });
61
+ }
62
+ /**
63
+ * @deprecated Use addWorkItemId with a single globalId instead.
64
+ */
46
65
  addWorkItemIds(...workItemIds) {
66
+ console.warn("addWorkItemIds is deprecated. Use addWorkItemId with a single globalId instead.");
47
67
  return __classPrivateFieldGet(this, _TmsCypressTestRuntime_instances, "m", _TmsCypressTestRuntime_enqueueMessageAsync).call(this, {
48
68
  type: "metadata",
49
69
  data: {
@@ -14,8 +14,13 @@ export interface AttachmentOptions {
14
14
  }
15
15
  export interface TestRuntime {
16
16
  addLabels(...labels: string[]): PromiseLike<void>;
17
+ addLayer(layer: string): PromiseLike<void>;
17
18
  addTags(...tags: string[]): PromiseLike<void>;
18
19
  addLinks(...links: Link[]): PromiseLike<void>;
20
+ addWorkItemId(globalId: string): PromiseLike<void>;
21
+ /**
22
+ * @deprecated Use addWorkItemId with a single globalId instead.
23
+ */
19
24
  addWorkItemIds(...workItemIds: string[]): PromiseLike<void>;
20
25
  addParameter(name: string, value: string): PromiseLike<void>;
21
26
  addDescription(markdown: string): PromiseLike<void>;
@@ -11,8 +11,10 @@ var ContentType;
11
11
  const noop = { then: () => noop, catch: () => noop };
12
12
  exports.noopRuntime = {
13
13
  addLabels: () => noop,
14
+ addLayer: () => noop,
14
15
  addTags: () => noop,
15
16
  addLinks: () => noop,
17
+ addWorkItemId: () => noop,
16
18
  addWorkItemIds: () => noop,
17
19
  addParameter: () => noop,
18
20
  addDescription: () => noop,
@@ -24,6 +24,7 @@ export interface TestData {
24
24
  namespace?: string;
25
25
  classname?: string;
26
26
  labels: string[];
27
+ layer?: string;
27
28
  tags: string[];
28
29
  links: Link[];
29
30
  workItemIds: string[];
package/dist/converter.js CHANGED
@@ -44,6 +44,7 @@ function toAutotestPost(specPath, t) {
44
44
  classname: t.classname,
45
45
  links: t.links?.length ? t.links : [],
46
46
  labels: t.labels?.map((l) => ({ name: l })) ?? [],
47
+ layer: t.layer,
47
48
  tags: t.tags?.length ? t.tags : [],
48
49
  steps: t.steps.map(s => stepDataToShortStep(s)),
49
50
  externalKey: t.externalKey,
@@ -174,9 +174,11 @@ type RuntimeMessageBase<T extends string> = {
174
174
  export type RuntimeMetadataMessage = RuntimeMessageBase<"metadata"> & {
175
175
  data: {
176
176
  labels?: Label[];
177
+ layer?: string;
177
178
  links?: Link[];
178
179
  tags?: string[];
179
180
  workItemIds?: string[];
181
+ workItemId?: string;
180
182
  parameters?: Parameter[];
181
183
  description?: string;
182
184
  displayName?: string;
package/dist/reporter.js CHANGED
@@ -406,12 +406,19 @@ class TmsCypress {
406
406
  if (data.labels?.length) {
407
407
  current.labels.push(...data.labels);
408
408
  }
409
+ if (data.layer) {
410
+ current.layer = data.layer;
411
+ }
409
412
  if (data.tags?.length) {
410
413
  current.tags.push(...data.tags);
411
414
  }
412
415
  if (data.workItemIds?.length) {
416
+ console.warn("addWorkItemIds is deprecated. Use addWorkItemId with a single globalId instead.");
413
417
  current.workItemIds.push(...data.workItemIds);
414
418
  }
419
+ if (data.workItemId) {
420
+ current.workItemIds = [data.workItemId];
421
+ }
415
422
  if (data.links?.length) {
416
423
  current.links.push(...data.links);
417
424
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testit-adapter-cypress",
3
- "version": "5.0.9-TMS-5.8",
3
+ "version": "5.1.0",
4
4
  "description": "Cypress adapter for Test IT",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -42,7 +42,7 @@
42
42
  "@types/node": "^20.14.2"
43
43
  },
44
44
  "dependencies": {
45
- "testit-js-commons": "5.0.9-TMS-5.8"
45
+ "testit-js-commons": "5.1.0"
46
46
  },
47
47
  "files": [
48
48
  "dist"