@appliqation/automation-sdk 2.1.10 → 2.2.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/LICENSE +0 -0
- package/README.md +260 -20
- package/package.json +9 -1
- package/src/AppliqationClient.js +1 -1
- package/src/constants.js +0 -0
- package/src/core/AuthManager.js +0 -0
- package/src/core/HttpClient.js +0 -0
- package/src/index.d.ts +0 -0
- package/src/index.js +0 -0
- package/src/playwright/JwtBrowserAuth.js +0 -0
- package/src/playwright/fixture.js +0 -0
- package/src/playwright/global-setup.js +43 -0
- package/src/playwright/global-teardown.js +42 -0
- package/src/playwright/helpers/jwt-browser-auth.js +0 -0
- package/src/playwright/index.js +0 -0
- package/src/reporters/cypress/CypressReporter.js +49 -2
- package/src/reporters/cypress/UuidExtractor.js +0 -0
- package/src/reporters/cypress/index.js +0 -0
- package/src/reporters/jest/JestReporter.js +49 -2
- package/src/reporters/jest/UuidExtractor.js +0 -0
- package/src/reporters/jest/index.js +0 -0
- package/src/reporters/playwright/AppliqationReporter.js +424 -22
- package/src/reporters/playwright/helpers/DeviceOsDetector.js +0 -0
- package/src/reporters/playwright/helpers/UuidExtractor.js +0 -0
- package/src/reporters/playwright/index.d.ts +0 -0
- package/src/reporters/playwright/index.js +0 -0
- package/src/services/OrphanTestService.js +0 -0
- package/src/services/ResultService.js +158 -24
- package/src/services/RunMatrixService.js +16 -0
- package/src/services/TaggingService.js +44 -0
- package/src/utils/PayloadBuilder.js +0 -0
- package/src/utils/RunDataNormalizer.js +0 -0
- package/src/utils/UuidValidator.js +0 -0
- package/src/utils/errors.js +0 -0
- package/src/utils/index.js +0 -0
- package/src/utils/logger.js +0 -0
- package/src/utils/mapAppqUuid.js +0 -0
- 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:
|
|
@@ -125,7 +127,7 @@ module.exports = defineConfig({
|
|
|
125
127
|
['html'], // HTML report
|
|
126
128
|
|
|
127
129
|
// Appliqation reporter for result submission
|
|
128
|
-
['@appliqation/automation-sdk/playwright', appliqationConfig]
|
|
130
|
+
['@appliqation/automation-sdk/playwright/reporter', appliqationConfig]
|
|
129
131
|
],
|
|
130
132
|
|
|
131
133
|
projects: [
|
|
@@ -196,14 +198,46 @@ test('should display user profile', async ({ page }, testInfo) => {
|
|
|
196
198
|
|
|
197
199
|
### Step 5: Run Your Tests
|
|
198
200
|
|
|
199
|
-
|
|
201
|
+
**IMPORTANT:** To enable Appliqation reporting, you must either set `APPQ_ENABLE=1` environment variable or use the `-- --appq` flag.
|
|
200
202
|
|
|
203
|
+
**Reporting DISABLED (Default):**
|
|
201
204
|
```bash
|
|
202
|
-
|
|
205
|
+
# Tests run normally, but results are NOT sent to Appliqation
|
|
206
|
+
npx playwright test
|
|
207
|
+
```
|
|
203
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
|
|
204
213
|
```
|
|
205
214
|
|
|
206
|
-
**
|
|
215
|
+
**Reporting ENABLED (Method 2 - CLI Flag):**
|
|
216
|
+
```bash
|
|
217
|
+
# Use -- --appq flag to enable reporting (requires separator)
|
|
218
|
+
APPLIQATION_RUN_TITLE=yourruntitle APPLIQATION_ENVIRONMENT=test_env_name npx playwright test -- --appq
|
|
219
|
+
```
|
|
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"
|
|
238
|
+
```
|
|
239
|
+
|
|
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,208 @@ 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
|
+
|
|
235
271
|
---
|
|
236
272
|
|
|
237
|
-
✅ **That's it!** Your tests are now integrated with Appliqation.
|
|
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-tag Accepted Tests
|
|
463
|
+
|
|
464
|
+
After a test is automated, the SDK can tag its UUID (default tag: `Appq_automated`) for accepted results only. Tagging is fire-and-forget: failures are logged as warnings and never fail your run.
|
|
465
|
+
|
|
466
|
+
- Enabled by default when Appq is enabled.
|
|
467
|
+
- Overrides:
|
|
468
|
+
- Tag name: `APPLIQATION_TAG_NAME=MyTag`
|
|
469
|
+
- Endpoint (if customized): `APPLIQATION_TAG_ENDPOINT=/api/automation/testcase/tag`
|
|
470
|
+
- Works for both batch and single submissions; backend-rejected results are skipped automatically.
|
|
238
471
|
|
|
239
472
|
---
|
|
240
473
|
|
|
@@ -410,7 +643,7 @@ your-playwright-project/
|
|
|
410
643
|
│ ├── globalSetup: require.resolve('@appliqation/automation-sdk/playwright/global-setup')
|
|
411
644
|
│ ├── globalTeardown: require.resolve('@appliqation/automation-sdk/playwright/global-teardown')
|
|
412
645
|
│ ├── use: { storageState: '.auth/jwt.json' }
|
|
413
|
-
│ └── reporter: ['@appliqation/automation-sdk/playwright', config]
|
|
646
|
+
│ └── reporter: ['@appliqation/automation-sdk/playwright/reporter', config]
|
|
414
647
|
│
|
|
415
648
|
├── tests/
|
|
416
649
|
│ ├── login.spec.js # YOUR TESTS (Step 4)
|
|
@@ -649,14 +882,21 @@ const appliqationConfig = {
|
|
|
649
882
|
|
|
650
883
|
**Possible causes:**
|
|
651
884
|
|
|
652
|
-
1. **
|
|
885
|
+
1. **Reporting not enabled** - Missing `APPQ_ENABLE` env var or `--appq` flag (MOST COMMON!)
|
|
886
|
+
- **Fix (Method 1 - Recommended):** Set `APPQ_ENABLE=1` environment variable
|
|
887
|
+
- Example: `APPQ_ENABLE=1 npx playwright test`
|
|
888
|
+
- **Fix (Method 2):** Add `-- --appq` flag to your test command
|
|
889
|
+
- Example: `npx playwright test -- --appq`
|
|
890
|
+
- Check console output for: "Appliqation reporting disabled"
|
|
891
|
+
|
|
892
|
+
2. **Orphan tests** - Tests don't have `mapAppqUuid()` calls
|
|
653
893
|
- **Fix:** Add UUID mapping to all tests
|
|
654
894
|
- Enable `logOrphans: true` to see which tests are orphans
|
|
655
895
|
|
|
656
|
-
|
|
896
|
+
3. **API key invalid** - Authentication failed
|
|
657
897
|
- **Fix:** Regenerate API key from portal
|
|
658
898
|
|
|
659
|
-
|
|
899
|
+
4. **Network issues** - Portal unreachable
|
|
660
900
|
- **Fix:** Check `TEST_APP_URL` is accessible
|
|
661
901
|
|
|
662
902
|
---
|
|
@@ -727,18 +967,18 @@ Connection test: { success: true, message: 'Connected to Appliqation portal' }
|
|
|
727
967
|
|
|
728
968
|
For long-running test suites, use the SDK's custom fixture to automatically refresh JWT tokens:
|
|
729
969
|
|
|
730
|
-
**File:** `
|
|
970
|
+
**File:** `tests/example.spec.js`
|
|
731
971
|
```javascript
|
|
732
|
-
|
|
733
|
-
const {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
972
|
+
// Use the SDK's test fixture instead of Playwright's default
|
|
973
|
+
const { test, expect } = require('@appliqation/automation-sdk/playwright');
|
|
974
|
+
|
|
975
|
+
test.describe('Authenticated Tests', () => {
|
|
976
|
+
test('should have valid JWT throughout test', async ({ page }) => {
|
|
977
|
+
// JWT is automatically refreshed if < 5 minutes remaining
|
|
978
|
+
await page.goto('/dashboard');
|
|
979
|
+
// Your test logic...
|
|
980
|
+
});
|
|
739
981
|
});
|
|
740
|
-
|
|
741
|
-
module.exports = { test };
|
|
742
982
|
```
|
|
743
983
|
|
|
744
984
|
**What it does:**
|
|
@@ -806,7 +1046,7 @@ Most commonly used SDK exports:
|
|
|
806
1046
|
|
|
807
1047
|
**Reporter (for playwright.config.js):**
|
|
808
1048
|
```javascript
|
|
809
|
-
['@appliqation/automation-sdk/playwright', config]
|
|
1049
|
+
['@appliqation/automation-sdk/playwright/reporter', config]
|
|
810
1050
|
```
|
|
811
1051
|
|
|
812
1052
|
**Global Setup/Teardown:**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appliqation/automation-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.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",
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"import": "./src/index.js"
|
|
11
11
|
},
|
|
12
12
|
"./playwright": {
|
|
13
|
+
"require": "./src/playwright/index.js",
|
|
14
|
+
"import": "./src/playwright/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./playwright/reporter": {
|
|
13
17
|
"require": "./src/reporters/playwright/index.js",
|
|
14
18
|
"import": "./src/reporters/playwright/index.js"
|
|
15
19
|
},
|
|
@@ -17,6 +21,10 @@
|
|
|
17
21
|
"require": "./src/playwright/global-setup.js",
|
|
18
22
|
"import": "./src/playwright/global-setup.js"
|
|
19
23
|
},
|
|
24
|
+
"./playwright/global-teardown": {
|
|
25
|
+
"require": "./src/playwright/global-teardown.js",
|
|
26
|
+
"import": "./src/playwright/global-teardown.js"
|
|
27
|
+
},
|
|
20
28
|
"./playwright/fixture": {
|
|
21
29
|
"require": "./src/playwright/fixture.js",
|
|
22
30
|
"import": "./src/playwright/fixture.js"
|
package/src/AppliqationClient.js
CHANGED
|
@@ -112,7 +112,7 @@ class AppliqationClient {
|
|
|
112
112
|
|
|
113
113
|
// Initialize services
|
|
114
114
|
this.runMatrix = new RunMatrixService(this.http, this.config);
|
|
115
|
-
this.results = new ResultService(this.http);
|
|
115
|
+
this.results = new ResultService(this.http, this.config);
|
|
116
116
|
this.orphans = new OrphanTestService(this.http);
|
|
117
117
|
|
|
118
118
|
// Track current run context
|
package/src/constants.js
CHANGED
|
File without changes
|
package/src/core/AuthManager.js
CHANGED
|
File without changes
|
package/src/core/HttpClient.js
CHANGED
|
File without changes
|
package/src/index.d.ts
CHANGED
|
File without changes
|
package/src/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -29,6 +29,43 @@ const fs = require('fs');
|
|
|
29
29
|
const path = require('path');
|
|
30
30
|
const { DEFAULT_APPLIQATION_BASE_URL } = require('../constants');
|
|
31
31
|
|
|
32
|
+
function toBoolean(value) {
|
|
33
|
+
if (value === undefined || value === null) return undefined;
|
|
34
|
+
if (typeof value === 'boolean') return value;
|
|
35
|
+
const normalized = String(value).trim().toLowerCase();
|
|
36
|
+
if (['1', 'true', 'yes', 'on'].includes(normalized)) return true;
|
|
37
|
+
if (['0', 'false', 'no', 'off'].includes(normalized)) return false;
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function parseCliEnableFlag() {
|
|
42
|
+
const argv = process.argv || [];
|
|
43
|
+
for (let i = 0; i < argv.length; i++) {
|
|
44
|
+
const arg = argv[i];
|
|
45
|
+
if (arg.startsWith('--appq=')) {
|
|
46
|
+
return toBoolean(arg.split('=')[1]);
|
|
47
|
+
}
|
|
48
|
+
if (arg === '--appq') {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
if (arg.startsWith('--enable-appq=')) {
|
|
52
|
+
return toBoolean(arg.split('=')[1]);
|
|
53
|
+
}
|
|
54
|
+
if (arg === '--enable-appq') {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function resolveEnableAppq(config) {
|
|
62
|
+
const cliValue = parseCliEnableFlag();
|
|
63
|
+
const envValue = process.env.APPLIQATION_ENABLE ?? process.env.APPQ ?? process.env.APPLIQATION_APPQ;
|
|
64
|
+
const configValue = config?.enableAppq ?? config?.options?.enableAppq;
|
|
65
|
+
const resolved = toBoolean(configValue) ?? toBoolean(cliValue) ?? toBoolean(envValue);
|
|
66
|
+
return resolved !== undefined ? resolved : true;
|
|
67
|
+
}
|
|
68
|
+
|
|
32
69
|
/**
|
|
33
70
|
* Setup JWT-based browser authentication
|
|
34
71
|
*
|
|
@@ -40,11 +77,17 @@ async function globalSetup(config) {
|
|
|
40
77
|
|
|
41
78
|
// Extract SDK configuration from reporter config or use env
|
|
42
79
|
const sdkConfig = extractSDKConfig(config);
|
|
80
|
+
sdkConfig.enableAppq = resolveEnableAppq(sdkConfig);
|
|
43
81
|
|
|
44
82
|
// Display startup information
|
|
45
83
|
console.log(`🌍 Environment: ${sdkConfig.environment || 'Not specified'}`);
|
|
46
84
|
console.log(`🔗 Test App URL: ${sdkConfig.appUrl || 'Not specified'}`);
|
|
47
85
|
|
|
86
|
+
if (sdkConfig.enableAppq === false) {
|
|
87
|
+
console.log('⚠️ Appq disabled via flag. Skipping JWT setup and backend calls.\n');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
48
91
|
// Show Run ID and Timestamp only in DEBUG mode
|
|
49
92
|
if (process.env.LOG_LEVEL === 'DEBUG') {
|
|
50
93
|
const crypto = require('crypto');
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global Teardown for Playwright Tests
|
|
3
|
+
*
|
|
4
|
+
* This module performs cleanup operations after all tests have completed.
|
|
5
|
+
* It complements global-setup.js which handles JWT authentication setup.
|
|
6
|
+
*
|
|
7
|
+
* What it does:
|
|
8
|
+
* - Logs completion message
|
|
9
|
+
* - Cleans up environment variables
|
|
10
|
+
* - (Optionally) Removes authentication state files
|
|
11
|
+
*
|
|
12
|
+
* @module playwright/global-teardown
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Cleanup after all tests complete
|
|
17
|
+
*
|
|
18
|
+
* @param {Object} config - Playwright config object
|
|
19
|
+
* @returns {Promise<void>}
|
|
20
|
+
*/
|
|
21
|
+
async function globalTeardown(config) {
|
|
22
|
+
console.log('\n🧹 Global Teardown: Cleaning up test environment...\n');
|
|
23
|
+
|
|
24
|
+
// Clean up JWT token from environment (but keep .auth/jwt.json for debugging)
|
|
25
|
+
if (process.env.APPLIQATION_JWT_TOKEN) {
|
|
26
|
+
delete process.env.APPLIQATION_JWT_TOKEN;
|
|
27
|
+
console.log(' ✓ JWT token removed from environment');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Optional: Uncomment to remove authentication state after tests
|
|
31
|
+
// const fs = require('fs');
|
|
32
|
+
// const path = require('path');
|
|
33
|
+
// const authPath = path.resolve('.auth/jwt.json');
|
|
34
|
+
// if (fs.existsSync(authPath)) {
|
|
35
|
+
// fs.unlinkSync(authPath);
|
|
36
|
+
// console.log(' ✓ Authentication state file removed');
|
|
37
|
+
// }
|
|
38
|
+
|
|
39
|
+
console.log('\n✅ Teardown complete!\n');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
module.exports = globalTeardown;
|
|
File without changes
|
package/src/playwright/index.js
CHANGED
|
File without changes
|
|
@@ -2,6 +2,43 @@ const AppliqationClient = require('../../AppliqationClient');
|
|
|
2
2
|
const UuidExtractor = require('./UuidExtractor');
|
|
3
3
|
const logger = require('../../utils/logger');
|
|
4
4
|
|
|
5
|
+
function toBoolean(value) {
|
|
6
|
+
if (value === undefined || value === null) return undefined;
|
|
7
|
+
if (typeof value === 'boolean') return value;
|
|
8
|
+
const normalized = String(value).trim().toLowerCase();
|
|
9
|
+
if (['1', 'true', 'yes', 'on'].includes(normalized)) return true;
|
|
10
|
+
if (['0', 'false', 'no', 'off'].includes(normalized)) return false;
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function parseCliEnableFlag() {
|
|
15
|
+
const argv = process.argv || [];
|
|
16
|
+
for (let i = 0; i < argv.length; i++) {
|
|
17
|
+
const arg = argv[i];
|
|
18
|
+
if (arg.startsWith('--appq=')) {
|
|
19
|
+
return toBoolean(arg.split('=')[1]);
|
|
20
|
+
}
|
|
21
|
+
if (arg === '--appq') {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
if (arg.startsWith('--enable-appq=')) {
|
|
25
|
+
return toBoolean(arg.split('=')[1]);
|
|
26
|
+
}
|
|
27
|
+
if (arg === '--enable-appq') {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function resolveEnableAppq(config) {
|
|
35
|
+
const cliValue = parseCliEnableFlag();
|
|
36
|
+
const envValue = process.env.APPLIQATION_ENABLE ?? process.env.APPQ ?? process.env.APPLIQATION_APPQ;
|
|
37
|
+
const configValue = config?.enableAppq ?? config?.options?.enableAppq;
|
|
38
|
+
const resolved = toBoolean(configValue) ?? toBoolean(cliValue) ?? toBoolean(envValue);
|
|
39
|
+
return resolved !== undefined ? resolved : true;
|
|
40
|
+
}
|
|
41
|
+
|
|
5
42
|
/**
|
|
6
43
|
* Appliqation Reporter for Cypress
|
|
7
44
|
*
|
|
@@ -39,7 +76,8 @@ class CypressReporter {
|
|
|
39
76
|
title: config.title || process.env.APPLIQATION_RUN_TITLE,
|
|
40
77
|
autoCreateRun: config.autoCreateRun !== false,
|
|
41
78
|
logLevel: config.logLevel || 'info',
|
|
42
|
-
submitOrphans: config.submitOrphans !== false
|
|
79
|
+
submitOrphans: config.submitOrphans !== false,
|
|
80
|
+
enableAppq: resolveEnableAppq(config)
|
|
43
81
|
};
|
|
44
82
|
|
|
45
83
|
// Validate required config
|
|
@@ -55,10 +93,15 @@ class CypressReporter {
|
|
|
55
93
|
projectKey: this.config.projectKey,
|
|
56
94
|
title: this.config.title,
|
|
57
95
|
options: {
|
|
58
|
-
logLevel: this.config.logLevel
|
|
96
|
+
logLevel: this.config.logLevel,
|
|
97
|
+
enableAppq: this.config.enableAppq
|
|
59
98
|
}
|
|
60
99
|
});
|
|
61
100
|
|
|
101
|
+
if (this.config.enableAppq === false) {
|
|
102
|
+
logger.warn('Appq disabled via flag. Runs/results will not be sent to Appliqation.');
|
|
103
|
+
}
|
|
104
|
+
|
|
62
105
|
// Test result storage
|
|
63
106
|
this.testResults = [];
|
|
64
107
|
this.orphanTests = [];
|
|
@@ -360,6 +403,10 @@ class CypressReporter {
|
|
|
360
403
|
* Validate configuration
|
|
361
404
|
*/
|
|
362
405
|
validateConfig() {
|
|
406
|
+
if (this.config.enableAppq === false) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
|
|
363
410
|
const required = ['baseUrl', 'apiKey', 'projectKey'];
|
|
364
411
|
const missing = required.filter(key => !this.config[key]);
|
|
365
412
|
|
|
File without changes
|
|
File without changes
|
|
@@ -2,6 +2,43 @@ const AppliqationClient = require('../../AppliqationClient');
|
|
|
2
2
|
const UuidExtractor = require('./UuidExtractor');
|
|
3
3
|
const logger = require('../../utils/logger');
|
|
4
4
|
|
|
5
|
+
function toBoolean(value) {
|
|
6
|
+
if (value === undefined || value === null) return undefined;
|
|
7
|
+
if (typeof value === 'boolean') return value;
|
|
8
|
+
const normalized = String(value).trim().toLowerCase();
|
|
9
|
+
if (['1', 'true', 'yes', 'on'].includes(normalized)) return true;
|
|
10
|
+
if (['0', 'false', 'no', 'off'].includes(normalized)) return false;
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function parseCliEnableFlag() {
|
|
15
|
+
const argv = process.argv || [];
|
|
16
|
+
for (let i = 0; i < argv.length; i++) {
|
|
17
|
+
const arg = argv[i];
|
|
18
|
+
if (arg.startsWith('--appq=')) {
|
|
19
|
+
return toBoolean(arg.split('=')[1]);
|
|
20
|
+
}
|
|
21
|
+
if (arg === '--appq') {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
if (arg.startsWith('--enable-appq=')) {
|
|
25
|
+
return toBoolean(arg.split('=')[1]);
|
|
26
|
+
}
|
|
27
|
+
if (arg === '--enable-appq') {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function resolveEnableAppq(config) {
|
|
35
|
+
const cliValue = parseCliEnableFlag();
|
|
36
|
+
const envValue = process.env.APPLIQATION_ENABLE ?? process.env.APPQ ?? process.env.APPLIQATION_APPQ;
|
|
37
|
+
const configValue = config?.enableAppq ?? config?.options?.enableAppq;
|
|
38
|
+
const resolved = toBoolean(configValue) ?? toBoolean(cliValue) ?? toBoolean(envValue);
|
|
39
|
+
return resolved !== undefined ? resolved : true;
|
|
40
|
+
}
|
|
41
|
+
|
|
5
42
|
/**
|
|
6
43
|
* Appliqation Reporter for Jest
|
|
7
44
|
*
|
|
@@ -39,7 +76,8 @@ class JestReporter {
|
|
|
39
76
|
title: options.title || process.env.APPLIQATION_RUN_TITLE,
|
|
40
77
|
autoCreateRun: options.autoCreateRun !== false,
|
|
41
78
|
logLevel: options.logLevel || 'info',
|
|
42
|
-
submitOrphans: options.submitOrphans !== false
|
|
79
|
+
submitOrphans: options.submitOrphans !== false,
|
|
80
|
+
enableAppq: resolveEnableAppq(options)
|
|
43
81
|
};
|
|
44
82
|
|
|
45
83
|
// Validate required config
|
|
@@ -55,10 +93,15 @@ class JestReporter {
|
|
|
55
93
|
projectKey: this.config.projectKey,
|
|
56
94
|
title: this.config.title,
|
|
57
95
|
options: {
|
|
58
|
-
logLevel: this.config.logLevel
|
|
96
|
+
logLevel: this.config.logLevel,
|
|
97
|
+
enableAppq: this.config.enableAppq
|
|
59
98
|
}
|
|
60
99
|
});
|
|
61
100
|
|
|
101
|
+
if (this.config.enableAppq === false) {
|
|
102
|
+
logger.warn('Appq disabled via flag. Runs/results will not be sent to Appliqation.');
|
|
103
|
+
}
|
|
104
|
+
|
|
62
105
|
// Test result storage
|
|
63
106
|
this.testResults = [];
|
|
64
107
|
this.orphanTests = [];
|
|
@@ -339,6 +382,10 @@ class JestReporter {
|
|
|
339
382
|
* Validate configuration
|
|
340
383
|
*/
|
|
341
384
|
validateConfig() {
|
|
385
|
+
if (this.config.enableAppq === false) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
|
|
342
389
|
const required = ['baseUrl', 'apiKey', 'projectKey'];
|
|
343
390
|
const missing = required.filter(key => !this.config[key]);
|
|
344
391
|
|