@testspectra/cli 1.1.8-rc.9 → 1.1.11-rc.3

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 (93) hide show
  1. package/README.md +11 -8
  2. package/bin/.testspectra-runner.hash +1 -0
  3. package/dist/commands/__tests__/doctor-filter.test.js +37 -0
  4. package/dist/commands/__tests__/doctor-scope.test.d.ts +1 -0
  5. package/dist/commands/__tests__/doctor-scope.test.js +24 -0
  6. package/dist/commands/__tests__/test-error-streaming.test.d.ts +1 -0
  7. package/dist/commands/__tests__/test-error-streaming.test.js +85 -0
  8. package/dist/commands/__tests__/test-scaffolding.test.d.ts +1 -0
  9. package/dist/commands/__tests__/test-scaffolding.test.js +32 -0
  10. package/dist/commands/__tests__/upgrade.test.d.ts +1 -0
  11. package/dist/commands/__tests__/upgrade.test.js +95 -0
  12. package/dist/commands/add.js +3 -3
  13. package/dist/commands/devices.js +1 -0
  14. package/dist/commands/docs.d.ts +4 -0
  15. package/dist/commands/docs.js +17 -0
  16. package/dist/commands/doctor.d.ts +9 -1
  17. package/dist/commands/doctor.js +17 -3
  18. package/dist/commands/init.js +5 -159
  19. package/dist/commands/install.js +5 -0
  20. package/dist/commands/license.js +1 -0
  21. package/dist/commands/run.d.ts +2 -0
  22. package/dist/commands/run.js +22 -0
  23. package/dist/commands/test.d.ts +13 -0
  24. package/dist/commands/test.js +115 -21
  25. package/dist/commands/upgrade.d.ts +12 -0
  26. package/dist/commands/upgrade.js +197 -0
  27. package/dist/config/schema.d.ts +53 -0
  28. package/dist/config/schema.js +2 -0
  29. package/dist/generator/__tests__/tsconfig-isolation.test.js +2 -1
  30. package/dist/generator/architecture-doc-generator.d.ts +14 -0
  31. package/dist/generator/architecture-doc-generator.js +80 -0
  32. package/dist/generator/index.d.ts +1 -0
  33. package/dist/generator/index.js +1 -0
  34. package/dist/generator/tsconfig-generator.js +1 -1
  35. package/dist/index.js +59 -16
  36. package/dist/linter/discovery.js +2 -2
  37. package/dist/linter/schemas/spec.schema.d.ts +6 -6
  38. package/dist/runner/bridge.d.ts +1 -1
  39. package/dist/runner/bridge.js +58 -16
  40. package/dist/runner/reporter.d.ts +1 -0
  41. package/dist/runner/reporter.js +12 -6
  42. package/dist/utils/__tests__/dev-server-manager.test.d.ts +1 -0
  43. package/dist/utils/__tests__/dev-server-manager.test.js +72 -0
  44. package/dist/utils/background-update-check.d.ts +1 -0
  45. package/dist/utils/background-update-check.js +43 -0
  46. package/dist/utils/dependency-updates.d.ts +15 -0
  47. package/dist/utils/dependency-updates.js +107 -0
  48. package/dist/utils/dev-server-manager.d.ts +40 -0
  49. package/dist/utils/dev-server-manager.js +257 -0
  50. package/dist/utils/update-notifier.d.ts +2 -0
  51. package/dist/utils/update-notifier.js +67 -0
  52. package/package.json +10 -9
  53. package/templates/default/package.json +2 -2
  54. package/templates/docs/ARCHITECTURE.default.md +26 -0
  55. package/templates/docs/ARCHITECTURE.nx.md +147 -0
  56. package/templates/nx/.nx/workspace-data/70094CFD-E89B-57A1-9619-2FC5F4963C54.db +0 -0
  57. package/templates/nx/.nx/workspace-data/d/daemon.log +1012 -5748
  58. package/templates/nx/.nx/workspace-data/file-map.json +171 -185
  59. package/templates/nx/.nx/workspace-data/lockfile.hash +1 -1
  60. package/templates/nx/.nx/workspace-data/nx_files.nxt +0 -0
  61. package/templates/nx/.nx/workspace-data/project-graph.json +3 -1
  62. package/templates/nx/.nx/workspace-data/source-maps.json +336 -0
  63. package/templates/nx/package.json +3 -3
  64. package/templates/nx/pnpm-lock.yaml +191 -214
  65. package/templates/nx/spectra.config.ts +13 -0
  66. package/templates/react-component/package.json +3 -3
  67. package/templates/react-component/page-objects/BadgeComponent/web.ts +4 -4
  68. package/templates/react-component/page-objects/ButtonComponent/web.ts +3 -3
  69. package/templates/react-component/page-objects/InputComponent/web.ts +1 -1
  70. package/templates/react-component/specs/ButtonComponent/TC-0001-button-rendering-and-click/web.test.tsx +0 -3
  71. package/templates/react-component/specs/ButtonComponent/TC-0004-disabled-button-not-clickable/web.test.tsx +0 -9
  72. package/templates/react-component/specs/ButtonComponent/TC-0005-button-renders-icon/web.test.tsx +1 -1
  73. package/templates/react-component/specs/InputComponent/TC-0003-input-typing-and-clear/web.test.tsx +4 -8
  74. package/templates/react-component/spectra.config.ts +0 -10
  75. package/templates/react-component/src/components/Badge/Badge.tsx +3 -3
  76. package/templates/react-component/src/components/Button/Button.tsx +5 -3
  77. package/templates/react-component/src/components/Input/Input.tsx +2 -3
  78. package/dist/.tsbuildinfo +0 -1
  79. package/dist/commands/update.d.ts +0 -3
  80. package/dist/commands/update.js +0 -109
  81. package/dist/lifecycle/__tests__/lifecycle-engine.test.js +0 -290
  82. package/dist/lifecycle/hook-discovery.d.ts +0 -24
  83. package/dist/lifecycle/hook-discovery.js +0 -60
  84. package/dist/lifecycle/hook-dispatcher.d.ts +0 -34
  85. package/dist/lifecycle/hook-dispatcher.js +0 -190
  86. package/dist/lifecycle/index.d.ts +0 -3
  87. package/dist/lifecycle/index.js +0 -3
  88. package/dist/lifecycle/parallel-grouping.d.ts +0 -27
  89. package/dist/lifecycle/parallel-grouping.js +0 -151
  90. package/templates/nx/.nx/workspace-data/70094CFD-E89B-57A1-9619-2FC5F4963C54.db-shm +0 -0
  91. package/templates/nx/.nx/workspace-data/70094CFD-E89B-57A1-9619-2FC5F4963C54.db-wal +0 -0
  92. package/templates/nx/.nx/workspace-data/d/server-process.json +0 -3
  93. /package/dist/{lifecycle/__tests__/lifecycle-engine.test.d.ts → commands/__tests__/doctor-filter.test.d.ts} +0 -0
@@ -0,0 +1,147 @@
1
+ # TestSpectra Enterprise Monorepo Architecture
2
+
3
+ This workspace uses TestSpectra's **"Centralized Configuration, Distributed Implementation"** model for automated cross-platform testing.
4
+
5
+ ---
6
+
7
+ ## 1. Directory & File Overview
8
+
9
+ ### Centralized Root Elements
10
+ - `./spectra.config.ts`: Single source of truth for runtime configurations (Base URL, Appium devices, browser targets, timeouts).
11
+ - `./.testspectra/`: Local test project cache, runtime metadata, auto-generated master TSConfig (`.testspectra/tsconfig.json`), platform sub-configs (`.testspectra/tsconfig/`), and universal ambient types (`.testspectra/types/`). Global binaries and drivers are managed at `~/.testspectra/drivers/`.
12
+ - `./nx.json`: Nx target defaults with execution caching and inputs.
13
+ - `./pnpm-workspace.yaml`: Monorepo package glob definitions.
14
+ - `./tsconfig.json`: Solution-style TypeScript orchestrator referencing `./.testspectra/tsconfig.json`.
15
+
16
+ ### Centralized Shared Testing Library (`./__SHARED_TESTING_REL_PATH__`)
17
+ Provides cross-feature reusable test entities with **100% zero-import global resolution**:
18
+ - `page-objects/`: Shared Page Object models (e.g. NavigationBar, AppHeader).
19
+ - `support/steps/`: Cross-feature business step flows (e.g. `Step.loginAsAdmin()`).
20
+ - `support/actions/`: Custom atomic actions (e.g. `Spectra.dismissBanner()`).
21
+ - `fixtures/`: Common test data and environment configurations (e.g. `Fixture.appConfig`).
22
+
23
+ ### Distributed Feature E2E Modules (__FEATURE_COUNT__ Features)
24
+ __FEATURE_MODULES_SECTION__
25
+
26
+ ---
27
+
28
+ ## 2. Zero-Import Consumption Flow & Mechanics
29
+
30
+ TestSpectra completely eliminates boilerplate `import` statements across all test specs, steps, and page objects.
31
+
32
+ ### How It Works:
33
+ 1. **Centralized Ambient Aggregation**:
34
+ TestSpectra Language Service Plugin & CLI automatically scan:
35
+ - **Local Feature Entities**: `<feature>/__E2E_FOLDER_NAME__/page-objects/`, `<feature>/__E2E_FOLDER_NAME__/support/steps/`, `<feature>/__E2E_FOLDER_NAME__/support/actions/`
36
+ - **Shared Library Entities**: `./__SHARED_TESTING_REL_PATH__/page-objects/`, `./__SHARED_TESTING_REL_PATH__/support/steps/`, `./__SHARED_TESTING_REL_PATH__/support/actions/`, `./__SHARED_TESTING_REL_PATH__/fixtures/`
37
+ 2. **Ambient Typing Generation**:
38
+ These are compiled into `.testspectra/types/web.d.ts`, `android.d.ts`, `ios.d.ts`, `fixtures.d.ts`.
39
+ 3. **Instant IDE Autocomplete & Zero Clutter**:
40
+ Specs consume both local feature objects and shared library utilities globally.
41
+
42
+ ### Code Example:
43
+ ```typescript
44
+ // packages/features/auth/e2e/specs/Auth/TC-AUTH-01/web.test.ts
45
+ // 🌟 NOTICE: 100% Zero-Import & Flat Execution! (No import statement, no describe wrapper)
46
+
47
+ it("should navigate via shared header and login with local POM", async () => {
48
+ // 1. Consumed from Shared Testing Library (__SHARED_TESTING_REL_PATH__/page-objects/NavigationBar)
49
+ await NavigationBar.goToLogin();
50
+
51
+ // 2. Consumed from Shared Testing Library (__SHARED_TESTING_REL_PATH__/support/steps/loginAsAdmin)
52
+ await Step.loginAsAdmin();
53
+
54
+ // 3. Consumed from Local Feature POM (page-objects/LoginPage)
55
+ await LoginPage.flashAlert.shouldBeVisible();
56
+ await LoginPage.flashAlert.shouldContainText("Welcome");
57
+
58
+ // 4. Consumed from Shared Testing Library Custom Action (__SHARED_TESTING_REL_PATH__/support/actions/dismissBanner)
59
+ await Spectra.dismissBanner();
60
+ });
61
+ ```
62
+
63
+ ---
64
+
65
+ ## 3. How to Run Tests
66
+
67
+ You can execute tests either from the **Monorepo Root via Nx** or directly inside each **Feature Directory via CLI**:
68
+
69
+ ### Option A: From Root Monorepo via Nx (Recommended for CI & Team Workflows)
70
+
71
+ ```bash
72
+ # 1. Run E2E for a SPECIFIC feature module (e.g. auth)
73
+ pnpm nx run auth-__E2E_FOLDER_NAME__:e2e
74
+
75
+ # 2. Run E2E for a specific feature on ANDROID or IOS
76
+ pnpm nx run auth-__E2E_FOLDER_NAME__:e2e --configuration=android
77
+ pnpm nx run auth-__E2E_FOLDER_NAME__:e2e --configuration=ios
78
+
79
+ # 3. Run E2E for a specific feature in HEADLESS browser mode
80
+ pnpm nx run auth-__E2E_FOLDER_NAME__:e2e --configuration=headless
81
+
82
+ # 4. Run ALL feature E2E suites across the entire monorepo in parallel
83
+ pnpm nx run-many -t e2e
84
+
85
+ # 5. Run only E2E tests for features modified in current Git branch / PR
86
+ pnpm nx affected -t e2e
87
+ ```
88
+
89
+ ### Option B: Directly via TestSpectra CLI (`spectra run`)
90
+
91
+ You can execute tests directly via CLI from either the **Monorepo Root** or inside a **Feature Directory**.
92
+ *Zero file-path overhead: You do NOT need to provide long file globs like `"packages/features/auth/**/*.spec.web.ts"` — just specify the TC ID or Suite name directly.*
93
+
94
+ ```bash
95
+ # === From Monorepo Root ===
96
+
97
+ # 1. Run ALL tests across the entire monorepo
98
+ # (Spawns configured dev servers in parallel, checks readiness, runs tests, tears down)
99
+ pnpm spectra run
100
+
101
+ # 2. Run all tests for a specific host / dev server
102
+ pnpm spectra run --host sso
103
+
104
+ # 3. Run a specific test case by ID (simple TC ID, no long file path needed)
105
+ pnpm spectra run --host sso --spec TC-AUTH-01
106
+
107
+ # Or as a direct positional argument:
108
+ pnpm spectra run --host sso TC-AUTH-01
109
+
110
+ # 4. Run an entire suite by suite name
111
+ pnpm spectra run --host sso --spec Auth
112
+ # Or:
113
+ pnpm spectra run --host sso Auth
114
+
115
+ # 5. Run in Headed mode (visible Chrome window)
116
+ pnpm spectra run --host sso --headed
117
+
118
+ # === From Inside Feature Directory (cd __SAMPLE_FEATURE_E2E_PATH__) ===
119
+
120
+ # Run all specs in this feature
121
+ pnpm spectra run
122
+
123
+ # Run a specific test case by ID
124
+ pnpm spectra run TC-AUTH-01 -t web
125
+
126
+ # Run a specific suite by name
127
+ pnpm spectra run Auth -t web
128
+
129
+ # Target Android device or emulator
130
+ pnpm spectra run -t android
131
+
132
+ # Target iOS simulator or device
133
+ pnpm spectra run -t ios
134
+ ```
135
+
136
+ ---
137
+
138
+ ## 4. Type Checking & Validation
139
+
140
+ ```bash
141
+ # Type check all E2E projects via Nx
142
+ pnpm nx run-many -t type-check
143
+
144
+ # Or standard TypeScript project references build from root
145
+ pnpm type-check
146
+ # or: npx tsc -b
147
+ ```