@appliqation/automation-sdk 2.1.11 → 2.3.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.
Files changed (38) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +509 -7
  3. package/package.json +2 -2
  4. package/src/AppliqationClient.js +47 -2
  5. package/src/constants.js +0 -0
  6. package/src/core/AuthManager.js +0 -0
  7. package/src/core/HttpClient.js +52 -0
  8. package/src/index.d.ts +0 -0
  9. package/src/index.js +0 -0
  10. package/src/playwright/JwtBrowserAuth.js +0 -0
  11. package/src/playwright/fixture.js +0 -0
  12. package/src/playwright/global-setup.js +43 -0
  13. package/src/playwright/global-teardown.js +0 -0
  14. package/src/playwright/helpers/jwt-browser-auth.js +0 -0
  15. package/src/playwright/index.js +0 -0
  16. package/src/reporters/cypress/CypressReporter.js +49 -2
  17. package/src/reporters/cypress/UuidExtractor.js +0 -0
  18. package/src/reporters/cypress/index.js +0 -0
  19. package/src/reporters/jest/JestReporter.js +49 -2
  20. package/src/reporters/jest/UuidExtractor.js +0 -0
  21. package/src/reporters/jest/index.js +0 -0
  22. package/src/reporters/playwright/AppliqationReporter.js +734 -26
  23. package/src/reporters/playwright/helpers/DeviceOsDetector.js +0 -0
  24. package/src/reporters/playwright/helpers/UuidExtractor.js +8 -3
  25. package/src/reporters/playwright/index.d.ts +0 -0
  26. package/src/reporters/playwright/index.js +0 -0
  27. package/src/services/OrphanTestService.js +0 -0
  28. package/src/services/ResultService.js +193 -24
  29. package/src/services/RunMatrixService.js +44 -0
  30. package/src/services/TaggingService.js +241 -0
  31. package/src/utils/PayloadBuilder.js +0 -0
  32. package/src/utils/RunDataNormalizer.js +0 -0
  33. package/src/utils/UuidValidator.js +0 -0
  34. package/src/utils/errors.js +0 -0
  35. package/src/utils/index.js +0 -0
  36. package/src/utils/logger.js +0 -0
  37. package/src/utils/mapAppqUuid.js +0 -0
  38. package/src/utils/validator.js +0 -0
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
@@ -41,6 +41,8 @@ Before you begin, ensure you have:
41
41
 
42
42
  Follow these steps in order to integrate the SDK with your Playwright tests.
43
43
 
44
+ **📌 Important:** Appliqation reporting is **opt-in**. You must either set `APPQ_ENABLE=1` environment variable or add `-- --appq` flag to your test command to send results to Appliqation. Without enabling reporting, tests run normally but results are not reported.
45
+
44
46
  ### Step 1: Install the SDK
45
47
 
46
48
  Navigate to your Playwright project and install the SDK:
@@ -196,14 +198,46 @@ test('should display user profile', async ({ page }, testInfo) => {
196
198
 
197
199
  ### Step 5: Run Your Tests
198
200
 
199
- Run your Playwright tests as normal:
201
+ **IMPORTANT:** To enable Appliqation reporting, you must either set `APPQ_ENABLE=1` environment variable or use the `-- --appq` flag.
202
+
203
+ **Reporting DISABLED (Default):**
204
+ ```bash
205
+ # Tests run normally, but results are NOT sent to Appliqation
206
+ npx playwright test
207
+ ```
208
+
209
+ **Reporting ENABLED (Method 1 - Environment Variable - Recommended):**
210
+ ```bash
211
+ # Set APPQ_ENABLE to enable reporting (simpler approach)
212
+ APPQ_ENABLE=1 APPLIQATION_RUN_TITLE=yourruntitle APPLIQATION_ENVIRONMENT=test_env_name npx playwright test
213
+ ```
200
214
 
215
+ **Reporting ENABLED (Method 2 - CLI Flag):**
201
216
  ```bash
202
- APPLIQATION_RUN_TITLE=yourruntitle APPLIQATION_ENVIRONMENT=test_env_name npx playwright test
217
+ # Use -- --appq flag to enable reporting (requires separator)
218
+ APPLIQATION_RUN_TITLE=yourruntitle APPLIQATION_ENVIRONMENT=test_env_name npx playwright test -- --appq
219
+ ```
203
220
 
221
+ **Examples:**
222
+ ```bash
223
+ # Method 1: Using environment variable (recommended)
224
+ APPQ_ENABLE=1 npx playwright test
225
+ APPQ_ENABLE=1 npx playwright test tests/login.spec.js
226
+ APPQ_ENABLE=1 npx playwright test --project=chromium
227
+ APPQ_ENABLE=1 npx playwright test --headed
228
+
229
+ # Method 2: Using CLI flag (requires -- separator)
230
+ npx playwright test -- --appq
231
+ npx playwright test tests/login.spec.js -- --appq
232
+ npx playwright test --project=chromium -- --appq
233
+ npx playwright test --headed -- --appq
234
+
235
+ # Bonus: Set run title via CLI flag
236
+ npx playwright test -- --appq --appq_run_title="My Custom Run"
237
+ npx playwright test tests/login.spec.js -- --appq --appq_run_title="Login Tests Sprint 23"
204
238
  ```
205
239
 
206
- **What happens:**
240
+ **What happens when `--appq` flag is present:**
207
241
 
208
242
  1. **Global Setup Runs** (once before all tests):
209
243
  - Reads `.env` configuration
@@ -232,9 +266,470 @@ APPLIQATION_RUN_TITLE=yourruntitle APPLIQATION_ENVIRONMENT=test_env_name npx pla
232
266
  - Navigate to the scenario you configured
233
267
  - See test results in the run matrix!
234
268
 
269
+ **Remember:** Results only appear in Appliqation when you enable reporting with `APPQ_ENABLE=1` or `-- --appq` flag!
270
+
271
+ ---
272
+
273
+ ✅ **That's it!** Your tests are now integrated with Appliqation. Remember to enable reporting with `APPQ_ENABLE=1` or `-- --appq`!
274
+
275
+ ---
276
+
277
+ ## Enabling Appliqation Reporting (--appq Flag)
278
+
279
+ By default, Appliqation reporting is **DISABLED**. You must explicitly enable it by adding the `--appq` flag to your test command.
280
+
281
+ ### Why Opt-In?
282
+
283
+ This design allows you to:
284
+ - ✅ Run tests locally without creating runs in Appliqation
285
+ - ✅ Debug and develop tests without affecting production data
286
+ - ✅ Control when results are sent to Appliqation portal
287
+ - ✅ Avoid accidental test runs in your dashboard
288
+
289
+ ### How to Enable
290
+
291
+ You can enable Appliqation reporting in two ways:
292
+
293
+ #### Method 1: Environment Variable (Recommended - Simpler)
294
+
295
+ Set the `APPQ_ENABLE` environment variable to `1` or `true`:
296
+
297
+ ```bash
298
+ # Enable reporting with environment variable
299
+ APPQ_ENABLE=1 npx playwright test
300
+
301
+ # Works with any other flags
302
+ APPQ_ENABLE=1 npx playwright test tests/login.spec.js --headed --project=chromium
303
+
304
+ # Also works with APPLIQATION_ENABLE
305
+ APPLIQATION_ENABLE=true npx playwright test
306
+ ```
307
+
308
+ #### Method 2: CLI Flag (Requires `--` Separator)
309
+
310
+ Add `--appq` flag after the `--` separator:
311
+
312
+ ```bash
313
+ # Enable reporting with CLI flag (note the -- separator)
314
+ npx playwright test -- --appq
315
+
316
+ # Works with any other flags
317
+ npx playwright test tests/login.spec.js --headed --project=chromium -- --appq
318
+ ```
319
+
320
+ **Note:** The `--` separator is required because Playwright doesn't recognize custom flags directly. The environment variable method is simpler and doesn't require the separator.
321
+
322
+ ### Setting Run Title via CLI
323
+
324
+ You can also specify the run title directly in the command line using the `--appq_run_title` flag:
325
+
326
+ ```bash
327
+ # Set run title via CLI flag
328
+ npx playwright test -- --appq --appq_run_title="My Custom Run Title"
329
+
330
+ # Works with other flags
331
+ npx playwright test tests/login.spec.js --headed --project=chromium -- --appq --appq_run_title="Login Tests"
332
+
333
+ # With quotes for titles containing spaces
334
+ npx playwright test -- --appq --appq_run_title="Regression Suite - Sprint 23"
335
+ ```
336
+
337
+ **Priority Order for Run Title:**
338
+ 1. Config file `title` option (if specified)
339
+ 2. CLI flag `--appq_run_title` (new!)
340
+ 3. Environment variable `APPLIQATION_RUN_TITLE`
341
+ 4. Auto-generated timestamp (default)
342
+
343
+ **Examples:**
344
+ ```bash
345
+ # Method 1: Environment variable
346
+ APPLIQATION_RUN_TITLE="My Run" npx playwright test -- --appq
347
+
348
+ # Method 2: CLI flag (overrides environment variable)
349
+ APPLIQATION_RUN_TITLE="Old Title" npx playwright test -- --appq --appq_run_title="New Title"
350
+ # Result: Run title will be "New Title"
351
+
352
+ # Method 3: Combined usage
353
+ npx playwright test -- --appq --appq_run_title="Sprint 23 Regression"
354
+ ```
355
+
356
+ ### What Happens When Reporting is Disabled
357
+
358
+ When you run tests **without** enabling reporting (no flag, no env var):
359
+ - ✅ Tests execute normally
360
+ - ✅ Execution summary file is still created
361
+ - ❌ No run is created in Appliqation
362
+ - ❌ No results are sent to Appliqation portal
363
+ - ℹ️ Console shows: "Appliqation reporting disabled: Add --appq flag to send results"
364
+
365
+ **Example:**
366
+ ```bash
367
+ # Reporting disabled - no results sent to Appliqation
368
+ npx playwright test
369
+ ```
370
+
371
+ ### What Happens When Reporting is Enabled
372
+
373
+ When you run tests **with** reporting enabled (using flag or env var):
374
+ - ✅ Tests execute normally
375
+ - ✅ Run matrix created in Appliqation
376
+ - ✅ Results sent to Appliqation portal
377
+ - ✅ Execution summary file created
378
+ - ✅ Console shows: "Appliqation reporting enabled: Results will be sent to Appliqation portal"
379
+
380
+ **Examples:**
381
+ ```bash
382
+ # Reporting enabled with environment variable
383
+ APPQ_ENABLE=1 npx playwright test
384
+
385
+ # Reporting enabled with CLI flag
386
+ npx playwright test -- --appq
387
+ ```
388
+
389
+ ---
390
+
391
+ ## Execution Summary Files
392
+
393
+ After each test run, the SDK automatically creates a timestamped summary file with comprehensive results.
394
+
395
+ **Location:** `test-results/AppQ_Execution_Summary/`
396
+
397
+ **Filename Format:** `{run_title}_2025-01-21_14-30-45.txt`
398
+
399
+ **What's Included:**
400
+ - ✅ Execution time (start, end, duration)
401
+ - ✅ Test counts (submitted, accepted, rejected, passed, failed, skipped)
402
+ - ✅ Run IDs for all created matrices
403
+ - ✅ Detailed error information (duplicates, orphans, backend rejections)
404
+ - ✅ Complete ASCII table (same as terminal output)
405
+
406
+ **Example:**
407
+ ```
408
+ test-results/
409
+ └── AppQ_Execution_Summary/
410
+ ├── My_Test_Run_2025-01-21_09-30-15.txt
411
+ ├── My_Test_Run_2025-01-21_14-45-30.txt
412
+ └── Regression_Suite_2025-01-22_08-00-00.txt
413
+ ```
414
+
415
+ **Features:**
416
+ - Always enabled automatically (no configuration needed)
417
+ - Each run creates a NEW file (never overwrites)
418
+ - If file writing fails, tests continue normally (non-blocking)
419
+
420
+ **Sample File Content:**
421
+ ```
422
+ ═══════════════════════════════════════════════════════════
423
+ APPLIQATION TEST EXECUTION SUMMARY
424
+ ═══════════════════════════════════════════════════════════
425
+
426
+ EXECUTION METADATA:
427
+ ─────────────────────────────────────────────────────────
428
+ Start Time: 2025-01-21T14:30:15.123Z
429
+ End Time: 2025-01-21T14:35:45.456Z
430
+ Duration: 5m 30s
431
+ Run Title: My_Test_Run
432
+
433
+ ╔═══════════════════════════════════════════════════════════╗
434
+ ║ Appliqation Test Results Summary ║
435
+ ╠═══════════════════════════════════════════════════════════╣
436
+ ║ Submitted to Backend: ║
437
+ ║ Total Submitted: 10 ║
438
+ ║ ✅ Accepted: 8 ║
439
+ ║ ❌ Rejected: 2 ║
440
+ ║ ║
441
+ ║ Test Execution Results (Playwright): ║
442
+ ║ Passed: 8 ║
443
+ ║ Failed: 0 ║
444
+ ║ Skipped: 0 ║
445
+ ║ ║
446
+ ║ Not Submitted: ║
447
+ ║ Orphan (No UUID): 3 ║
448
+ ║ Duplicates: 2 ║
449
+ ╠═══════════════════════════════════════════════════════════╣
450
+ ║ Run Matrices Created: 2 ║
451
+ ║ Desktop-Windows : run_abc123_1234567890 ║
452
+ ║ Desktop-Linux : run_xyz789_0987654321 ║
453
+ ╚═══════════════════════════════════════════════════════════╝
454
+
455
+ DETAILED ERRORS & WARNINGS:
456
+ ═══════════════════════════════════════════════════════════
457
+ [Duplicate UUIDs, Orphan Tests, and Backend Rejections details...]
458
+ ```
459
+
460
+ ---
461
+
462
+ ## Auto-Tagging Test Cases
463
+
464
+ The SDK automatically tags test cases with "Appq_automated" (configurable) after their **first successful run**. This helps you track which test cases have been automated and are actively running in your test suite.
465
+
466
+ ### How It Works
467
+
468
+ 1. **Test runs and passes** → SDK submits result to Appliqation
469
+ 2. **Backend accepts result** → SDK triggers auto-tagging (fire-and-forget)
470
+ 3. **Check if already tagged** → Skip if test case already has the tag
471
+ 4. **Add tag** → Test case gets tagged in Appliqation UI
472
+
473
+ **Key Features:**
474
+ - ✅ **Enabled by default** when Appliqation reporting is enabled
475
+ - ✅ **Fire-and-forget** - tagging failures never block your test runs
476
+ - ✅ **Smart deduplication** - checks before tagging, won't create duplicate tags
477
+ - ✅ **Only accepted results** - backend-rejected results are NOT tagged
478
+ - ✅ **Works for both** single and batch result submissions
479
+ - ✅ **Async execution** - zero impact on test execution performance
480
+
481
+ ### Configuration
482
+
483
+ #### Environment Variables
484
+
485
+ Add to your `.env` file:
486
+
487
+ ```bash
488
+ # Auto-Tagging Configuration (optional - all have sensible defaults)
489
+ APPLIQATION_AUTO_TAG_ENABLED=true # Enable/disable (default: true)
490
+ APPLIQATION_AUTO_TAG_NAME=Appq_automated # Custom tag name (default: Appq_automated)
491
+ ```
492
+
493
+ #### Playwright Reporter Config
494
+
495
+ Configure in `playwright.config.js`:
496
+
497
+ ```javascript
498
+ reporter: [
499
+ ['@appliqation/automation-sdk/playwright/reporter', {
500
+ apiKey: process.env.APPLIQATION_API_KEY,
501
+ projectKey: process.env.APPLIQATION_PROJECT_KEY,
502
+
503
+ // Auto-tagging options (optional)
504
+ autoTag: true, // Enable auto-tagging (default: true)
505
+ autoTagName: 'My_Custom_Tag' // Custom tag name (default: 'Appq_automated')
506
+ }]
507
+ ]
508
+ ```
509
+
510
+ #### Programmatic Configuration
511
+
512
+ When using the SDK directly:
513
+
514
+ ```javascript
515
+ const { AppliqationClient } = require('@appliqation/automation-sdk');
516
+
517
+ const client = new AppliqationClient({
518
+ apiKey: 'your_api_key',
519
+ projectKey: 'your_project_key',
520
+
521
+ // Auto-tagging options
522
+ options: {
523
+ autoTag: true, // Enable auto-tagging (default: true)
524
+ autoTagName: 'Automated_Test' // Custom tag name (default: 'Appq_automated')
525
+ }
526
+ });
527
+ ```
528
+
529
+ ### Disabling Auto-Tagging
530
+
531
+ If you want to disable auto-tagging:
532
+
533
+ **Option 1: Environment Variable**
534
+ ```bash
535
+ APPLIQATION_AUTO_TAG_ENABLED=false
536
+ ```
537
+
538
+ **Option 2: Config**
539
+ ```javascript
540
+ {
541
+ options: {
542
+ autoTag: false
543
+ }
544
+ }
545
+ ```
546
+
547
+ ### What You'll See
548
+
549
+ When auto-tagging is working:
550
+
551
+ ```
552
+ ✅ Auto-tagged 3 test case(s) with "Appq_automated"
553
+ ```
554
+
555
+ When test cases are already tagged (second run):
556
+
557
+ ```
558
+ DEBUG: Skipped 3 already-tagged test case(s)
559
+ ```
560
+
561
+ If tagging fails (non-blocking):
562
+
563
+ ```
564
+ ⚠️ Auto-tagging failed (non-blocking): Connection timeout
565
+ ```
566
+
567
+ ### Troubleshooting
568
+
569
+ **Q: I don't see the tag in Appliqation UI**
570
+
571
+ Check:
572
+ 1. Is `APPQ_ENABLE=1` set? (Auto-tagging only works when reporting is enabled)
573
+ 2. Did the test result get accepted by backend? (Check for backend validation errors)
574
+ 3. Check SDK logs for "Auto-tagged X test case(s)" message
575
+
576
+ **Q: Can I use a custom tag name?**
577
+
578
+ Yes! Set `APPLIQATION_AUTO_TAG_NAME=Your_Tag_Name` in your `.env` file or use the config options shown above.
579
+
580
+ **Q: Does tagging failure affect my test results?**
581
+
582
+ No! Auto-tagging is fire-and-forget. If tagging fails, it's logged as a warning but your test run continues normally and results are still submitted successfully.
583
+
235
584
  ---
236
585
 
237
- **That's it!** Your tests are now integrated with Appliqation.
586
+ ## Handling Orphan Tests
587
+
588
+ ### What are Orphan Tests?
589
+
590
+ **Orphan tests** are tests that execute successfully but **cannot be mapped to Appliqation test cases** because they're missing UUID annotations. When a test runs without a UUID, the SDK cannot link it to a specific test case in your Appliqation project, making the result "orphaned."
591
+
592
+ ```javascript
593
+ // ❌ This test will be orphaned (no UUID annotation)
594
+ test('Login with valid credentials', async ({ page }) => {
595
+ await page.goto('/login');
596
+ await page.fill('#username', 'user@example.com');
597
+ // ... test code
598
+ });
599
+
600
+ // ✅ This test will be properly mapped (has UUID annotation)
601
+ test('Login with valid credentials', { tag: '@uuid:1154-abc-def' }, async ({ page }) => {
602
+ await page.goto('/login');
603
+ await page.fill('#username', 'user@example.com');
604
+ // ... test code
605
+ });
606
+ ```
607
+
608
+ ### Automatic Orphan Run Cleanup
609
+
610
+ By default, the SDK **automatically prevents corrupted runs** from being created when ALL tests in a run are orphaned:
611
+
612
+ **Default Behavior:**
613
+ - ✅ If ALL tests lack UUIDs → Run is **deleted** and a clear error message is shown
614
+ - ✅ If SOME tests have UUIDs → Run is **kept**, valid results are submitted, orphans are logged as warnings
615
+ - ✅ CI/CD pipeline **fails with exit code 1** when orphan-only runs are detected
616
+ - ✅ Clear, actionable error message guides users on how to fix the issue
617
+
618
+ **Why?** Orphan-only runs create empty entries in Appliqation with "N/A" pass rates, which corrupts your analytics and dashboards.
619
+
620
+ ### Error Message Example
621
+
622
+ When all tests are orphaned, you'll see:
623
+
624
+ ```
625
+ ╔════════════════════════════════════════════════════════════════════╗
626
+ ║ ❌ RUN CREATION FAILED - ALL TESTS MISSING UUID ANNOTATIONS ║
627
+ ╠════════════════════════════════════════════════════════════════════╣
628
+ ║ Project: 1162-MyProject ║
629
+ ║ Orphan Tests: 6 ║
630
+ ║ ║
631
+ ║ ⚠️ NO RESULTS WERE SUBMITTED TO APPLIQATION ║
632
+ ║ The test run was automatically deleted to prevent analytics ║
633
+ ║ corruption. All tests are missing UUID annotations. ║
634
+ ╠════════════════════════════════════════════════════════════════════╣
635
+ ║ ✅ ACTION REQUIRED: Add UUID Annotations ║
636
+ ╠════════════════════════════════════════════════════════════════════╣
637
+ ║ Option 1: Using test tags (Recommended) ║
638
+ ║ test('My Test', { tag: '@uuid:123-xxx' }, async ({ page }) => { ║
639
+ ║ // your test code ║
640
+ ║ }); ║
641
+ ╚════════════════════════════════════════════════════════════════════╝
642
+ ```
643
+
644
+ ### Configuration Options
645
+
646
+ You can customize orphan handling behavior via environment variables:
647
+
648
+ ```env
649
+ # .env file
650
+
651
+ # Delete runs with only orphan tests (default: true)
652
+ APPLIQATION_DELETE_ORPHAN_RUNS=true
653
+
654
+ # Exit with error code 1 for orphan-only runs (default: true)
655
+ APPLIQATION_FAIL_ON_ORPHAN_RUNS=true
656
+ ```
657
+
658
+ **Configuration via playwright.config.js:**
659
+
660
+ ```javascript
661
+ reporter: [
662
+ [
663
+ '@appliqation/automation-sdk-js/playwright',
664
+ {
665
+ deleteOrphanOnlyRuns: true, // Delete orphan-only runs (default: true)
666
+ failOnOrphanOnlyRuns: true, // Fail CI/CD for orphan-only runs (default: true)
667
+ }
668
+ ]
669
+ ]
670
+ ```
671
+
672
+ ### Mixed Scenarios (Some Tests Have UUIDs)
673
+
674
+ When your test suite has **both valid and orphan tests**, the SDK handles it gracefully:
675
+
676
+ ```javascript
677
+ // Project 1162: 3 tests total
678
+ test('Valid Test 1', { tag: '@uuid:1154-abc' }, async ({ page }) => {
679
+ // ✅ Will be submitted to Appliqation
680
+ });
681
+
682
+ test('Orphan Test 1', async ({ page }) => {
683
+ // ⚠️ Logged as warning, not submitted
684
+ });
685
+
686
+ test('Valid Test 2', { tag: '@uuid:1155-def' }, async ({ page }) => {
687
+ // ✅ Will be submitted to Appliqation
688
+ });
689
+ ```
690
+
691
+ **Result:**
692
+ - ✅ Run is kept (because 2 tests have UUIDs)
693
+ - ✅ 2 valid results submitted to Appliqation
694
+ - ⚠️ 1 orphan logged in console and summary file
695
+ - ✅ CI/CD passes (because at least some tests were valid)
696
+ - ✅ Analytics remain accurate (only valid tests counted)
697
+
698
+ ### Troubleshooting FAQ
699
+
700
+ **Q: Why does my run get deleted?**
701
+
702
+ Your run is deleted only when **100% of your tests lack UUID annotations**. This prevents corrupted analytics. Add UUIDs to at least one test to keep the run.
703
+
704
+ **Q: How do I disable automatic deletion?**
705
+
706
+ Set `APPLIQATION_DELETE_ORPHAN_RUNS=false` in your `.env` file. However, this is not recommended as it will corrupt your analytics with N/A pass rates.
707
+
708
+ **Q: Can I keep orphan-only runs but still fail CI/CD?**
709
+
710
+ Yes! Set:
711
+ ```env
712
+ APPLIQATION_DELETE_ORPHAN_RUNS=false
713
+ APPLIQATION_FAIL_ON_ORPHAN_RUNS=true
714
+ ```
715
+
716
+ This will create the run in Appliqation but still fail your pipeline, forcing developers to fix UUIDs.
717
+
718
+ **Q: Where do I find UUIDs for my tests?**
719
+
720
+ 1. Log into Appliqation portal
721
+ 2. Navigate to your project
722
+ 3. Go to "Test Cases" tab
723
+ 4. Find your test case
724
+ 5. The UUID is in the format: `{test_nid}-{uuid}` (e.g., `1154-c1f9559c-b978-43cc-9c76-fd539c717cb4`)
725
+
726
+ **Q: Does orphan cleanup affect test execution?**
727
+
728
+ No! Cleanup happens **after** all tests complete in the `onEnd()` hook. Test execution is never blocked or interrupted.
729
+
730
+ **Q: What if deletion fails?**
731
+
732
+ Deletion is fire-and-forget with error handling. If deletion fails (network issue, permission, etc.), it's logged as an error but doesn't crash your test run. The corrupted run may remain in Appliqation in this rare case.
238
733
 
239
734
  ---
240
735
 
@@ -649,14 +1144,21 @@ const appliqationConfig = {
649
1144
 
650
1145
  **Possible causes:**
651
1146
 
652
- 1. **Orphan tests** - Tests don't have `mapAppqUuid()` calls
1147
+ 1. **Reporting not enabled** - Missing `APPQ_ENABLE` env var or `--appq` flag (MOST COMMON!)
1148
+ - **Fix (Method 1 - Recommended):** Set `APPQ_ENABLE=1` environment variable
1149
+ - Example: `APPQ_ENABLE=1 npx playwright test`
1150
+ - **Fix (Method 2):** Add `-- --appq` flag to your test command
1151
+ - Example: `npx playwright test -- --appq`
1152
+ - Check console output for: "Appliqation reporting disabled"
1153
+
1154
+ 2. **Orphan tests** - Tests don't have `mapAppqUuid()` calls
653
1155
  - **Fix:** Add UUID mapping to all tests
654
1156
  - Enable `logOrphans: true` to see which tests are orphans
655
1157
 
656
- 2. **API key invalid** - Authentication failed
1158
+ 3. **API key invalid** - Authentication failed
657
1159
  - **Fix:** Regenerate API key from portal
658
1160
 
659
- 3. **Network issues** - Portal unreachable
1161
+ 4. **Network issues** - Portal unreachable
660
1162
  - **Fix:** Check `TEST_APP_URL` is accessible
661
1163
 
662
1164
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appliqation/automation-sdk",
3
- "version": "2.1.11",
3
+ "version": "2.3.0",
4
4
  "description": "Appliqation Automation SDK with API key authentication, custom run titles, and framework-specific reporters",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -114,7 +114,7 @@
114
114
  },
115
115
  "repository": {
116
116
  "type": "git",
117
- "url": "https://github.com/appliqation/automation-sdk-js"
117
+ "url": "git+https://github.com/appliqation/automation-sdk-js.git"
118
118
  },
119
119
  "bugs": {
120
120
  "url": "https://github.com/appliqation/automation-sdk-js/issues"
@@ -2,6 +2,7 @@ const HttpClient = require('./core/HttpClient');
2
2
  const AuthManager = require('./core/AuthManager');
3
3
  const RunMatrixService = require('./services/RunMatrixService');
4
4
  const ResultService = require('./services/ResultService');
5
+ const TaggingService = require('./services/TaggingService');
5
6
  const OrphanTestService = require('./services/OrphanTestService');
6
7
  const UuidValidator = require('./utils/UuidValidator');
7
8
  const PayloadBuilder = require('./utils/PayloadBuilder');
@@ -99,7 +100,15 @@ class AppliqationClient {
99
100
  timeout: normalizedConfig.options?.timeout || 30000,
100
101
  retries: normalizedConfig.options?.retries || 3,
101
102
  logOrphans: normalizedConfig.options?.logOrphans !== false,
102
- logLevel: normalizedConfig.options?.logLevel || 'info'
103
+ logLevel: normalizedConfig.options?.logLevel || 'info',
104
+ // Auto-tagging configuration
105
+ autoTag: normalizedConfig.options?.autoTag !== false,
106
+ autoTagName: normalizedConfig.options?.autoTagName ||
107
+ normalizedConfig.autoTagName ||
108
+ process.env.APPLIQATION_AUTO_TAG_NAME ||
109
+ 'Appq_automated',
110
+ autoTagBatchSize: normalizedConfig.options?.autoTagBatchSize || 50,
111
+ autoTagRetries: normalizedConfig.options?.autoTagRetries || 2
103
112
  }
104
113
  };
105
114
 
@@ -112,9 +121,16 @@ class AppliqationClient {
112
121
 
113
122
  // Initialize services
114
123
  this.runMatrix = new RunMatrixService(this.http, this.config);
115
- this.results = new ResultService(this.http);
124
+ this.tagging = new TaggingService(this.http, this.config);
125
+ this.results = new ResultService(this.http, this.tagging, this.config);
116
126
  this.orphans = new OrphanTestService(this.http);
117
127
 
128
+ // Log tagging configuration
129
+ logger.debug('TaggingService initialized', {
130
+ enabled: this.tagging.isEnabled(),
131
+ tagName: this.tagging.tagName
132
+ });
133
+
118
134
  // Track current run context
119
135
  this.currentRun = null;
120
136
 
@@ -405,6 +421,35 @@ class AppliqationClient {
405
421
  this.currentRun = run;
406
422
  }
407
423
 
424
+ /**
425
+ * Delete a test run
426
+ * @param {string} runId - Run ID to delete
427
+ * @param {string} reason - Deletion reason (for audit logging)
428
+ * @returns {Promise<Object>} Deletion result
429
+ */
430
+ async deleteRun(runId, reason = 'orphan_cleanup') {
431
+ try {
432
+ logger.info('Deleting run...', { runId, reason });
433
+
434
+ const result = await this.runMatrix.delete(runId, reason);
435
+
436
+ // Clear from current run if it matches
437
+ if (this.currentRun && this.currentRun.runId === runId) {
438
+ this.currentRun = null;
439
+ }
440
+
441
+ logger.info('Run deleted successfully', { runId });
442
+
443
+ return result;
444
+ } catch (error) {
445
+ logger.error('Failed to delete run', {
446
+ error: error.message,
447
+ runId
448
+ });
449
+ throw error;
450
+ }
451
+ }
452
+
408
453
  /**
409
454
  * Validate UUID format
410
455
  * @param {string} uuid - UUID to validate
package/src/constants.js CHANGED
File without changes
File without changes