@testspectra/cli 1.0.7 → 1.0.10
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/dist/commands/init.js +58 -398
- package/dist/commands/run.js +18 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +8 -1
- package/templates/default/actions/applyDiscount/mobile.action.ts +6 -0
- package/templates/default/actions/applyDiscount/web.action.ts +6 -0
- package/templates/default/actions/verifyOtp/mobile.action.ts +6 -0
- package/templates/default/actions/verifyOtp/web.action.ts +6 -0
- package/templates/default/fixtures/couponCode.json +1 -0
- package/templates/default/fixtures/searchQuery.json +1 -0
- package/templates/default/fixtures/userData.json +1 -0
- package/templates/default/global-hooks/before.web.hook.ts +4 -0
- package/templates/default/package.json +18 -0
- package/templates/default/page-objects/LoginPage/mobile.ts +32 -0
- package/templates/default/page-objects/LoginPage/web.ts +32 -0
- package/templates/default/page-objects/ProductPage/mobile.ts +39 -0
- package/templates/default/page-objects/ProductPage/web.ts +38 -0
- package/templates/default/page-objects/SettingsPage/common.ts +26 -0
- package/templates/default/spectra.config.ts +61 -0
- package/templates/default/steps/loginUser/mobile.step.ts +4 -0
- package/templates/default/steps/loginUser/web.step.ts +4 -0
- package/templates/default/steps/searchProduct/mobile.step.ts +5 -0
- package/templates/default/steps/searchProduct/web.step.ts +5 -0
- package/templates/default/suites/Auth/TC-AUTH-01/android.test.ts +6 -0
- package/templates/default/suites/Auth/TC-AUTH-01/ios.test.ts +6 -0
- package/templates/default/suites/Auth/TC-AUTH-01/web.test.ts +13 -0
- package/templates/default/suites/Auth/TC-AUTH-02/android.test.ts +5 -0
- package/templates/default/suites/Auth/TC-AUTH-02/web.test.ts +5 -0
- package/templates/default/suites/Auth/hooks/before.android.hook.ts +3 -0
- package/templates/default/suites/Auth/hooks/before.ios.hook.ts +3 -0
- package/templates/default/suites/Auth/hooks/before.web.hook.ts +3 -0
- package/templates/default/suites/Product/TC-PROD-01/mobile.test.ts +8 -0
- package/templates/default/suites/Product/TC-PROD-01/web.test.ts +8 -0
- package/templates/default/suites/Product/TC-PROD-02/mobile.test.ts +6 -0
- package/templates/default/suites/Product/TC-PROD-02/web.test.ts +6 -0
- package/templates/default/suites/Product/hooks/before.web.hook.ts +3 -0
- package/templates/default/suites/Settings/TC-SET-01/common.test.ts +8 -0
- package/templates/default/tsconfig.android.json +39 -0
- package/templates/default/tsconfig.ios.json +39 -0
- package/templates/default/tsconfig.json +20 -0
- package/templates/default/tsconfig.web.json +45 -0
- package/CLI_IMPLEMENTATION_PLAN.md +0 -369
- package/src/commands/devices.ts +0 -41
- package/src/commands/doctor.ts +0 -57
- package/src/commands/init.ts +0 -470
- package/src/commands/run.ts +0 -102
- package/src/config/loader.ts +0 -82
- package/src/config/schema.ts +0 -489
- package/src/index.ts +0 -56
- package/src/plugin.ts +0 -81
- package/src/runner/bridge.ts +0 -146
- package/src/runner/reporter.ts +0 -64
- package/src/step/index.ts +0 -6
- package/src/step/matchers.ts +0 -131
- package/src/step/proto.ts +0 -163
- package/src/step/runner/collection.ts +0 -73
- package/src/step/runner/single.ts +0 -166
- package/src/step/spectra.ts +0 -185
- package/src/step/types.ts +0 -113
- package/src/types/generator.ts +0 -240
- package/src/types/webdriverio.d.ts +0 -46
- package/testspectra-cli-1.0.5.tgz +0 -0
- package/testspectra-cli-1.0.6.tgz +0 -0
- package/testspectra-cli-1.0.7.tgz +0 -0
- package/tsconfig.json +0 -17
package/src/config/schema.ts
DELETED
|
@@ -1,489 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration for web automation and browser test runners.
|
|
3
|
-
*/
|
|
4
|
-
export interface WebConfig {
|
|
5
|
-
/**
|
|
6
|
-
* Base URL used to resolve relative paths in tests (e.g. `browser.url('/login')` or `browser.intercept('/api/users')`).
|
|
7
|
-
* @default "http://localhost:3000"
|
|
8
|
-
*/
|
|
9
|
-
baseUrl: string;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Maximum number of parallel browser sessions/workers spawned during test execution.
|
|
13
|
-
* @default "1"
|
|
14
|
-
*/
|
|
15
|
-
maxConcurrentSessions: string;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Whether to run browsers in headless mode without a visible GUI window.
|
|
19
|
-
* @default true
|
|
20
|
-
*/
|
|
21
|
-
headlessMode: boolean;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Implicit wait timeout (in milliseconds) for finding elements before throwing an error.
|
|
25
|
-
* @default "5000"
|
|
26
|
-
*/
|
|
27
|
-
implicitWait: string;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Maximum time (in milliseconds) allowed for a webpage to complete navigation and initial load.
|
|
31
|
-
* @default "30000"
|
|
32
|
-
*/
|
|
33
|
-
pageLoadTimeout: string;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Maximum time (in milliseconds) allowed for asynchronous scripts to finish executing.
|
|
37
|
-
* @default "30000"
|
|
38
|
-
*/
|
|
39
|
-
scriptTimeout: string;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Parallelization granularity:
|
|
43
|
-
* - `"testcase"`: Each test case executes in parallel across available workers.
|
|
44
|
-
* - `"suite"`: Test cases within a suite run serially, while different suites run in parallel.
|
|
45
|
-
* @default "testcase"
|
|
46
|
-
*/
|
|
47
|
-
parallelizationMode: "testcase" | "suite";
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Browser target definition for web test execution.
|
|
52
|
-
*/
|
|
53
|
-
export interface Browser {
|
|
54
|
-
/**
|
|
55
|
-
* Unique identifier for this browser configuration.
|
|
56
|
-
*/
|
|
57
|
-
id: string;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Browser type/engine: `"chrome"`, `"firefox"`, `"safari"`, `"edge"`.
|
|
61
|
-
* @default "chrome"
|
|
62
|
-
*/
|
|
63
|
-
type: string;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Whether to simulate mobile viewport and touch metrics.
|
|
67
|
-
* @default false
|
|
68
|
-
*/
|
|
69
|
-
mobileEmulation: boolean;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Emulated device name when `mobileEmulation` is true (e.g. `"iPhone 14"`, `"Pixel 7"`).
|
|
73
|
-
*/
|
|
74
|
-
deviceName?: string;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Custom browser window width in pixels.
|
|
78
|
-
*/
|
|
79
|
-
width?: string;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Custom browser window height in pixels.
|
|
83
|
-
*/
|
|
84
|
-
height?: string;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Configuration for Android mobile test automation with Appium & UiAutomator2.
|
|
89
|
-
*/
|
|
90
|
-
export interface AndroidConfig {
|
|
91
|
-
/**
|
|
92
|
-
* Appium server endpoint URL.
|
|
93
|
-
* @default "http://127.0.0.1:4723"
|
|
94
|
-
*/
|
|
95
|
-
appiumServer: string;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Mobile platform name.
|
|
99
|
-
* @default "Android"
|
|
100
|
-
*/
|
|
101
|
-
platformName: string;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Android OS version (e.g. `"13"`, `"14"`).
|
|
105
|
-
* @default "13"
|
|
106
|
-
*/
|
|
107
|
-
platformVersion: string;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Target Android device name or ADB serial ID (e.g. `"emulator-5554"`).
|
|
111
|
-
* @default "emulator-5554"
|
|
112
|
-
*/
|
|
113
|
-
deviceName: string;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Appium mobile automation driver engine.
|
|
117
|
-
* @default "UiAutomator2"
|
|
118
|
-
*/
|
|
119
|
-
automationName: string;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Android application package name (e.g. `"com.example.app"`).
|
|
123
|
-
*/
|
|
124
|
-
appPackage: string;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Main activity name launched when starting the app.
|
|
128
|
-
*/
|
|
129
|
-
appActivity: string;
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Whether to automatically grant Android runtime permissions upon installation.
|
|
133
|
-
* @default true
|
|
134
|
-
*/
|
|
135
|
-
autoGrantPermissions: boolean;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Whether to preserve app state and prevent clearing app data/cache between sessions.
|
|
139
|
-
* @default false
|
|
140
|
-
*/
|
|
141
|
-
noReset: boolean;
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Implicit wait timeout (in milliseconds) for locating mobile elements.
|
|
145
|
-
* @default "10000"
|
|
146
|
-
*/
|
|
147
|
-
implicitWait: string;
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Parallelization execution mode for Android mobile tests.
|
|
151
|
-
* @default "suite"
|
|
152
|
-
*/
|
|
153
|
-
parallelizationMode: "testcase" | "suite";
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Configuration for iOS mobile test automation with Appium & XCUITest.
|
|
158
|
-
*/
|
|
159
|
-
export interface IosConfig {
|
|
160
|
-
/**
|
|
161
|
-
* Appium server endpoint URL.
|
|
162
|
-
* @default "http://127.0.0.1:4723"
|
|
163
|
-
*/
|
|
164
|
-
appiumServer: string;
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Mobile platform name.
|
|
168
|
-
* @default "iOS"
|
|
169
|
-
*/
|
|
170
|
-
platformName: string;
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* iOS version (e.g. `"16.0"`, `"17.0"`).
|
|
174
|
-
* @default "16.0"
|
|
175
|
-
*/
|
|
176
|
-
platformVersion: string;
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* iOS simulator or connected physical device name (e.g. `"iPhone 14"`).
|
|
180
|
-
* @default "iPhone 14"
|
|
181
|
-
*/
|
|
182
|
-
deviceName: string;
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Appium mobile automation driver engine for iOS.
|
|
186
|
-
* @default "XCUITest"
|
|
187
|
-
*/
|
|
188
|
-
automationName: string;
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* iOS Application Bundle Identifier (e.g. `"com.example.iosapp"`).
|
|
192
|
-
*/
|
|
193
|
-
bundleId: string;
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Target device Unique Device Identifier (UDID) or `"auto"`.
|
|
197
|
-
* @default "auto"
|
|
198
|
-
*/
|
|
199
|
-
udid: string;
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Apple Developer Team 10-character Organization ID for code signing.
|
|
203
|
-
*/
|
|
204
|
-
xcodeOrgId: string;
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Xcode code signing identity string (e.g. `"iPhone Developer"`).
|
|
208
|
-
* @default "iPhone Developer"
|
|
209
|
-
*/
|
|
210
|
-
xcodeSigningId: string;
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Whether to automatically accept iOS system permission alerts.
|
|
214
|
-
* @default true
|
|
215
|
-
*/
|
|
216
|
-
autoAcceptAlerts: boolean;
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Whether to preserve app state between sessions.
|
|
220
|
-
* @default false
|
|
221
|
-
*/
|
|
222
|
-
noReset: boolean;
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Implicit wait timeout (in milliseconds) for locating iOS UI elements.
|
|
226
|
-
* @default "10000"
|
|
227
|
-
*/
|
|
228
|
-
implicitWait: string;
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Parallelization execution mode for iOS mobile tests.
|
|
232
|
-
* @default "suite"
|
|
233
|
-
*/
|
|
234
|
-
parallelizationMode: "testcase" | "suite";
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Load testing stage ramp-up profile.
|
|
239
|
-
*/
|
|
240
|
-
export interface LoadStage {
|
|
241
|
-
/**
|
|
242
|
-
* Stage identifier.
|
|
243
|
-
*/
|
|
244
|
-
id: string;
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Duration for this load stage (e.g. `"30s"`, `"2m"`).
|
|
248
|
-
*/
|
|
249
|
-
duration: string;
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Target virtual users (VUs) to scale to during this stage.
|
|
253
|
-
*/
|
|
254
|
-
targetVUs: string;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Performance and pass/fail metric threshold definition.
|
|
259
|
-
*/
|
|
260
|
-
export interface SuccessThreshold {
|
|
261
|
-
/**
|
|
262
|
-
* Unique threshold identifier.
|
|
263
|
-
*/
|
|
264
|
-
id: string;
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Performance metric type (e.g. `"http_req_duration"`, `"http_req_failed"`).
|
|
268
|
-
*/
|
|
269
|
-
metricType: string;
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Maximum acceptable value (e.g. `"500ms"`, `"0.01"`).
|
|
273
|
-
*/
|
|
274
|
-
maxValue: string;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* Specific domain filter for real-time network interception and recording.
|
|
279
|
-
*/
|
|
280
|
-
export interface MonitoredDomain {
|
|
281
|
-
/**
|
|
282
|
-
* Hostname or regex pattern to monitor (e.g. `"api.example.com"`).
|
|
283
|
-
*/
|
|
284
|
-
domain: string;
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Whether network logging and CDP interception is active for this domain.
|
|
288
|
-
*/
|
|
289
|
-
enabled: boolean;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Custom environment variable key-value pair injected into the test execution sandbox.
|
|
294
|
-
*/
|
|
295
|
-
export interface EnvironmentVariable {
|
|
296
|
-
/**
|
|
297
|
-
* Environment variable name (e.g. `"API_SECRET_KEY"`).
|
|
298
|
-
*/
|
|
299
|
-
key: string;
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Environment variable value.
|
|
303
|
-
*/
|
|
304
|
-
value: string;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* Test execution, CDP network monitoring, and sandbox environment configuration.
|
|
309
|
-
*/
|
|
310
|
-
export interface ExecutionConfig {
|
|
311
|
-
/**
|
|
312
|
-
* Whether to record network requests and timing metrics via Chrome DevTools Protocol.
|
|
313
|
-
* @default true
|
|
314
|
-
*/
|
|
315
|
-
networkMonitoringEnabled: boolean;
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Upper threshold (in milliseconds) classified as a fast network response.
|
|
319
|
-
* @default "200"
|
|
320
|
-
*/
|
|
321
|
-
fastResponseTime: string;
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Upper threshold (in milliseconds) classified as a normal network response.
|
|
325
|
-
* @default "1000"
|
|
326
|
-
*/
|
|
327
|
-
normalResponseTime: string;
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Whitelist of domains to monitor. If empty, all requests are captured.
|
|
331
|
-
*/
|
|
332
|
-
monitoredDomains?: MonitoredDomain[];
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Custom environment variables injected into the test process runtime.
|
|
336
|
-
*/
|
|
337
|
-
environmentVariables?: EnvironmentVariable[];
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Root configuration data structure matching TestSpectra project schema.
|
|
342
|
-
*/
|
|
343
|
-
export interface ConfigData {
|
|
344
|
-
/**
|
|
345
|
-
* Web browser execution settings.
|
|
346
|
-
*/
|
|
347
|
-
webConfig: WebConfig;
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* List of target browsers for web automation runs.
|
|
351
|
-
*/
|
|
352
|
-
browsers: Browser[];
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* Android Appium driver and device options.
|
|
356
|
-
*/
|
|
357
|
-
androidConfig: AndroidConfig;
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* iOS Appium driver and device options.
|
|
361
|
-
*/
|
|
362
|
-
iosConfig: IosConfig;
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* Load testing parameters.
|
|
366
|
-
*/
|
|
367
|
-
loadConfig: {
|
|
368
|
-
virtualUsers: string;
|
|
369
|
-
duration: string;
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Load testing stages.
|
|
374
|
-
*/
|
|
375
|
-
loadStages: LoadStage[];
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* Pass/fail metric thresholds.
|
|
379
|
-
*/
|
|
380
|
-
thresholds: SuccessThreshold[];
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Advanced execution and network recording settings.
|
|
384
|
-
*/
|
|
385
|
-
executionConfig?: ExecutionConfig;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
/**
|
|
389
|
-
* Deep recursive partial type for user-friendly configuration objects.
|
|
390
|
-
*/
|
|
391
|
-
export type DeepPartial<T> = {
|
|
392
|
-
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
393
|
-
};
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* User-provided configuration options with optional deep partial properties.
|
|
397
|
-
*/
|
|
398
|
-
export type UserConfig = DeepPartial<ConfigData>;
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* Helper function providing type hinting and autocompletion for `spectra.config.ts`.
|
|
402
|
-
*
|
|
403
|
-
* @example
|
|
404
|
-
* ```ts
|
|
405
|
-
* import { defineConfig } from "@testspectra/cli";
|
|
406
|
-
*
|
|
407
|
-
* export default defineConfig({
|
|
408
|
-
* webConfig: {
|
|
409
|
-
* baseUrl: "https://example.com",
|
|
410
|
-
* headlessMode: false,
|
|
411
|
-
* },
|
|
412
|
-
* });
|
|
413
|
-
* ```
|
|
414
|
-
*/
|
|
415
|
-
export function defineConfig(config: UserConfig): UserConfig {
|
|
416
|
-
return config;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* Complete project persistence record.
|
|
421
|
-
*/
|
|
422
|
-
export interface ProjectConfig {
|
|
423
|
-
project_id: string;
|
|
424
|
-
config_data: ConfigData;
|
|
425
|
-
updated_at?: string;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
/**
|
|
429
|
-
* Default fallback configuration object.
|
|
430
|
-
*/
|
|
431
|
-
export const DEFAULT_CONFIG_DATA: ConfigData = {
|
|
432
|
-
webConfig: {
|
|
433
|
-
baseUrl: "http://localhost:3000",
|
|
434
|
-
maxConcurrentSessions: "1",
|
|
435
|
-
headlessMode: true,
|
|
436
|
-
implicitWait: "5000",
|
|
437
|
-
pageLoadTimeout: "30000",
|
|
438
|
-
scriptTimeout: "30000",
|
|
439
|
-
parallelizationMode: "testcase",
|
|
440
|
-
},
|
|
441
|
-
browsers: [
|
|
442
|
-
{
|
|
443
|
-
id: "chrome-desktop",
|
|
444
|
-
type: "chrome",
|
|
445
|
-
mobileEmulation: false,
|
|
446
|
-
},
|
|
447
|
-
],
|
|
448
|
-
androidConfig: {
|
|
449
|
-
appiumServer: "http://127.0.0.1:4723",
|
|
450
|
-
platformName: "Android",
|
|
451
|
-
platformVersion: "13",
|
|
452
|
-
deviceName: "emulator-5554",
|
|
453
|
-
automationName: "UiAutomator2",
|
|
454
|
-
appPackage: "",
|
|
455
|
-
appActivity: "",
|
|
456
|
-
autoGrantPermissions: true,
|
|
457
|
-
noReset: false,
|
|
458
|
-
implicitWait: "10000",
|
|
459
|
-
parallelizationMode: "suite",
|
|
460
|
-
},
|
|
461
|
-
iosConfig: {
|
|
462
|
-
appiumServer: "http://127.0.0.1:4723",
|
|
463
|
-
platformName: "iOS",
|
|
464
|
-
platformVersion: "16.0",
|
|
465
|
-
deviceName: "iPhone 14",
|
|
466
|
-
automationName: "XCUITest",
|
|
467
|
-
bundleId: "",
|
|
468
|
-
udid: "auto",
|
|
469
|
-
xcodeOrgId: "",
|
|
470
|
-
xcodeSigningId: "iPhone Developer",
|
|
471
|
-
autoAcceptAlerts: true,
|
|
472
|
-
noReset: false,
|
|
473
|
-
implicitWait: "10000",
|
|
474
|
-
parallelizationMode: "suite",
|
|
475
|
-
},
|
|
476
|
-
loadConfig: {
|
|
477
|
-
virtualUsers: "10",
|
|
478
|
-
duration: "1m",
|
|
479
|
-
},
|
|
480
|
-
loadStages: [],
|
|
481
|
-
thresholds: [],
|
|
482
|
-
executionConfig: {
|
|
483
|
-
networkMonitoringEnabled: true,
|
|
484
|
-
fastResponseTime: "200",
|
|
485
|
-
normalResponseTime: "1000",
|
|
486
|
-
monitoredDomains: [],
|
|
487
|
-
environmentVariables: [],
|
|
488
|
-
},
|
|
489
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import { devicesCommand } from "./commands/devices.js";
|
|
3
|
-
import { doctorCommand } from "./commands/doctor.js";
|
|
4
|
-
import { initCommand } from "./commands/init.js";
|
|
5
|
-
import { runCommand } from "./commands/run.js";
|
|
6
|
-
|
|
7
|
-
export * from "./config/schema.js";
|
|
8
|
-
export * from "./config/loader.js";
|
|
9
|
-
export * from "./types/generator.js";
|
|
10
|
-
export * from "./step/index.js";
|
|
11
|
-
export { init as initTsPlugin, default as tsPlugin } from "./plugin.js";
|
|
12
|
-
|
|
13
|
-
export function createCliProgram() {
|
|
14
|
-
const program = new Command();
|
|
15
|
-
|
|
16
|
-
program
|
|
17
|
-
.name("spectra")
|
|
18
|
-
.description("TestSpectra Zero-Config Cross-Platform Test Runner CLI")
|
|
19
|
-
.version("1.0.0");
|
|
20
|
-
|
|
21
|
-
program
|
|
22
|
-
.command("init")
|
|
23
|
-
.description("Initialize testspectra.config.json and project directories")
|
|
24
|
-
.option("-f, --force", "Overwrite existing configuration if present")
|
|
25
|
-
.action(initCommand);
|
|
26
|
-
|
|
27
|
-
program
|
|
28
|
-
.command("doctor")
|
|
29
|
-
.description("Verify local environment prerequisites (ADB, Java, Chrome, Bun, Node)")
|
|
30
|
-
.option("--fix", "Attempt automatic fix / download of missing tools")
|
|
31
|
-
.action(doctorCommand);
|
|
32
|
-
|
|
33
|
-
program
|
|
34
|
-
.command("devices")
|
|
35
|
-
.description("List connected Android/iOS devices and local browsers")
|
|
36
|
-
.option("-t, --target <target>", "Filter scope: android, ios, web, all", "all")
|
|
37
|
-
.action(devicesCommand);
|
|
38
|
-
|
|
39
|
-
program
|
|
40
|
-
.command("run [path]")
|
|
41
|
-
.description("Execute test suite or individual test case")
|
|
42
|
-
.option("-t, --target <target>", "Target platform: web, android, ios, common", "web")
|
|
43
|
-
.option("-d, --device <device>", "Target device name or UDID")
|
|
44
|
-
.option("--headless", "Run in headless mode")
|
|
45
|
-
.option("--no-headless", "Run in headed mode")
|
|
46
|
-
.option("-w, --workdir <dir>", "Custom app data / temp workdir")
|
|
47
|
-
.option("-o, --output <path>", "Custom test report JSON output path")
|
|
48
|
-
.action(runCommand);
|
|
49
|
-
|
|
50
|
-
return program;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export async function runCli(args = process.argv) {
|
|
54
|
-
const program = createCliProgram();
|
|
55
|
-
await program.parseAsync(args);
|
|
56
|
-
}
|
package/src/plugin.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import type ts from "typescript";
|
|
2
|
-
import { TypeGenerator } from "./types/generator.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* TypeScript Language Service Plugin Factory for TestSpectra.
|
|
6
|
-
* Runs silently inside TSServer (VS Code, Cursor, WebStorm, Neovim, etc.).
|
|
7
|
-
*
|
|
8
|
-
* It generates and refreshes `.testspectra/types/` ambient declarations
|
|
9
|
-
* automatically in the background whenever the project is opened or files change.
|
|
10
|
-
*/
|
|
11
|
-
function init(modules: { typescript: typeof ts }) {
|
|
12
|
-
const tsModule = modules.typescript;
|
|
13
|
-
|
|
14
|
-
function create(info: ts.server.PluginCreateInfo) {
|
|
15
|
-
const project = info.project;
|
|
16
|
-
const projectDir = project.getCurrentDirectory();
|
|
17
|
-
|
|
18
|
-
// 1. Initial Generation on project load
|
|
19
|
-
try {
|
|
20
|
-
TypeGenerator.writeDeclarationFiles(projectDir);
|
|
21
|
-
info.project.projectService.logger.info(
|
|
22
|
-
`[TestSpectra TS Plugin] Initialized ambient declarations in ${projectDir}`
|
|
23
|
-
);
|
|
24
|
-
} catch (err: any) {
|
|
25
|
-
info.project.projectService.logger.info(
|
|
26
|
-
`[TestSpectra TS Plugin] Failed initial type generation: ${err?.message}`
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// 2. Watch for entity file changes inside TSServer
|
|
31
|
-
const watchedFolders = ["page-objects", "pageobjects", "actions", "steps", "fixtures", "hooks"];
|
|
32
|
-
|
|
33
|
-
// Debounce type regeneration
|
|
34
|
-
let debounceTimer: NodeJS.Timeout | null = null;
|
|
35
|
-
const triggerRegeneration = (pathChanged: string) => {
|
|
36
|
-
if (debounceTimer) clearTimeout(debounceTimer);
|
|
37
|
-
debounceTimer = setTimeout(() => {
|
|
38
|
-
try {
|
|
39
|
-
TypeGenerator.writeDeclarationFiles(projectDir);
|
|
40
|
-
info.project.projectService.logger.info(
|
|
41
|
-
`[TestSpectra TS Plugin] Regenerated ambient declarations after change in ${pathChanged}`
|
|
42
|
-
);
|
|
43
|
-
} catch (err: any) {
|
|
44
|
-
info.project.projectService.logger.info(
|
|
45
|
-
`[TestSpectra TS Plugin] Error during regeneration: ${err?.message}`
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
}, 200);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
// 3. Proxy language service methods to detect file modifications / completions
|
|
52
|
-
const proxy: ts.LanguageService = Object.create(null);
|
|
53
|
-
for (const k of Object.keys(info.languageService) as Array<keyof ts.LanguageService>) {
|
|
54
|
-
const x = info.languageService[k]!;
|
|
55
|
-
// @ts-ignore
|
|
56
|
-
proxy[k] = (...args: Array<{}>) => x.apply(info.languageService, args);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Intercept getCompletionsAtPosition to ensure fresh types
|
|
60
|
-
const originalGetCompletions = info.languageService.getCompletionsAtPosition;
|
|
61
|
-
proxy.getCompletionsAtPosition = (fileName, position, options, formattingSettings) => {
|
|
62
|
-
const isEntity = watchedFolders.some((f) => fileName.includes(f));
|
|
63
|
-
if (isEntity) {
|
|
64
|
-
triggerRegeneration(fileName);
|
|
65
|
-
}
|
|
66
|
-
return originalGetCompletions.apply(info.languageService, [
|
|
67
|
-
fileName,
|
|
68
|
-
position,
|
|
69
|
-
options,
|
|
70
|
-
formattingSettings,
|
|
71
|
-
]);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
return proxy;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return { create };
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export default init;
|
|
81
|
-
export { init };
|