testit-adapter-cypress 3.7.5 → 3.7.7

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
@@ -1,240 +1,240 @@
1
- # Test IT TMS adapters for Cypress
2
- ![Test IT](https://raw.githubusercontent.com/testit-tms/adapters-js/master/images/banner.png)
3
-
4
- ## Getting Started
5
-
6
- ### Installation
7
- ```
8
- npm install testit-adapter-cypress
9
- ```
10
-
11
- ## Usage
12
-
13
- ### Configuration
14
-
15
- | Description | File property | Environment variable |
16
- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|--------------------------------------------|
17
- | Location of the TMS instance | url | TMS_URL |
18
- | API secret key [How to getting API secret key?](https://github.com/testit-tms/.github/tree/main/configuration#privatetoken) | privateToken | TMS_PRIVATE_TOKEN |
19
- | ID of project in TMS instance [How to getting project ID?](https://github.com/testit-tms/.github/tree/main/configuration#projectid) | projectId | TMS_PROJECT_ID |
20
- | ID of configuration in TMS instance [How to getting configuration ID?](https://github.com/testit-tms/.github/tree/main/configuration#configurationid) | configurationId | TMS_CONFIGURATION_ID |
21
- | ID of the created test run in TMS instance.<br/>It's necessary for **adapterMode** 1 | testRunId | TMS_TEST_RUN_ID |
22
- | Parameter for specifying the name of test run in TMS instance (**It's optional**). If it is not provided, it is created automatically | testRunName | TMS_TEST_RUN_NAME |
23
- | Adapter mode. Default value - 1. The adapter supports following modes:<br>1 - in this mode, the adapter sends all results to the test run without filtering or [with filtering CLI](#run-with-filter)<br/>2 - in this mode, the adapter creates a new test run and sends results to the new test run | adapterMode | TMS_ADAPTER_MODE |
24
- | It enables/disables certificate validation (**It's optional**). Default value - true | certValidation | TMS_CERT_VALIDATION |
25
- | Mode of automatic creation test cases (**It's optional**). Default value - false. The adapter supports following modes:<br/>true - in this mode, the adapter will create a test case linked to the created autotest (not to the updated autotest)<br/>false - in this mode, the adapter will not create a test case | automaticCreationTestCases | TMS_AUTOMATIC_CREATION_TEST_CASES |
26
- | Mode of automatic updation links to test cases (**It's optional**). Default value - false. The adapter supports following modes:<br/>true - in this mode, the adapter will update links to test cases<br/>false - in this mode, the adapter will not update link to test cases | automaticUpdationLinksToTestCases | TMS_AUTOMATIC_UPDATION_LINKS_TO_TEST_CASES |
27
-
28
- Add Adapter to Cypress file configuration:
29
-
30
- ```ts
31
- import { tmsCypress } from "testit-adapter-cypress/reporter";
32
-
33
- export default {
34
- e2e: {
35
- setupNodeEvents(on, config) {
36
- tmsCypress(on, config);
37
-
38
- return config;
39
- },
40
- },
41
- };
42
- ```
43
-
44
- Add Adapter to `cypress/support/e2e.js`:
45
- ```ts
46
- import "testit-adapter-cypress";
47
- ```
48
-
49
- #### File
50
-
51
- Create .env config or file config with default name tms.config.json in the root directory of the project
52
-
53
- ```json
54
- {
55
- "url": "URL",
56
- "privateToken": "USER_PRIVATE_TOKEN",
57
- "projectId": "PROJECT_ID",
58
- "configurationId": "CONFIGURATION_ID",
59
- "testRunId": "TEST_RUN_ID",
60
- "testRunName": "TEST_RUN_NAME",
61
- "adapterMode": "ADAPTER_MODE",
62
- "automaticCreationTestCases": "AUTOMATIC_CREATION_TEST_CASES",
63
- "automaticUpdationLinksToTestCases": "AUTOMATIC_UPDATION_LINKS_TO_TEST_CASES"
64
- }
65
- ```
66
-
67
- #### Parallel run
68
- To create and complete TestRun you can use the Test IT CLI (use adapterMode 1 for parallel run):
69
-
70
- ```
71
- $ export TMS_TOKEN=<YOUR_TOKEN>
72
- $ testit testrun create
73
- --url https://tms.testit.software \
74
- --project-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
75
- --testrun-name "New test run" \
76
- --output tmp/output.txt
77
-
78
- $ export TMS_TEST_RUN_ID=$(cat tmp/output.txt)
79
-
80
- $ npx cypress run
81
-
82
- $ testit testrun complete
83
- --url https://tms.testit.software \
84
- --testrun-id $(cat tmp/output.txt)
85
- ```
86
-
87
- #### Run with filter
88
- It is necessary to use test filtering in cypress. This example uses the "@cypress/grep" plugin.
89
- To create filter by autotests you can use the Test IT CLI (use adapterMode 1 for run with filter):
90
-
91
- ```
92
- $ export TMS_TOKEN=<YOUR_TOKEN>
93
- $ testit autotests_filter
94
- --url https://tms.testit.software \
95
- --configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
96
- --testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
97
- --framework cypress \
98
- --output tmp/filter.txt
99
-
100
- $ export TMS_TEST_RUN_ID=6d4ac4b7-dd67-4805-b879-18da0b89d4a8
101
- $ export TMS_ADAPTER_MODE=1
102
-
103
- $ npx cypress run --expose grep="$(cat tmp/filter.txt)"
104
- ```
105
-
106
- #### Launch using GitLab repository
107
- To run your Cypress test's from GitLab to TestIT or in reverse order using "testit-adapter-cypress", you can take this .gitlab-ci.yml file example:
108
-
109
- ```
110
- image: node:latest
111
-
112
- stages:
113
- - run
114
-
115
- first-job:
116
- stage: run
117
- script:
118
- - npm install
119
- - npx cypress run
120
- artifacts:
121
- paths:
122
- - node_modules/
123
- ```
124
-
125
-
126
- ### Methods
127
-
128
- Methods can be used to specify information about autotest.
129
-
130
- Description of methods:
131
- - `tms.addWorkItemIds` - a dynamic method that links autotests with manual tests. Receives the array of manual tests' IDs
132
- - `tms.addDisplayName` - a dynamic method for adding internal autotest name (used in Test IT)
133
- - `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
134
- - `tms.addDescription` - a dynamic method for adding autotest description specified in the autotest card
135
- - `tms.addLabels` - a dynamic method for adding labels listed in the autotest card
136
- - `tms.addTags` - a dynamic method for adding tags listed in the autotest card
137
- - `tms.addLinks` - links in the autotest result
138
- - `tms.addAttachments` - uploading files in the autotest result
139
- - `tms.addMessage` - information about autotest in the autotest result
140
- - `tms.addNameSpace` - a dynamic method for adding directory in the TMS system (default - file's name of test)
141
- - `tms.addClassName` - a dynamic method for adding subdirectory in the TMS system (default - class's name of test)
142
- - `tms.addParameter` - a dynamic method for adding parameter in the autotest result
143
- - `tms.step` - usage in the "with" construct to designation a step in the body of the test
144
-
145
- ### Examples
146
-
147
- #### Simple test
148
- ```ts
149
- import { getTestRuntime } from "testit-adapter-cypress/runtime";
150
-
151
- describe('example to-do app', () => {
152
- it('displays two todo items by default', () => {
153
- const tms = getTestRuntime();
154
-
155
- tms.addWorkItemIds('123', '321');
156
- tms.addDisplayName('display name');
157
- tms.addTitle('test title');
158
- tms.addDescription('Test description');
159
- tms.addLabels('label1', 'label2');
160
- tms.addTags('tag1', 'tag2');
161
- tms.addLinks([
162
- {
163
- url: 'https://www.google.com',
164
- title: 'Google',
165
- description: 'This is a link to Google',
166
- type: 'Related',
167
- },
168
- ]);
169
- tms.addParameter("name", "value");
170
- tms.addNameSpace("namespace");
171
- tms.addClassName("classname");
172
-
173
- tms.step("step title", () => {
174
- // ...
175
- }).then((user) => {
176
- tms.step("inner step title", () => {
177
- // ...
178
- });
179
- });
180
- });
181
- });
182
- ```
183
-
184
- ### Parameterized test
185
-
186
- > [!WARNING]
187
- > When linking a parameterized autotest to a parameterized test case, please consider the problematic points:
188
- > - In TMS test cases have a table with parameters, but autotests do not. They are not equal entities, so there may be incompatibility in terms of parameters
189
- > - Running a parameterized test case, TMS expects the results of all related autotests with all the parameters specified in the test case table
190
- > - In TMS, the parameters are limited to the string type, so the adapter transmits absolutely all the autotest parameters as a string. This implies the following problematic point for the test case table
191
- > - TMS expects a complete **textual** match of the name and value of the parameters of the test case table with the autotest parameters
192
-
193
- ```ts
194
- import { getTestRuntime } from "testit-adapter-cypress/runtime";
195
-
196
- describe('example to-do app', () => {
197
- const tests = [2, 3, "string", false];
198
-
199
- tests.forEach((value) => {
200
- it(`3 is ${value}`, () => {
201
- const tms = getTestRuntime();
202
-
203
- tms.addParameter("name", value);
204
- // ...
205
- });
206
- });
207
- });
208
- ```
209
-
210
- #### Content types
211
- ```
212
- TEXT = "text/plain",
213
- XML = "application/xml",
214
- HTML = "text/html",
215
- CSV = "text/csv",
216
- TSV = "text/tab-separated-values",
217
- CSS = "text/css",
218
- URI = "text/uri-list",
219
- SVG = "image/svg+xml",
220
- PNG = "image/png",
221
- JSON = "application/json",
222
- ZIP = "application/zip",
223
- WEBM = "video/webm",
224
- JPEG = "image/jpeg",
225
- MP4 = "video/mp4",
226
- ```
227
-
228
- # Contributing
229
-
230
- You can help to develop the project. Any contributions are **greatly appreciated**.
231
-
232
- * If you have suggestions for adding or removing projects, feel free to [open an issue](https://github.com/testit-tms/adapters-js/issues/new) to discuss it, or directly create a pull request after you edit the *README.md* file with necessary changes.
233
- * Please make sure you check your spelling and grammar.
234
- * Create individual PR for each suggestion.
235
- * Please also read through the [Code Of Conduct](https://github.com/testit-tms/adapters-js/blob/master/CODE_OF_CONDUCT.md) before posting your first idea as well.
236
-
237
- # License
238
-
239
- Distributed under the Apache-2.0 License. See [LICENSE](https://github.com/testit-tms/adapters-js/blob/master/LICENSE.md) for more information.
240
-
1
+ # Test IT TMS adapters for Cypress
2
+ ![Test IT](https://raw.githubusercontent.com/testit-tms/adapters-js/master/images/banner.png)
3
+
4
+ ## Getting Started
5
+
6
+ ### Installation
7
+ ```
8
+ npm install testit-adapter-cypress
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Configuration
14
+
15
+ | Description | File property | Environment variable |
16
+ |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|--------------------------------------------|
17
+ | Location of the TMS instance | url | TMS_URL |
18
+ | API secret key [How to getting API secret key?](https://github.com/testit-tms/.github/tree/main/configuration#privatetoken) | privateToken | TMS_PRIVATE_TOKEN |
19
+ | ID of project in TMS instance [How to getting project ID?](https://github.com/testit-tms/.github/tree/main/configuration#projectid) | projectId | TMS_PROJECT_ID |
20
+ | ID of configuration in TMS instance [How to getting configuration ID?](https://github.com/testit-tms/.github/tree/main/configuration#configurationid) | configurationId | TMS_CONFIGURATION_ID |
21
+ | ID of the created test run in TMS instance.<br/>It's necessary for **adapterMode** 1 | testRunId | TMS_TEST_RUN_ID |
22
+ | Parameter for specifying the name of test run in TMS instance (**It's optional**). If it is not provided, it is created automatically | testRunName | TMS_TEST_RUN_NAME |
23
+ | Adapter mode. Default value - 1. The adapter supports following modes:<br>1 - in this mode, the adapter sends all results to the test run without filtering or [with filtering CLI](#run-with-filter)<br/>2 - in this mode, the adapter creates a new test run and sends results to the new test run | adapterMode | TMS_ADAPTER_MODE |
24
+ | It enables/disables certificate validation (**It's optional**). Default value - true | certValidation | TMS_CERT_VALIDATION |
25
+ | Mode of automatic creation test cases (**It's optional**). Default value - false. The adapter supports following modes:<br/>true - in this mode, the adapter will create a test case linked to the created autotest (not to the updated autotest)<br/>false - in this mode, the adapter will not create a test case | automaticCreationTestCases | TMS_AUTOMATIC_CREATION_TEST_CASES |
26
+ | Mode of automatic updation links to test cases (**It's optional**). Default value - false. The adapter supports following modes:<br/>true - in this mode, the adapter will update links to test cases<br/>false - in this mode, the adapter will not update link to test cases | automaticUpdationLinksToTestCases | TMS_AUTOMATIC_UPDATION_LINKS_TO_TEST_CASES |
27
+
28
+ Add Adapter to Cypress file configuration:
29
+
30
+ ```ts
31
+ import { tmsCypress } from "testit-adapter-cypress/reporter";
32
+
33
+ export default {
34
+ e2e: {
35
+ setupNodeEvents(on, config) {
36
+ tmsCypress(on, config);
37
+
38
+ return config;
39
+ },
40
+ },
41
+ };
42
+ ```
43
+
44
+ Add Adapter to `cypress/support/e2e.js`:
45
+ ```ts
46
+ import "testit-adapter-cypress";
47
+ ```
48
+
49
+ #### File
50
+
51
+ Create .env config or file config with default name tms.config.json in the root directory of the project
52
+
53
+ ```json
54
+ {
55
+ "url": "URL",
56
+ "privateToken": "USER_PRIVATE_TOKEN",
57
+ "projectId": "PROJECT_ID",
58
+ "configurationId": "CONFIGURATION_ID",
59
+ "testRunId": "TEST_RUN_ID",
60
+ "testRunName": "TEST_RUN_NAME",
61
+ "adapterMode": "ADAPTER_MODE",
62
+ "automaticCreationTestCases": "AUTOMATIC_CREATION_TEST_CASES",
63
+ "automaticUpdationLinksToTestCases": "AUTOMATIC_UPDATION_LINKS_TO_TEST_CASES"
64
+ }
65
+ ```
66
+
67
+ #### Parallel run
68
+ To create and complete TestRun you can use the Test IT CLI (use adapterMode 1 for parallel run):
69
+
70
+ ```
71
+ $ export TMS_TOKEN=<YOUR_TOKEN>
72
+ $ testit testrun create
73
+ --url https://tms.testit.software \
74
+ --project-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
75
+ --testrun-name "New test run" \
76
+ --output tmp/output.txt
77
+
78
+ $ export TMS_TEST_RUN_ID=$(cat tmp/output.txt)
79
+
80
+ $ npx cypress run
81
+
82
+ $ testit testrun complete
83
+ --url https://tms.testit.software \
84
+ --testrun-id $(cat tmp/output.txt)
85
+ ```
86
+
87
+ #### Run with filter
88
+ It is necessary to use test filtering in cypress. This example uses the "@cypress/grep" plugin.
89
+ To create filter by autotests you can use the Test IT CLI (use adapterMode 1 for run with filter):
90
+
91
+ ```
92
+ $ export TMS_TOKEN=<YOUR_TOKEN>
93
+ $ testit autotests_filter
94
+ --url https://tms.testit.software \
95
+ --configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
96
+ --testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
97
+ --framework cypress \
98
+ --output tmp/filter.txt
99
+
100
+ $ export TMS_TEST_RUN_ID=6d4ac4b7-dd67-4805-b879-18da0b89d4a8
101
+ $ export TMS_ADAPTER_MODE=1
102
+
103
+ $ npx cypress run --expose grep="$(cat tmp/filter.txt)"
104
+ ```
105
+
106
+ #### Launch using GitLab repository
107
+ To run your Cypress test's from GitLab to TestIT or in reverse order using "testit-adapter-cypress", you can take this .gitlab-ci.yml file example:
108
+
109
+ ```
110
+ image: node:latest
111
+
112
+ stages:
113
+ - run
114
+
115
+ first-job:
116
+ stage: run
117
+ script:
118
+ - npm install
119
+ - npx cypress run
120
+ artifacts:
121
+ paths:
122
+ - node_modules/
123
+ ```
124
+
125
+
126
+ ### Methods
127
+
128
+ Methods can be used to specify information about autotest.
129
+
130
+ Description of methods:
131
+ - `tms.addWorkItemIds` - a dynamic method that links autotests with manual tests. Receives the array of manual tests' IDs
132
+ - `tms.addDisplayName` - a dynamic method for adding internal autotest name (used in Test IT)
133
+ - `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
134
+ - `tms.addDescription` - a dynamic method for adding autotest description specified in the autotest card
135
+ - `tms.addLabels` - a dynamic method for adding labels listed in the autotest card
136
+ - `tms.addTags` - a dynamic method for adding tags listed in the autotest card
137
+ - `tms.addLinks` - links in the autotest result
138
+ - `tms.addAttachments` - uploading files in the autotest result
139
+ - `tms.addMessage` - information about autotest in the autotest result
140
+ - `tms.addNameSpace` - a dynamic method for adding directory in the TMS system (default - file's name of test)
141
+ - `tms.addClassName` - a dynamic method for adding subdirectory in the TMS system (default - class's name of test)
142
+ - `tms.addParameter` - a dynamic method for adding parameter in the autotest result
143
+ - `tms.step` - usage in the "with" construct to designation a step in the body of the test
144
+
145
+ ### Examples
146
+
147
+ #### Simple test
148
+ ```ts
149
+ import { getTestRuntime } from "testit-adapter-cypress/runtime";
150
+
151
+ describe('example to-do app', () => {
152
+ it('displays two todo items by default', () => {
153
+ const tms = getTestRuntime();
154
+
155
+ tms.addWorkItemIds('123', '321');
156
+ tms.addDisplayName('display name');
157
+ tms.addTitle('test title');
158
+ tms.addDescription('Test description');
159
+ tms.addLabels('label1', 'label2');
160
+ tms.addTags('tag1', 'tag2');
161
+ tms.addLinks(
162
+ {
163
+ url: 'https://www.google.com',
164
+ title: 'Google',
165
+ description: 'This is a link to Google',
166
+ type: 'Related',
167
+ },
168
+ );
169
+ tms.addParameter("name", "value");
170
+ tms.addNameSpace("namespace");
171
+ tms.addClassName("classname");
172
+
173
+ tms.step("step title", () => {
174
+ // ...
175
+ }).then((user) => {
176
+ tms.step("inner step title", () => {
177
+ // ...
178
+ });
179
+ });
180
+ });
181
+ });
182
+ ```
183
+
184
+ ### Parameterized test
185
+
186
+ > [!WARNING]
187
+ > When linking a parameterized autotest to a parameterized test case, please consider the problematic points:
188
+ > - In TMS test cases have a table with parameters, but autotests do not. They are not equal entities, so there may be incompatibility in terms of parameters
189
+ > - Running a parameterized test case, TMS expects the results of all related autotests with all the parameters specified in the test case table
190
+ > - In TMS, the parameters are limited to the string type, so the adapter transmits absolutely all the autotest parameters as a string. This implies the following problematic point for the test case table
191
+ > - TMS expects a complete **textual** match of the name and value of the parameters of the test case table with the autotest parameters
192
+
193
+ ```ts
194
+ import { getTestRuntime } from "testit-adapter-cypress/runtime";
195
+
196
+ describe('example to-do app', () => {
197
+ const tests = [2, 3, "string", false];
198
+
199
+ tests.forEach((value) => {
200
+ it(`3 is ${value}`, () => {
201
+ const tms = getTestRuntime();
202
+
203
+ tms.addParameter("name", value);
204
+ // ...
205
+ });
206
+ });
207
+ });
208
+ ```
209
+
210
+ #### Content types
211
+ ```
212
+ TEXT = "text/plain",
213
+ XML = "application/xml",
214
+ HTML = "text/html",
215
+ CSV = "text/csv",
216
+ TSV = "text/tab-separated-values",
217
+ CSS = "text/css",
218
+ URI = "text/uri-list",
219
+ SVG = "image/svg+xml",
220
+ PNG = "image/png",
221
+ JSON = "application/json",
222
+ ZIP = "application/zip",
223
+ WEBM = "video/webm",
224
+ JPEG = "image/jpeg",
225
+ MP4 = "video/mp4",
226
+ ```
227
+
228
+ # Contributing
229
+
230
+ You can help to develop the project. Any contributions are **greatly appreciated**.
231
+
232
+ * If you have suggestions for adding or removing projects, feel free to [open an issue](https://github.com/testit-tms/adapters-js/issues/new) to discuss it, or directly create a pull request after you edit the *README.md* file with necessary changes.
233
+ * Please make sure you check your spelling and grammar.
234
+ * Create individual PR for each suggestion.
235
+ * Please also read through the [Code Of Conduct](https://github.com/testit-tms/adapters-js/blob/master/CODE_OF_CONDUCT.md) before posting your first idea as well.
236
+
237
+ # License
238
+
239
+ Distributed under the Apache-2.0 License. See [LICENSE](https://github.com/testit-tms/adapters-js/blob/master/LICENSE.md) for more information.
240
+
@@ -1,30 +1,26 @@
1
- import { Label, Link, Status } from "testit-js-commons";
1
+ import { Link } from "testit-js-commons";
2
2
  import type { AttachmentOptions, TestRuntime } from "./types.js";
3
- import type { StatusDetails } from "../models/types.js";
4
3
  export declare const initTestRuntime: () => void;
5
4
  export declare const getTestRuntime: () => TmsCypressTestRuntime;
6
5
  declare class TmsCypressTestRuntime implements TestRuntime {
7
6
  #private;
8
7
  constructor();
9
- addLabels(...labels: Label[]): PromiseLike<void>;
8
+ addLabels(...labels: string[]): PromiseLike<void>;
10
9
  addTags(...tags: string[]): PromiseLike<void>;
11
10
  addLinks(...links: Link[]): PromiseLike<void>;
12
11
  addWorkItemIds(...workItemIds: string[]): PromiseLike<void>;
13
12
  addParameter(name: string, value: string): PromiseLike<void>;
14
- addDescription(markdown: string): PromiseLike<void>;
15
- addTitle(markdown: string): PromiseLike<void>;
16
- addDisplayName(name: string): PromiseLike<void>;
17
- addNameSpace(name: string): PromiseLike<void>;
18
- addClassName(name: string): PromiseLike<void>;
13
+ addDescription(description: string): PromiseLike<void>;
14
+ addTitle(title: string): PromiseLike<void>;
15
+ addDisplayName(displayName: string): PromiseLike<void>;
16
+ addNameSpace(namespace: string): PromiseLike<void>;
17
+ addClassName(classname: string): PromiseLike<void>;
19
18
  addAttachments(name: string, content: Buffer | string, options: AttachmentOptions): PromiseLike<void>;
20
19
  addAttachmentsFromPath(name: string, path: string, options: Omit<AttachmentOptions, "encoding">): PromiseLike<void>;
21
20
  addGlobalAttachments(name: string, content: Buffer | string, options: AttachmentOptions): PromiseLike<void>;
22
21
  addGlobalAttachmentsFromPath(name: string, path: string, options: Omit<AttachmentOptions, "encoding">): PromiseLike<void>;
23
- addMessage(details: StatusDetails): PromiseLike<void>;
24
- logStep(name: string, status?: Status, error?: Error): PromiseLike<void>;
22
+ addMessage(message: string): PromiseLike<void>;
25
23
  step<T = void>(name: string, body: () => T | PromiseLike<T>): Cypress.ThenReturn<T, T>;
26
- stepDisplayName(name: string): PromiseLike<void>;
27
- stepParameter(name: string, value: string): PromiseLike<void>;
28
24
  flushTmsMessagesToTask(taskName: string): void;
29
25
  flushTmsMessagesToTaskAsync(taskName: string): Cypress.Chainable<unknown> | undefined;
30
26
  }
@@ -4,10 +4,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
5
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
6
  };
7
- var _TmsCypressTestRuntime_instances, _TmsCypressTestRuntime_resetMessages, _TmsCypressTestRuntime_enqueueMessageAsync, _TmsCypressTestRuntime_dequeueAllMessages, _TmsCypressTestRuntime_buildAttachmentContent, _TmsCypressTestRuntime_normalizeAttachmentContent, _TmsCypressTestRuntime_isSerializedBuffer, _TmsCypressTestRuntime_isInOriginContext;
7
+ var _TmsCypressTestRuntime_instances, _TmsCypressTestRuntime_resetMessages, _TmsCypressTestRuntime_enqueueMessageAsync, _TmsCypressTestRuntime_dequeueAllMessages, _TmsCypressTestRuntime_buildAttachmentContent, _TmsCypressTestRuntime_normalizeAttachmentContent, _TmsCypressTestRuntime_isSerializedBuffer;
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.getTestRuntime = exports.initTestRuntime = void 0;
10
- const testit_js_commons_1 = require("testit-js-commons");
11
10
  const state_js_1 = require("./state.js");
12
11
  const steps_js_1 = require("./steps.js");
13
12
  const utils_js_1 = require("./utils.js");
@@ -65,43 +64,43 @@ class TmsCypressTestRuntime {
65
64
  },
66
65
  });
67
66
  }
68
- addDescription(markdown) {
67
+ addDescription(description) {
69
68
  return __classPrivateFieldGet(this, _TmsCypressTestRuntime_instances, "m", _TmsCypressTestRuntime_enqueueMessageAsync).call(this, {
70
69
  type: "metadata",
71
70
  data: {
72
- description: markdown,
71
+ description,
73
72
  },
74
73
  });
75
74
  }
76
- addTitle(markdown) {
75
+ addTitle(title) {
77
76
  return __classPrivateFieldGet(this, _TmsCypressTestRuntime_instances, "m", _TmsCypressTestRuntime_enqueueMessageAsync).call(this, {
78
77
  type: "metadata",
79
78
  data: {
80
- title: markdown,
79
+ title,
81
80
  },
82
81
  });
83
82
  }
84
- addDisplayName(name) {
83
+ addDisplayName(displayName) {
85
84
  return __classPrivateFieldGet(this, _TmsCypressTestRuntime_instances, "m", _TmsCypressTestRuntime_enqueueMessageAsync).call(this, {
86
85
  type: "metadata",
87
86
  data: {
88
- displayName: name,
87
+ displayName,
89
88
  },
90
89
  });
91
90
  }
92
- addNameSpace(name) {
91
+ addNameSpace(namespace) {
93
92
  return __classPrivateFieldGet(this, _TmsCypressTestRuntime_instances, "m", _TmsCypressTestRuntime_enqueueMessageAsync).call(this, {
94
93
  type: "metadata",
95
94
  data: {
96
- namespace: name,
95
+ namespace,
97
96
  },
98
97
  });
99
98
  }
100
- addClassName(name) {
99
+ addClassName(classname) {
101
100
  return __classPrivateFieldGet(this, _TmsCypressTestRuntime_instances, "m", _TmsCypressTestRuntime_enqueueMessageAsync).call(this, {
102
101
  type: "metadata",
103
102
  data: {
104
- classname: name,
103
+ classname,
105
104
  },
106
105
  });
107
106
  }
@@ -153,27 +152,12 @@ class TmsCypressTestRuntime {
153
152
  },
154
153
  });
155
154
  }
156
- addMessage(details) {
155
+ addMessage(message) {
157
156
  return __classPrivateFieldGet(this, _TmsCypressTestRuntime_instances, "m", _TmsCypressTestRuntime_enqueueMessageAsync).call(this, {
158
- type: "global_error",
159
- data: details,
160
- });
161
- }
162
- logStep(name, status = testit_js_commons_1.Status.PASSED, error) {
163
- if (__classPrivateFieldGet(this, _TmsCypressTestRuntime_instances, "m", _TmsCypressTestRuntime_isInOriginContext).call(this)) {
164
- (0, steps_js_1.startTmsApiStep)(name);
165
- (0, steps_js_1.stopCurrentTmsApiStep)(status, error ? (0, utils_js_1.getMessageAndTraceFromError)(error) : undefined);
166
- return Cypress.Promise.resolve();
167
- }
168
- return cy
169
- .wrap(steps_js_1.TMS_STEP_CMD_SUBJECT, { log: false })
170
- .then(() => {
171
- (0, steps_js_1.startTmsApiStep)(name);
172
- return Cypress.Promise.resolve();
173
- })
174
- .then(() => {
175
- (0, steps_js_1.stopCurrentTmsApiStep)(status, error ? (0, utils_js_1.getMessageAndTraceFromError)(error) : undefined);
176
- return Cypress.Promise.resolve();
157
+ type: "metadata",
158
+ data: {
159
+ message,
160
+ },
177
161
  });
178
162
  }
179
163
  step(name, body) {
@@ -188,22 +172,6 @@ class TmsCypressTestRuntime {
188
172
  return result;
189
173
  });
190
174
  }
191
- stepDisplayName(name) {
192
- return __classPrivateFieldGet(this, _TmsCypressTestRuntime_instances, "m", _TmsCypressTestRuntime_enqueueMessageAsync).call(this, {
193
- type: "step_metadata",
194
- data: {
195
- name,
196
- },
197
- });
198
- }
199
- stepParameter(name, value) {
200
- return __classPrivateFieldGet(this, _TmsCypressTestRuntime_instances, "m", _TmsCypressTestRuntime_enqueueMessageAsync).call(this, {
201
- type: "step_metadata",
202
- data: {
203
- parameters: [{ name, value }],
204
- },
205
- });
206
- }
207
175
  flushTmsMessagesToTask(taskName) {
208
176
  const messages = __classPrivateFieldGet(this, _TmsCypressTestRuntime_instances, "m", _TmsCypressTestRuntime_dequeueAllMessages).call(this);
209
177
  if (messages.length) {
@@ -249,36 +217,4 @@ _TmsCypressTestRuntime_instances = new WeakSet(), _TmsCypressTestRuntime_resetMe
249
217
  }
250
218
  const candidate = content;
251
219
  return candidate.type === "Buffer" && Array.isArray(candidate.data);
252
- }, _TmsCypressTestRuntime_isInOriginContext = function _TmsCypressTestRuntime_isInOriginContext() {
253
- try {
254
- const hasOriginContext = !!window.cypressOriginContext;
255
- const hasOriginWindow = !!window.cypressOriginWindow;
256
- if (hasOriginContext || hasOriginWindow) {
257
- return true;
258
- }
259
- const baseUrl = Cypress.config("baseUrl");
260
- const currentOrigin = window.location.origin;
261
- if (baseUrl && currentOrigin !== baseUrl) {
262
- return true;
263
- }
264
- const cypressInstance = window.Cypress;
265
- if (cypressInstance && cypressInstance.state && cypressInstance.state("origin")) {
266
- return true;
267
- }
268
- try {
269
- const cyExists = typeof cy !== "undefined";
270
- const cyTaskExists = typeof cy.task !== "undefined";
271
- // In cy.origin context, cy.task may not be available or may throw
272
- if (!cyExists || !cyTaskExists) {
273
- return true;
274
- }
275
- }
276
- catch (error) {
277
- return true;
278
- }
279
- return false;
280
- }
281
- catch (error) {
282
- return true;
283
- }
284
220
  };
@@ -1,5 +1,4 @@
1
- import type { StatusDetails } from "../models/types.js";
2
- import { Label, Link, Status } from "testit-js-commons";
1
+ import { Link } from "testit-js-commons";
3
2
  export declare enum ContentType {
4
3
  PNG = "image/png",
5
4
  MP4 = "video/mp4",
@@ -14,8 +13,8 @@ export interface AttachmentOptions {
14
13
  body?: Buffer;
15
14
  }
16
15
  export interface TestRuntime {
17
- addLabels(...labels: Label[]): PromiseLike<void>;
18
- addTags(...tags: String[]): PromiseLike<void>;
16
+ addLabels(...labels: string[]): PromiseLike<void>;
17
+ addTags(...tags: string[]): PromiseLike<void>;
19
18
  addLinks(...links: Link[]): PromiseLike<void>;
20
19
  addWorkItemIds(...workItemIds: string[]): PromiseLike<void>;
21
20
  addParameter(name: string, value: string): PromiseLike<void>;
@@ -26,10 +25,7 @@ export interface TestRuntime {
26
25
  addAttachmentsFromPath(name: string, path: string, options: Omit<AttachmentOptions, "encoding">): PromiseLike<void>;
27
26
  addGlobalAttachments(name: string, content: Buffer | string, options: AttachmentOptions): PromiseLike<void>;
28
27
  addGlobalAttachmentsFromPath(name: string, path: string, options: Omit<AttachmentOptions, "encoding">): PromiseLike<void>;
29
- addMessage(details: StatusDetails): PromiseLike<void>;
30
- logStep(name: string, status?: Status, error?: Error): PromiseLike<void>;
28
+ addMessage(message: string): PromiseLike<void>;
31
29
  step<T>(name: string, body: () => T | PromiseLike<T>): PromiseLike<T>;
32
- stepDisplayName(name: string): PromiseLike<void>;
33
- stepParameter(name: string, value: string): PromiseLike<void>;
34
30
  }
35
31
  export declare const noopRuntime: TestRuntime;
@@ -23,8 +23,5 @@ exports.noopRuntime = {
23
23
  addGlobalAttachments: () => noop,
24
24
  addGlobalAttachmentsFromPath: () => noop,
25
25
  addMessage: () => noop,
26
- logStep: () => noop,
27
26
  step: (_, body) => Promise.resolve(body()),
28
- stepDisplayName: () => noop,
29
- stepParameter: () => noop,
30
27
  };
@@ -1,5 +1,6 @@
1
1
  import type { AutotestPost, AutotestResult, Outcome } from "testit-js-commons";
2
- import { Label, Link } from "testit-js-commons";
2
+ import { Link } from "testit-js-commons";
3
+ import { StatusDetails } from "./models/types";
3
4
  export interface StepData {
4
5
  id: string;
5
6
  name: string;
@@ -13,6 +14,7 @@ export interface StepData {
13
14
  };
14
15
  attachmentIds: string[];
15
16
  children: StepData[];
17
+ parameters?: Record<string, string>;
16
18
  }
17
19
  export interface TestData {
18
20
  fullNameSuffix: string;
@@ -21,7 +23,7 @@ export interface TestData {
21
23
  title?: string;
22
24
  namespace?: string;
23
25
  classname?: string;
24
- labels: Label[];
26
+ labels: string[];
25
27
  tags: string[];
26
28
  links: Link[];
27
29
  workItemIds: string[];
@@ -29,14 +31,11 @@ export interface TestData {
29
31
  stop?: number;
30
32
  outcome: Outcome;
31
33
  duration?: number;
32
- statusDetails?: {
33
- message?: string;
34
- trace?: string;
35
- };
34
+ statusDetails?: StatusDetails;
35
+ message?: string;
36
36
  steps: StepData[];
37
37
  attachmentIds: string[];
38
38
  parameters?: Record<string, string>;
39
- properties?: Record<string, string>;
40
39
  externalKey: string;
41
40
  }
42
41
  export declare function toAutotestPost(specPath: string, t: TestData): AutotestPost;
package/dist/converter.js CHANGED
@@ -20,6 +20,8 @@ function stepDataToStep(s) {
20
20
  step.duration = s.stop - s.start;
21
21
  if (s.statusDetails?.message)
22
22
  step.info = s.statusDetails.message;
23
+ if (s.parameters)
24
+ step.parameters = s.parameters;
23
25
  return step;
24
26
  }
25
27
  function stepDataToShortStep(s) {
@@ -32,7 +34,6 @@ function toAutotestPost(specPath, t) {
32
34
  const fullName = `${specPath}#${t.fullNameSuffix}`;
33
35
  const externalId = testit_js_commons_1.Utils.getHash(fullName);
34
36
  const name = (t.displayName ?? t.fullNameSuffix).replace(/#/g, " > ");
35
- const labels = t.labels?.map((l) => ({ name: l.name })) ?? [];
36
37
  return {
37
38
  externalId,
38
39
  name,
@@ -41,9 +42,9 @@ function toAutotestPost(specPath, t) {
41
42
  workItemIds: t.workItemIds,
42
43
  namespace: t.namespace,
43
44
  classname: t.classname,
44
- links: t.links?.length ? t.links : undefined,
45
- labels: labels.length ? labels : undefined,
46
- tags: t.tags?.length ? t.tags : undefined,
45
+ links: t.links?.length ? t.links : [],
46
+ labels: t.labels?.map((l) => ({ name: l })) ?? [],
47
+ tags: t.tags?.length ? t.tags : [],
47
48
  steps: t.steps.map(s => stepDataToShortStep(s)),
48
49
  externalKey: t.externalKey,
49
50
  };
@@ -73,12 +74,14 @@ function toAutotestResult(externalId, t, outcome, extraAttachmentIds = []) {
73
74
  if (t.parameters) {
74
75
  result.parameters = t.parameters;
75
76
  }
76
- if (t.properties) {
77
- result.properties = t.properties;
77
+ if (t.message) {
78
+ result.message = t.message;
78
79
  }
79
- if (t.statusDetails?.message)
80
+ else if (t.statusDetails?.message) {
80
81
  result.message = t.statusDetails.message;
81
- if (t.statusDetails?.trace)
82
+ }
83
+ if (t.statusDetails?.trace) {
82
84
  result.traces = t.statusDetails.trace;
85
+ }
83
86
  return result;
84
87
  }
@@ -106,7 +106,7 @@ export type CypressTestStartMessage = {
106
106
  name: string;
107
107
  fullNameSuffix: string;
108
108
  start: number;
109
- labels: Label[];
109
+ labels: string[];
110
110
  tags: string[];
111
111
  links: Link[];
112
112
  workItemIds: string[];
package/dist/reporter.js CHANGED
@@ -311,12 +311,11 @@ class TmsCypress {
311
311
  if (data.tags?.length) {
312
312
  current.tags.push(...data.tags);
313
313
  }
314
+ if (data.workItemIds?.length) {
315
+ current.workItemIds.push(...data.workItemIds);
316
+ }
314
317
  if (data.links?.length) {
315
- current.links.push(...data.links.map((l) => ({
316
- url: l.url,
317
- title: l.title ?? l.url,
318
- description: l.description,
319
- })));
318
+ current.links.push(...data.links);
320
319
  }
321
320
  if (data.parameters?.length) {
322
321
  current.parameters ?? (current.parameters = {});
@@ -327,15 +326,24 @@ class TmsCypress {
327
326
  if (data.description) {
328
327
  current.description = data.description;
329
328
  }
330
- else if (data.descriptionHtml && !current.description) {
331
- current.description = data.descriptionHtml;
332
- }
333
329
  if (data.displayName) {
334
330
  current.displayName = data.displayName;
335
331
  }
336
332
  if (data.title) {
337
333
  current.title = data.title;
338
334
  }
335
+ if (data.message) {
336
+ current.message = data.message;
337
+ }
338
+ if (data.details) {
339
+ current.statusDetails = data.details;
340
+ }
341
+ if (data.namespace) {
342
+ current.namespace = data.namespace;
343
+ }
344
+ if (data.classname) {
345
+ current.classname = data.classname;
346
+ }
339
347
  });
340
348
  const { videoOnFailOnly = false, ...rest } = config;
341
349
  this.videoOnFailOnly = videoOnFailOnly;
package/package.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "testit-adapter-cypress",
3
- "version": "3.7.5",
4
- "description": "Cypress adapter for Test IT",
5
- "license": "Apache-2.0",
6
- "author": {
7
- "name": "Integration team",
8
- "email": "integrations@testit.software"
9
- },
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/testit-tms/adapters-js.git"
13
- },
14
- "keywords": [],
15
- "main": "./dist/index.js",
16
- "types": "./dist/index.d.ts",
17
- "exports": {
18
- ".": {
19
- "types": "./dist/index.d.ts",
20
- "default": "./dist/index.js"
21
- },
22
- "./reporter": {
23
- "types": "./dist/reporter.d.ts",
24
- "default": "./dist/reporter.js"
25
- },
26
- "./runtime": {
27
- "types": "./dist/browser/runtime.d.ts",
28
- "default": "./dist/browser/runtime.js"
29
- }
30
- },
31
- "scripts": {
32
- "clean": "rimraf ./dist ./out",
33
- "prebuild": "npm --prefix ../testit-js-commons run build && npm link ../testit-js-commons",
34
- "build": "tsc -p tsconfig.json"
35
- },
36
- "devDependencies": {
37
- "cypress": "14.2.0",
38
- "typescript": "^5.2.2",
39
- "esbuild": "^0.27.0",
40
- "eslint": "^8.57.0",
41
- "@types/eslint": "^8.56.11",
42
- "@types/node": "^20.14.2"
43
- },
44
- "dependencies": {
45
- "testit-js-commons": "3.7.5"
46
- },
47
- "files": [
48
- "dist"
49
- ]
50
- }
1
+ {
2
+ "name": "testit-adapter-cypress",
3
+ "version": "3.7.7",
4
+ "description": "Cypress adapter for Test IT",
5
+ "license": "Apache-2.0",
6
+ "author": {
7
+ "name": "Integration team",
8
+ "email": "integrations@testit.software"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/testit-tms/adapters-js.git"
13
+ },
14
+ "keywords": [],
15
+ "main": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.js"
21
+ },
22
+ "./reporter": {
23
+ "types": "./dist/reporter.d.ts",
24
+ "default": "./dist/reporter.js"
25
+ },
26
+ "./runtime": {
27
+ "types": "./dist/browser/runtime.d.ts",
28
+ "default": "./dist/browser/runtime.js"
29
+ }
30
+ },
31
+ "scripts": {
32
+ "clean": "rimraf ./dist ./out",
33
+ "prebuild": "npm --prefix ../testit-js-commons run build && npm link ../testit-js-commons",
34
+ "build": "tsc -p tsconfig.json"
35
+ },
36
+ "devDependencies": {
37
+ "cypress": "14.2.0",
38
+ "typescript": "^5.2.2",
39
+ "esbuild": "^0.27.0",
40
+ "eslint": "^8.57.0",
41
+ "@types/eslint": "^8.56.11",
42
+ "@types/node": "^20.14.2"
43
+ },
44
+ "dependencies": {
45
+ "testit-js-commons": "3.7.7"
46
+ },
47
+ "files": [
48
+ "dist"
49
+ ]
50
+ }