@testspectra/cli 1.1.8-rc.20 → 1.1.8-rc.21

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.
@@ -0,0 +1,119 @@
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: From Inside the Feature Directory (Direct CLI)
90
+
91
+ ```bash
92
+ # Navigate to the feature e2e folder
93
+ cd __SAMPLE_FEATURE_E2E_PATH__
94
+
95
+ # Run all specs in this feature
96
+ pnpm spectra run
97
+
98
+ # Run a specific test case by ID (platform is already picked via -t, no need for the file path)
99
+ pnpm spectra run TC-AUTH-01 -t web
100
+
101
+ # Target Android device or emulator
102
+ pnpm spectra run --target android
103
+
104
+ # Run in headed / interactive browser mode
105
+ pnpm spectra run --no-headless
106
+ ```
107
+
108
+ ---
109
+
110
+ ## 4. Type Checking & Validation
111
+
112
+ ```bash
113
+ # Type check all E2E projects via Nx
114
+ pnpm nx run-many -t type-check
115
+
116
+ # Or standard TypeScript project references build from root
117
+ pnpm type-check
118
+ # or: npx tsc -b
119
+ ```