@msalaam/xray-qe-toolkit 1.5.0 → 1.6.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.
@@ -60,8 +60,27 @@
60
60
  "pattern": "^/"
61
61
  },
62
62
  "testSet": {
63
- "type": "string",
64
- "description": "Name of the Xray Test Set this test belongs to. Tests sharing the same value are grouped into a single Test Set issue in JIRA. xqt push creates the Test Set automatically if it doesn't exist and adds the test to it. Test Set → JIRA key mappings are stored in xray-mapping.json under _testSets."
63
+ "oneOf": [
64
+ {
65
+ "type": "string",
66
+ "description": "Name of a single Xray Test Set this test belongs to."
67
+ },
68
+ {
69
+ "type": "array",
70
+ "items": { "type": "string" },
71
+ "minItems": 1,
72
+ "description": "Names of multiple Xray Test Sets this test belongs to."
73
+ }
74
+ ],
75
+ "description": "Xray Test Set name(s) — string or array of strings. Tests are grouped into Test Set issues in JIRA. xqt push creates sets automatically and adds the test to each."
76
+ },
77
+ "preconditions": {
78
+ "type": "array",
79
+ "items": {
80
+ "type": "string",
81
+ "pattern": "^[A-Z][A-Z0-9_]+-[0-9]+$"
82
+ },
83
+ "description": "JIRA issue keys of Xray Precondition issues linked to this test (e.g. [\"PROJ-5\"]). xqt push calls addPreconditionsToTest on each push."
65
84
  },
66
85
  "requirementKeys": {
67
86
  "type": "array",
@@ -152,6 +152,7 @@ After running `npx xqt init`:
152
152
  "tags": ["smoke", "regression"],
153
153
  "folder": "/{{SERVICE_NAME}}/HealthCheck/Validation",
154
154
  "testSet": "Health Check",
155
+ "preconditions": ["APIEE-50"],
155
156
  "requirementKeys": [],
156
157
  "xray": {
157
158
  "summary": "Service returns 200 OK when healthy",
@@ -175,7 +176,8 @@ After running `npx xqt init`:
175
176
  | `skip` | boolean | — | `true` to exclude from push-tests |
176
177
  | `tags` | string[] | — | QE tags for categorisation and filtering |
177
178
  | `folder` | string | — | Xray repository folder path — must start with `/` |
178
- | `testSet` | string | — | Test Set name in Jira — groups tests by feature |
179
+ | `testSet` | string **or** string[] | — | Test Set name(s) in Jira — use a string or an array to assign to multiple sets |
180
+ | `preconditions` | string[] | — | JIRA keys of Xray Precondition issues to link (e.g. `["APIEE-50"]`) |
179
181
  | `requirementKeys` | string[] | — | JIRA issue keys this test covers (creates coverage links) |
180
182
  | `xray.summary` | string | Yes | Test case title (JIRA issue summary) |
181
183
  | `xray.description` | string | — | Detailed description |
@@ -213,14 +215,19 @@ npx xqt create-plan --summary "{{SERVICE_NAME}} v2 Regression"
213
215
  npx xqt create-plan --summary "Sprint 12 Smoke Tests" --version "2024.12"
214
216
  ```
215
217
 
216
- ### `xqt push-tests`
218
+ ### `xqt push-tests` (alias: `push`)
217
219
 
218
220
  Create or update tests in Xray Cloud, then sync the Test Plan membership and folder structure.
219
221
 
222
+ - New tests are **bulk-imported** via the Xray REST API when there are ≥ `bulkImportThreshold` (default: 50) to create — significantly faster for large suites
223
+ - Test Plan membership is **bi-directionally synced**: new tests are added and tests removed from `tests.json` are removed from the plan
224
+ - Test Sets are **deduplicated by name** — safe to run on a fresh clone, existing sets are found in JIRA before creating new ones
225
+ - `preconditions` are linked after every create or update
226
+
220
227
  ```bash
221
- npx xqt push-tests
222
- npx xqt push-tests --plan APIEE-1234 # override plan key
223
- npx xqt push-tests --verbose
228
+ npx xqt push
229
+ npx xqt push --plan APIEE-1234 # override plan key
230
+ npx xqt push --verbose
224
231
  ```
225
232
 
226
233
  ### `xqt pull-tests`
@@ -232,15 +239,15 @@ npx xqt pull-tests --plan APIEE-1234
232
239
  npx xqt pull-tests --project APIEE --limit 200
233
240
  ```
234
241
 
235
- ### `xqt import-results`
242
+ ### `xqt import-results` (alias: `import`)
236
243
 
237
244
  Import test execution results into Xray. Creates a **new** Test Execution each time.
238
245
 
239
246
  ```bash
240
- npx xqt import-results --file test-results/results.json --env IOP-QA
241
- npx xqt import-results --file test-results/results.xml --env IOP-PROD
242
- npx xqt import-results --file test-results/results.json --env IOP-DEV \
243
- --plan APIEE-1234 --version "2024.12" --revision "a1b2c3d"
247
+ npx xqt import --file test-results/results.json --env IOP-QA
248
+ npx xqt import --file test-results/results.xml --env IOP-PROD
249
+ npx xqt import --file test-results/results.json --env IOP-DEV \
250
+ --plan APIEE-1234 --fix-version "2.5.0" --revision "a1b2c3d"
244
251
  ```
245
252
 
246
253
  **Options:**
@@ -250,10 +257,31 @@ npx xqt import-results --file test-results/results.json --env IOP-DEV \
250
257
  | `--file <path>` | Path to results file (`.json` = Playwright, `.xml` = JUnit) |
251
258
  | `--env <label>` | Environment label: `IOP-DEV`, `IOP-QA`, `IOP-PROD` |
252
259
  | `--plan <key>` | Test Plan key (overrides `.xrayrc`) |
253
- | `--version <ver>` | Fix version / release label |
254
- | `--revision <sha>` | Build number or git SHA |
260
+ | `--exec <key>` | Import INTO an existing execution (from `xqt exec`) |
261
+ | `--fix-version <ver>` | JIRA Fix Version name to stamp on the execution (e.g. `2.5.0`) |
262
+ | `--version <ver>` | Xray version label (free-form, separate from Fix Version) |
263
+ | `--revision <sha>` | Build number or git SHA (enables traceability to a specific commit) |
255
264
  | `--summary <text>` | Custom execution summary |
256
265
 
266
+ ### `xqt create-execution` (alias: `exec`)
267
+
268
+ Pre-create a Test Execution before running tests (for controlled test selection).
269
+
270
+ ```bash
271
+ EXEC_KEY=$(npx xqt exec --env IOP-QA --quiet)
272
+ npx playwright test
273
+ npx xqt import --file test-results/results.json --exec $EXEC_KEY
274
+ ```
275
+
276
+ | Flag | Description |
277
+ |---|---|
278
+ | `--env <label>` | Environment label |
279
+ | `--plan <key>` | Test Plan to link to |
280
+ | `--tests <ids>` | Comma-separated testIds or JIRA keys |
281
+ | `--summary <text>` | Custom execution title |
282
+ | `--fix-version <ver>` | JIRA Fix Version to stamp on the execution |
283
+ | `--quiet` | Print only the execution key |
284
+
257
285
  ### `xqt sync-folders`
258
286
 
259
287
  Sync the Xray repository folder structure from `folder` fields in tests.json.
@@ -306,7 +334,10 @@ npx xqt gen-pipeline --output .azure/ci.yml
306
334
 
307
335
  Tests live in **Test Sets** in Jira, grouped by feature (matching the feature name in `business-rules.yaml`).
308
336
 
309
- - Created automatically by `push-tests` from the `testSet` field in `tests.json`
337
+ - Assign a test to one set: `"testSet": "Health Check"`
338
+ - Assign to multiple sets: `"testSet": ["Health Check", "Smoke"]`
339
+ - Created automatically by `push` from the `testSet` field in `tests.json`
340
+ - **Deduplicated by name** — if `xray-mapping.json` is lost (e.g. fresh clone), sets are found by searching JIRA before creating a new one
310
341
  - Persistent across sprints — they represent what tests exist
311
342
  - Link Test Sets to Test Plans when entering a sprint
312
343
 
@@ -314,17 +345,20 @@ Tests live in **Test Sets** in Jira, grouped by feature (matching the feature na
314
345
 
315
346
  A Test Plan scopes testing for a specific sprint or release.
316
347
 
317
- - Create per sprint: `npx xqt create-plan --summary "Sprint 12 — {{SERVICE_NAME}}"`
348
+ - Create per sprint: `npx xqt plan --summary "Sprint 12 — {{SERVICE_NAME}}"`
318
349
  - Link relevant Test Sets to the Test Plan in Jira
319
350
  - The key is stored in `.xrayrc` (`testPlanKey`)
320
- - `import-results` links executions to the active plan
351
+ - `import` links executions to the active plan
352
+ - **`xqt push` performs a bi-directional sync** — new tests are added and tests removed from `tests.json` are removed from the plan
321
353
 
322
354
  ### Test Executions (ephemeral)
323
355
 
324
356
  A Test Execution represents one CI run.
325
- - Created automatically by `xqt import-results`
357
+ - Created automatically by `xqt import`
358
+ - **Pre-created** by `xqt exec` for controlled test selection (filter which tests run)
326
359
  - Tagged with the environment (`IOP-DEV`, `IOP-QA`, `IOP-PROD`)
327
360
  - Linked to the Test Plan
361
+ - Stamped with `--fix-version` and `--revision` for release traceability
328
362
 
329
363
  ### Summary
330
364
 
@@ -348,7 +382,7 @@ Set the default environment and allowed values in `.xrayrc`:
348
382
  Override per run with `--env`:
349
383
 
350
384
  ```bash
351
- npx xqt import-results --file results.json --env IOP-PROD
385
+ npx xqt import --file results.json --env IOP-PROD
352
386
  ```
353
387
 
354
388
  ---
@@ -387,12 +421,12 @@ The generated `playwright.config.ts` configures three reporters:
387
421
 
388
422
  ```bash
389
423
  # After running: npx playwright test
390
- npx xqt import-results --file test-results/results.json --env IOP-QA
424
+ npx xqt import --file test-results/results.json --env IOP-QA
391
425
  ```
392
426
 
393
427
  ### Test steps in Xray
394
428
 
395
- Steps defined with `test.step()` are automatically mapped to Xray step results:
429
+ Steps defined with `test.step()` are automatically mapped to Xray step results. **Screenshots captured on a failing step are attached directly to that step's evidence** in Xray — giving per-step failure screenshots in the Xray UI. Traces and other attachments are attached at the test level.
396
430
 
397
431
  ```typescript
398
432
  test('Create and retrieve user', async ({ request }) => {
@@ -481,9 +515,9 @@ Key import step (runs even on test failure):
481
515
  ```yaml
482
516
  - script: |
483
517
  REVISION=$(echo "$(Build.SourceVersion)" | cut -c1-8)
484
- npx xqt import-results \
518
+ npx xqt import \
485
519
  --file test-results/results.json \
486
- --version "$(Build.BuildNumber)" \
520
+ --fix-version "$(Build.BuildNumber)" \
487
521
  --revision "$REVISION"
488
522
  condition: succeededOrFailed()
489
523
  env:
@@ -551,11 +585,34 @@ Auto-managed by `push-tests` — do not edit manually.
551
585
  "defaultEnvironment": "IOP-DEV",
552
586
  "environments": ["IOP-DEV", "IOP-QA", "IOP-PROD"],
553
587
  "folderRoot": "/{{SERVICE_NAME}}",
554
- "xrayRegion": "us"
588
+ "xrayRegion": "us",
589
+ "bulkImportThreshold": 50,
590
+ "statusMapping": {
591
+ "interrupted": "ABORTED",
592
+ "skipped": "TODO"
593
+ }
555
594
  }
556
595
  ```
557
596
 
558
- ### xrayRegion values
597
+ | Field | Description |
598
+ |---|---|
599
+ | `testPlanKey` | Default Test Plan key |
600
+ | `defaultEnvironment` | Fallback environment when `--env` is not provided |
601
+ | `environments` | Allowed environment labels |
602
+ | `folderRoot` | Base folder path in Xray Test Repository |
603
+ | `xrayRegion` | `us` (default), `eu`, or `au` |
604
+ | `bulkImportThreshold` | Min new-test count to switch to bulk REST import (default: `50`) |
605
+ | `statusMapping` | Override default Playwright → Xray status mapping |
606
+
607
+ #### Playwright status mapping
608
+
609
+ By default: `passed→PASSED`, `failed→FAILED`, `timedOut→FAILED`, `interrupted→ABORTED`, `skipped→TODO`. Override any value:
610
+
611
+ ```json
612
+ { "statusMapping": { "interrupted": "FAILED", "skipped": "TODO" } }
613
+ ```
614
+
615
+ You can also set `XQT_BULK_THRESHOLD=<n>` as an environment variable to override the bulk threshold at runtime.
559
616
 
560
617
  | Value | GraphQL endpoint |
561
618
  |---|---|