@testspectra/cli 1.0.26 → 1.0.27

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.
@@ -434,7 +434,7 @@ This workspace uses TestSpectra's **"Centralized Configuration, Distributed Impl
434
434
  - \`./pnpm-workspace.yaml\`: Monorepo package glob definitions.
435
435
  - \`./tsconfig.json\`: Solution-style TypeScript orchestrator linking all distributed E2E projects and shared libraries.
436
436
 
437
- ### Centralized Shared Library (\`./${sharedTestingRelPath}\`)
437
+ ### Centralized Shared Testing Library (\`./${sharedTestingRelPath}\`)
438
438
  Provides cross-feature reusable test entities with **100% zero-import global resolution**:
439
439
  - \`page-objects/\`: Shared Page Object models (e.g. NavigationBar, AppHeader).
440
440
  - \`steps/\`: Cross-feature business step flows (e.g. \`Step.loginAsAdmin()\`).
@@ -445,45 +445,109 @@ Provides cross-feature reusable test entities with **100% zero-import global res
445
445
  ${featureE2eDirs.map((d) => {
446
446
  const rel = path.relative(cwd, d);
447
447
  const name = path.basename(path.dirname(d));
448
- return `- \`./${rel}\` (**${name}**):
449
- - \`specs/\`: Feature test cases (\`specs/<SuiteName>/<CaseId>/\` for web, android, ios).
450
- - \`page-objects/\`: Feature-specific Page Objects (e.g. LoginPage, ProductPage).
448
+ const e2eName = `${name}-${e2eFolderName}`;
449
+ return `- \`./${rel}\` (**${name}**, Nx Project: \`${e2eName}\`):
450
+ - \`specs/\`: Feature test cases (\`specs/<SuiteName>/<CaseId>/\` with \`web.test.ts\`, \`android.test.ts\`, \`ios.test.ts\`).
451
+ - \`page-objects/\`: Feature-specific Page Objects (e.g. \`LoginPage\`, \`ProductPage\`).
451
452
  - \`project.json\`: Nx targets (\`e2e\`, \`type-check\`) supporting configurations (\`--configuration=android\`, \`--configuration=ios\`, \`--configuration=headless\`).
452
453
  - \`tsconfig.json\`: Solution TypeScript config reference.`;
453
454
  }).join("\n")}
454
455
 
455
456
  ---
456
457
 
457
- ## 2. Zero-Import Consumption Flow
458
+ ## 2. Zero-Import Consumption Flow & Mechanics
458
459
 
459
- \`\`\`
460
- ┌──────────────────────────────┐ ┌──────────────────────────────┐
461
- │ ${sharedPoLine} │ │ packages/*/e2e/specs/ │
462
- │ ${sharedStepsLine} │ ───────► │ (Zero-Import Test Cases) │
463
- │ ${sharedActLine} │ │ - NavigationBar.goToHome() │
464
- │ ${sharedFixLine} │ │ - Step.loginAsAdmin() │
465
- └──────────────────────────────┘ │ - Spectra.dismissBanner() │
466
- └──────────────────────────────┘
460
+ TestSpectra completely eliminates boilerplate \`import\` statements across all test specs, steps, and page objects.
461
+
462
+ ### How It Works:
463
+ 1. **Centralized Ambient Aggregation**:
464
+ TestSpectra Language Service Plugin & CLI automatically scan:
465
+ - **Local Feature Entities**: \`<feature>/${e2eFolderName}/page-objects/\`, \`<feature>/${e2eFolderName}/steps/\`, \`<feature>/${e2eFolderName}/actions/\`
466
+ - **Shared Library Entities**: \`./${sharedTestingRelPath}/page-objects/\`, \`./${sharedTestingRelPath}/steps/\`, \`./${sharedTestingRelPath}/actions/\`, \`./${sharedTestingRelPath}/fixtures/\`
467
+ 2. **Ambient Typing Generation**:
468
+ These are compiled into \`.testspectra/types/web.d.ts\`, \`android.d.ts\`, \`ios.d.ts\`, \`fixtures.d.ts\`.
469
+ 3. **Instant IDE Autocomplete & Zero Clutter**:
470
+ Specs consume both local feature objects and shared library utilities globally.
471
+
472
+ ### Code Example:
473
+ \`\`\`typescript
474
+ // modules/auth/e2e/specs/Auth/TC-AUTH-01/web.test.ts
475
+ // 🌟 NOTICE: 100% Zero-Import statement! Everything resolves globally.
476
+
477
+ describe("Authentication Flow", () => {
478
+ it("should navigate via shared header and login with local POM", async () => {
479
+ // 1. Consumed from Shared Library (${sharedTestingRelPath}/page-objects/NavigationBar)
480
+ await NavigationBar.goToLogin();
481
+
482
+ // 2. Consumed from Shared Library (${sharedTestingRelPath}/steps/loginAsAdmin)
483
+ await Step.loginAsAdmin();
484
+
485
+ // 3. Consumed from Local Feature POM (modules/auth/e2e/page-objects/LoginPage)
486
+ await LoginPage.flashAlert.shouldBeVisible();
487
+ await LoginPage.flashAlert.shouldContainText("Welcome");
488
+
489
+ // 4. Consumed from Shared Library Custom Action (${sharedTestingRelPath}/actions/dismissBanner)
490
+ await Spectra.dismissBanner();
491
+ });
492
+ });
467
493
  \`\`\`
468
494
 
469
495
  ---
470
496
 
471
- ## 3. Running Tests via Nx
497
+ ## 3. How to Run Tests
498
+
499
+ You can execute tests either from the **Monorepo Root via Nx** or directly inside each **Feature Directory via CLI**:
500
+
501
+ ### Option A: From Root Monorepo via Nx (Recommended for CI & Team Workflows)
472
502
 
473
503
  \`\`\`bash
474
- # Run all feature E2E suites in parallel
504
+ # 1. Run E2E for a SPECIFIC feature module (e.g. auth)
505
+ pnpm nx run auth-${e2eFolderName}:e2e
506
+
507
+ # 2. Run E2E for a specific feature on ANDROID or IOS
508
+ pnpm nx run auth-${e2eFolderName}:e2e --configuration=android
509
+ pnpm nx run auth-${e2eFolderName}:e2e --configuration=ios
510
+
511
+ # 3. Run E2E for a specific feature in HEADLESS browser mode
512
+ pnpm nx run auth-${e2eFolderName}:e2e --configuration=headless
513
+
514
+ # 4. Run ALL feature E2E suites across the entire monorepo in parallel
475
515
  pnpm nx run-many -t e2e
476
516
 
477
- # Run only E2E tests for features changed in PR
517
+ # 5. Run only E2E tests for features modified in current Git branch / PR
478
518
  pnpm nx affected -t e2e
519
+ \`\`\`
479
520
 
480
- # Run E2E for a specific feature on Android
481
- pnpm nx run auth-${e2eFolderName}:e2e --configuration=android
521
+ ### Option B: From Inside the Feature Directory (Direct CLI)
522
+
523
+ \`\`\`bash
524
+ # Navigate to the feature e2e folder
525
+ cd ${featureE2eDirs.length > 0 ? path.relative(cwd, featureE2eDirs[0]).replace(/\\/g, "/") : `modules/auth/${e2eFolderName}`}
526
+
527
+ # Run all specs in this feature
528
+ pnpm spectra run
529
+
530
+ # Run a specific test case file
531
+ pnpm spectra run specs/Auth/TC-AUTH-01/web.test.ts
532
+
533
+ # Target Android device or emulator
534
+ pnpm spectra run --target android
482
535
 
483
- # Run type check across all E2E projects
536
+ # Run in headed / interactive browser mode
537
+ pnpm spectra run --no-headless
538
+ \`\`\`
539
+
540
+ ---
541
+
542
+ ## 4. Type Checking & Validation
543
+
544
+ \`\`\`bash
545
+ # Type check all E2E projects via Nx
484
546
  pnpm nx run-many -t type-check
485
- # Or standard TypeScript compilation
547
+
548
+ # Or standard TypeScript project references build from root
486
549
  pnpm type-check
550
+ # or: npx tsc -b
487
551
  \`\`\`
488
552
  `;
489
553
  fs.writeFileSync(path.join(cwd, "ARCHITECTURE.md"), archDocContent, "utf-8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testspectra/cli",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
4
4
  "description": "TestSpectra Zero-Config Cross-Platform Test Runner CLI",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",