@testspectra/cli 1.0.27 → 1.0.29
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/add.js +6 -8
- package/dist/commands/init.js +25 -32
- package/dist/types/generator.js +73 -71
- package/package.json +1 -1
- package/templates/default/tsconfig.json +1 -15
- package/templates/{nx/modules/auth/e2e/tsconfig.json → default/tsconfig.spectra.json} +7 -8
- package/templates/nx/modules/auth/e2e/project.json +3 -4
- package/templates/nx/modules/catalog/e2e/project.json +3 -4
- package/templates/nx/package.json +1 -1
- package/templates/nx/shared/testing/page-objects/NavigationBar/common.ts +2 -2
- package/templates/nx/tsconfig.json +1 -3
- package/templates/nx/tsconfig.spectra.android.json +36 -0
- package/templates/nx/tsconfig.spectra.ios.json +36 -0
- package/templates/nx/{modules/catalog/e2e/tsconfig.json → tsconfig.spectra.json} +7 -8
- package/templates/nx/tsconfig.spectra.web.json +42 -0
- package/templates/nx/modules/auth/e2e/.testspectra/types/android.d.ts +0 -82
- package/templates/nx/modules/auth/e2e/.testspectra/types/common.d.ts +0 -80
- package/templates/nx/modules/auth/e2e/.testspectra/types/fixtures.d.ts +0 -10
- package/templates/nx/modules/auth/e2e/.testspectra/types/index.d.ts +0 -1
- package/templates/nx/modules/auth/e2e/.testspectra/types/ios.d.ts +0 -82
- package/templates/nx/modules/auth/e2e/.testspectra/types/mobile.d.ts +0 -82
- package/templates/nx/modules/auth/e2e/.testspectra/types/web.d.ts +0 -82
- package/templates/nx/modules/auth/e2e/tsconfig.android.json +0 -39
- package/templates/nx/modules/auth/e2e/tsconfig.android.tsbuildinfo +0 -1
- package/templates/nx/modules/auth/e2e/tsconfig.ios.json +0 -39
- package/templates/nx/modules/auth/e2e/tsconfig.ios.tsbuildinfo +0 -1
- package/templates/nx/modules/auth/e2e/tsconfig.web.json +0 -45
- package/templates/nx/modules/auth/e2e/tsconfig.web.tsbuildinfo +0 -1
- package/templates/nx/modules/catalog/e2e/.testspectra/types/android.d.ts +0 -82
- package/templates/nx/modules/catalog/e2e/.testspectra/types/common.d.ts +0 -80
- package/templates/nx/modules/catalog/e2e/.testspectra/types/fixtures.d.ts +0 -10
- package/templates/nx/modules/catalog/e2e/.testspectra/types/index.d.ts +0 -1
- package/templates/nx/modules/catalog/e2e/.testspectra/types/ios.d.ts +0 -82
- package/templates/nx/modules/catalog/e2e/.testspectra/types/mobile.d.ts +0 -82
- package/templates/nx/modules/catalog/e2e/.testspectra/types/web.d.ts +0 -82
- package/templates/nx/modules/catalog/e2e/tsconfig.android.json +0 -39
- package/templates/nx/modules/catalog/e2e/tsconfig.android.tsbuildinfo +0 -1
- package/templates/nx/modules/catalog/e2e/tsconfig.ios.json +0 -39
- package/templates/nx/modules/catalog/e2e/tsconfig.ios.tsbuildinfo +0 -1
- package/templates/nx/modules/catalog/e2e/tsconfig.web.json +0 -45
- package/templates/nx/modules/catalog/e2e/tsconfig.web.tsbuildinfo +0 -1
- package/templates/nx/shared/testing/tsconfig.json +0 -18
- package/templates/nx/shared/testing/tsconfig.tsbuildinfo +0 -1
- /package/templates/default/{tsconfig.android.json → tsconfig.spectra.android.json} +0 -0
- /package/templates/default/{tsconfig.ios.json → tsconfig.spectra.ios.json} +0 -0
- /package/templates/default/{tsconfig.web.json → tsconfig.spectra.web.json} +0 -0
package/dist/commands/add.js
CHANGED
|
@@ -311,24 +311,22 @@ export async function addCommand(moduleNameArg, options = {}) {
|
|
|
311
311
|
const localConfig = path.join(targetE2eDir, "spectra.config.ts");
|
|
312
312
|
if (fs.existsSync(localConfig))
|
|
313
313
|
fs.unlinkSync(localConfig);
|
|
314
|
-
//
|
|
314
|
+
// Ensure Root Solution tsconfig.json references tsconfig.spectra.json
|
|
315
315
|
const rootTsConfigPath = path.join(rootDir, "tsconfig.json");
|
|
316
316
|
if (fs.existsSync(rootTsConfigPath)) {
|
|
317
317
|
try {
|
|
318
318
|
const rootTsConfig = JSON.parse(fs.readFileSync(rootTsConfigPath, "utf-8"));
|
|
319
319
|
if (!rootTsConfig.references)
|
|
320
320
|
rootTsConfig.references = [];
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
rootTsConfig.references.push({ path: relRef });
|
|
321
|
+
if (!rootTsConfig.references.some((r) => r.path === "./tsconfig.spectra.json")) {
|
|
322
|
+
rootTsConfig.references.push({ path: "./tsconfig.spectra.json" });
|
|
324
323
|
fs.writeFileSync(rootTsConfigPath, JSON.stringify(rootTsConfig, null, 2), "utf-8");
|
|
325
324
|
}
|
|
326
325
|
}
|
|
327
326
|
catch { }
|
|
328
327
|
}
|
|
329
|
-
// Generate Ambient Types for root
|
|
328
|
+
// Generate Ambient Types for root workspace
|
|
330
329
|
TypeGenerator.writeDeclarationFiles(rootDir);
|
|
331
|
-
TypeGenerator.writeDeclarationFiles(targetE2eDir);
|
|
332
330
|
s.stop(`Module ${e2eProjectName} added successfully!`);
|
|
333
331
|
p.log.success(chalk.green(`Directory: ./${path.relative(rootDir, targetE2eDir)}`));
|
|
334
332
|
p.log.success(chalk.green(`Nx Target: ${e2eProjectName}:e2e`));
|
|
@@ -362,8 +360,8 @@ export async function addCommand(moduleNameArg, options = {}) {
|
|
|
362
360
|
// Create starter page object
|
|
363
361
|
const poContent = `class ${targetModule}Page {\n get mainTitle() {\n return $("h1");\n }\n\n async open() {\n await Spectra.navigate("/${targetModule.toLowerCase()}");\n }\n}\n\nexport default new ${targetModule}Page();\n`;
|
|
364
362
|
fs.writeFileSync(path.join(poDir, "common.ts"), poContent, "utf-8");
|
|
365
|
-
// Create starter test spec
|
|
366
|
-
const specContent = `
|
|
363
|
+
// Create starter test spec (Zero-import, flat it() block)
|
|
364
|
+
const specContent = `it("should verify ${targetModule} page components", async () => {\n await ${targetModule}Page.open();\n await ${targetModule}Page.mainTitle.shouldBeVisible();\n});\n`;
|
|
367
365
|
fs.writeFileSync(path.join(specDir, "web.test.ts"), specContent, "utf-8");
|
|
368
366
|
TypeGenerator.writeDeclarationFiles(cwd);
|
|
369
367
|
p.log.success(chalk.green(`Created Page Object: ./page-objects/${targetModule}Page/common.ts`));
|
package/dist/commands/init.js
CHANGED
|
@@ -385,36 +385,28 @@ export async function initCommand(options = {}) {
|
|
|
385
385
|
// 5. Ensure pnpm-workspace.yaml includes shared library (feature modules are already part of existing workspace globs)
|
|
386
386
|
const pnpmWorkspaceFilePath = path.join(cwd, "pnpm-workspace.yaml");
|
|
387
387
|
ensurePnpmWorkspaceIncludes(pnpmWorkspaceFilePath, sharedTestingRelPath);
|
|
388
|
-
// 6. Update Root Solution tsconfig.json
|
|
388
|
+
// 6. Update Root Solution tsconfig.json to reference tsconfig.spectra.json
|
|
389
389
|
const rootTsConfigPath = path.join(cwd, "tsconfig.json");
|
|
390
|
-
const references = [];
|
|
391
|
-
for (const e2eDir of featureE2eDirs) {
|
|
392
|
-
references.push({ path: `./${path.relative(cwd, e2eDir).replace(/\\/g, "/")}` });
|
|
393
|
-
}
|
|
394
|
-
references.push({ path: `./${sharedTestingRelPath.replace(/\\/g, "/")}` });
|
|
395
390
|
let rootTsConfig = { files: [], references: [] };
|
|
396
391
|
if (fs.existsSync(rootTsConfigPath)) {
|
|
397
392
|
try {
|
|
398
393
|
rootTsConfig = JSON.parse(fs.readFileSync(rootTsConfigPath, "utf-8"));
|
|
399
394
|
if (!rootTsConfig.references)
|
|
400
395
|
rootTsConfig.references = [];
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
rootTsConfig.references.push(ref);
|
|
404
|
-
}
|
|
396
|
+
if (!rootTsConfig.references.some((r) => r.path === "./tsconfig.spectra.json")) {
|
|
397
|
+
rootTsConfig.references.push({ path: "./tsconfig.spectra.json" });
|
|
405
398
|
}
|
|
406
399
|
}
|
|
407
|
-
catch {
|
|
400
|
+
catch {
|
|
401
|
+
rootTsConfig = { files: [], references: [{ path: "./tsconfig.spectra.json" }] };
|
|
402
|
+
}
|
|
408
403
|
}
|
|
409
404
|
else {
|
|
410
|
-
rootTsConfig = { files: [], references };
|
|
405
|
+
rootTsConfig = { files: [], references: [{ path: "./tsconfig.spectra.json" }] };
|
|
411
406
|
}
|
|
412
407
|
fs.writeFileSync(rootTsConfigPath, JSON.stringify(rootTsConfig, null, 2), "utf-8");
|
|
413
|
-
// 7. Generate Ambient Types
|
|
408
|
+
// 7. Generate Ambient Types in ROOT only
|
|
414
409
|
TypeGenerator.writeDeclarationFiles(cwd);
|
|
415
|
-
for (const e2eDir of featureE2eDirs) {
|
|
416
|
-
TypeGenerator.writeDeclarationFiles(e2eDir);
|
|
417
|
-
}
|
|
418
410
|
const sharedPoLine = `${sharedTestingRelPath}/page-objects`.padEnd(28, " ");
|
|
419
411
|
const sharedStepsLine = `${sharedTestingRelPath}/steps`.padEnd(28, " ");
|
|
420
412
|
const sharedActLine = `${sharedTestingRelPath}/actions`.padEnd(28, " ");
|
|
@@ -430,6 +422,10 @@ This workspace uses TestSpectra's **"Centralized Configuration, Distributed Impl
|
|
|
430
422
|
### Centralized Root Elements
|
|
431
423
|
- \`./spectra.config.ts\`: Single source of truth for runtime configurations (Base URL, Appium devices, browser targets, timeouts).
|
|
432
424
|
- \`./.testspectra/\`: Centralized app data folder containing driver caches (ChromeDriver, GeckoDriver, Appium), execution logs, and universal ambient types (\`.testspectra/types/\`).
|
|
425
|
+
- \`./tsconfig.spectra.json\`: Solution TypeScript entry point equipped with TestSpectra language service plugin.
|
|
426
|
+
- \`./tsconfig.spectra.web.json\`: Strongly-typed composite configuration for Web platform tests.
|
|
427
|
+
- \`./tsconfig.spectra.android.json\`: Strongly-typed composite configuration for Android platform tests.
|
|
428
|
+
- \`./tsconfig.spectra.ios.json\`: Strongly-typed composite configuration for iOS platform tests.
|
|
433
429
|
- \`./nx.json\`: Nx target defaults with execution caching and inputs.
|
|
434
430
|
- \`./pnpm-workspace.yaml\`: Monorepo package glob definitions.
|
|
435
431
|
- \`./tsconfig.json\`: Solution-style TypeScript orchestrator linking all distributed E2E projects and shared libraries.
|
|
@@ -449,8 +445,7 @@ ${featureE2eDirs.map((d) => {
|
|
|
449
445
|
return `- \`./${rel}\` (**${name}**, Nx Project: \`${e2eName}\`):
|
|
450
446
|
- \`specs/\`: Feature test cases (\`specs/<SuiteName>/<CaseId>/\` with \`web.test.ts\`, \`android.test.ts\`, \`ios.test.ts\`).
|
|
451
447
|
- \`page-objects/\`: Feature-specific Page Objects (e.g. \`LoginPage\`, \`ProductPage\`).
|
|
452
|
-
- \`project.json\`: Nx targets (\`e2e\`, \`type-check\`) supporting configurations (\`--configuration=android\`, \`--configuration=ios\`, \`--configuration=headless\`)
|
|
453
|
-
- \`tsconfig.json\`: Solution TypeScript config reference.`;
|
|
448
|
+
- \`project.json\`: Nx targets (\`e2e\`, \`type-check\`) supporting configurations (\`--configuration=android\`, \`--configuration=ios\`, \`--configuration=headless\`).`;
|
|
454
449
|
}).join("\n")}
|
|
455
450
|
|
|
456
451
|
---
|
|
@@ -471,24 +466,22 @@ TestSpectra completely eliminates boilerplate \`import\` statements across all t
|
|
|
471
466
|
|
|
472
467
|
### Code Example:
|
|
473
468
|
\`\`\`typescript
|
|
474
|
-
//
|
|
475
|
-
// 🌟 NOTICE: 100% Zero-Import
|
|
469
|
+
// packages/features/auth/e2e/specs/Auth/TC-AUTH-01/web.test.ts
|
|
470
|
+
// 🌟 NOTICE: 100% Zero-Import & Flat Execution! (No import statement, no describe wrapper)
|
|
476
471
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
await NavigationBar.goToLogin();
|
|
472
|
+
it("should navigate via shared header and login with local POM", async () => {
|
|
473
|
+
// 1. Consumed from Shared Testing Library (${sharedTestingRelPath}/page-objects/NavigationBar)
|
|
474
|
+
await NavigationBar.goToLogin();
|
|
481
475
|
|
|
482
|
-
|
|
483
|
-
|
|
476
|
+
// 2. Consumed from Shared Testing Library (${sharedTestingRelPath}/steps/loginAsAdmin)
|
|
477
|
+
await Step.loginAsAdmin();
|
|
484
478
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
479
|
+
// 3. Consumed from Local Feature POM (page-objects/LoginPage)
|
|
480
|
+
await LoginPage.flashAlert.shouldBeVisible();
|
|
481
|
+
await LoginPage.flashAlert.shouldContainText("Welcome");
|
|
488
482
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
});
|
|
483
|
+
// 4. Consumed from Shared Testing Library Custom Action (${sharedTestingRelPath}/actions/dismissBanner)
|
|
484
|
+
await Spectra.dismissBanner();
|
|
492
485
|
});
|
|
493
486
|
\`\`\`
|
|
494
487
|
|
package/dist/types/generator.js
CHANGED
|
@@ -10,91 +10,72 @@ const PLATFORM_HIERARCHY = {
|
|
|
10
10
|
export class TypeGenerator {
|
|
11
11
|
static getPageObjectsDirs(cwd) {
|
|
12
12
|
const dirs = [];
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
path.join(cur, "shared/testing/page-objects"),
|
|
24
|
-
path.join(cur, "shared/page-objects"),
|
|
25
|
-
path.join(cur, "packages/core/testing/page-objects"),
|
|
26
|
-
path.join(cur, "packages/shared/testing/page-objects"),
|
|
27
|
-
path.join(cur, "packages/testing/page-objects"),
|
|
28
|
-
path.join(cur, "core/testing/page-objects"),
|
|
29
|
-
];
|
|
30
|
-
for (const cand of candidates) {
|
|
31
|
-
if (fs.existsSync(cand) && !dirs.includes(cand))
|
|
32
|
-
dirs.push(cand);
|
|
13
|
+
function scanDir(dir, maxDepth) {
|
|
14
|
+
if (maxDepth <= 0 || !fs.existsSync(dir))
|
|
15
|
+
return;
|
|
16
|
+
const base = path.basename(dir);
|
|
17
|
+
if (base === "node_modules" || base === "dist" || base === ".git" || base === ".testspectra")
|
|
18
|
+
return;
|
|
19
|
+
if (base === "page-objects" || base === "pageobjects") {
|
|
20
|
+
if (!dirs.includes(dir))
|
|
21
|
+
dirs.push(dir);
|
|
22
|
+
return;
|
|
33
23
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (Array.isArray(parsed.references)) {
|
|
40
|
-
for (const ref of parsed.references) {
|
|
41
|
-
if (ref.path) {
|
|
42
|
-
const poPath1 = path.resolve(cur, ref.path, "page-objects");
|
|
43
|
-
const poPath2 = path.resolve(cur, ref.path, "pageobjects");
|
|
44
|
-
if (fs.existsSync(poPath1) && !dirs.includes(poPath1))
|
|
45
|
-
dirs.push(poPath1);
|
|
46
|
-
if (fs.existsSync(poPath2) && !dirs.includes(poPath2))
|
|
47
|
-
dirs.push(poPath2);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
24
|
+
try {
|
|
25
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
26
|
+
for (const entry of entries) {
|
|
27
|
+
if (entry.isDirectory()) {
|
|
28
|
+
scanDir(path.join(dir, entry.name), maxDepth - 1);
|
|
50
29
|
}
|
|
51
30
|
}
|
|
52
|
-
catch { }
|
|
53
31
|
}
|
|
54
|
-
|
|
32
|
+
catch { }
|
|
33
|
+
}
|
|
34
|
+
// 1. Scan from cwd downwards (finds all feature page-objects and shared page-objects)
|
|
35
|
+
scanDir(cwd, 6);
|
|
36
|
+
// 2. Also look upwards to monorepo root if called from a subfolder
|
|
37
|
+
let cur = cwd;
|
|
38
|
+
while (cur !== path.dirname(cur)) {
|
|
39
|
+
if (fs.existsSync(path.join(cur, "pnpm-workspace.yaml")) || fs.existsSync(path.join(cur, "nx.json")) || fs.existsSync(path.join(cur, "spectra.config.ts"))) {
|
|
40
|
+
scanDir(cur, 6);
|
|
55
41
|
break;
|
|
42
|
+
}
|
|
56
43
|
cur = path.dirname(cur);
|
|
57
44
|
}
|
|
58
45
|
return dirs;
|
|
59
46
|
}
|
|
60
47
|
static getEntityDirs(cwd, entityType) {
|
|
61
48
|
const dirs = [];
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
path.join(cur, "packages/testing", entityType),
|
|
73
|
-
path.join(cur, "core/testing", entityType),
|
|
74
|
-
];
|
|
75
|
-
for (const cand of candidates) {
|
|
76
|
-
if (fs.existsSync(cand) && !dirs.includes(cand))
|
|
77
|
-
dirs.push(cand);
|
|
49
|
+
function scanDir(dir, maxDepth) {
|
|
50
|
+
if (maxDepth <= 0 || !fs.existsSync(dir))
|
|
51
|
+
return;
|
|
52
|
+
const base = path.basename(dir);
|
|
53
|
+
if (base === "node_modules" || base === "dist" || base === ".git" || base === ".testspectra")
|
|
54
|
+
return;
|
|
55
|
+
if (base === entityType) {
|
|
56
|
+
if (!dirs.includes(dir))
|
|
57
|
+
dirs.push(dir);
|
|
58
|
+
return;
|
|
78
59
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (Array.isArray(parsed.references)) {
|
|
85
|
-
for (const ref of parsed.references) {
|
|
86
|
-
if (ref.path) {
|
|
87
|
-
const entPath = path.resolve(cur, ref.path, entityType);
|
|
88
|
-
if (fs.existsSync(entPath) && !dirs.includes(entPath))
|
|
89
|
-
dirs.push(entPath);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
60
|
+
try {
|
|
61
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
62
|
+
for (const entry of entries) {
|
|
63
|
+
if (entry.isDirectory()) {
|
|
64
|
+
scanDir(path.join(dir, entry.name), maxDepth - 1);
|
|
92
65
|
}
|
|
93
66
|
}
|
|
94
|
-
catch { }
|
|
95
67
|
}
|
|
96
|
-
|
|
68
|
+
catch { }
|
|
69
|
+
}
|
|
70
|
+
// 1. Scan from cwd downwards
|
|
71
|
+
scanDir(cwd, 6);
|
|
72
|
+
// 2. Look upwards to monorepo root if called from a subfolder
|
|
73
|
+
let cur = cwd;
|
|
74
|
+
while (cur !== path.dirname(cur)) {
|
|
75
|
+
if (fs.existsSync(path.join(cur, "pnpm-workspace.yaml")) || fs.existsSync(path.join(cur, "nx.json")) || fs.existsSync(path.join(cur, "spectra.config.ts"))) {
|
|
76
|
+
scanDir(cur, 6);
|
|
97
77
|
break;
|
|
78
|
+
}
|
|
98
79
|
cur = path.dirname(cur);
|
|
99
80
|
}
|
|
100
81
|
return dirs;
|
|
@@ -207,8 +188,28 @@ export class TypeGenerator {
|
|
|
207
188
|
}
|
|
208
189
|
}
|
|
209
190
|
}
|
|
210
|
-
// 2.
|
|
211
|
-
content += `\ninterface
|
|
191
|
+
// 2. Built-in Spectra Static Methods & Custom Actions
|
|
192
|
+
content += `\ninterface SpectraStaticInstance {\n`;
|
|
193
|
+
content += ` get(target: any): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
194
|
+
content += ` getAll(selector: string): import('@testspectra/matchers').MultiElementRunner;\n`;
|
|
195
|
+
content += ` navigate(url: string): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
196
|
+
content += ` back(): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
197
|
+
content += ` refresh(): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
198
|
+
content += ` click(target: any, textOrOptions?: string | import('@testspectra/matchers').ClickOptions): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
199
|
+
content += ` doubleClick(target: any, textOrOptions?: string | import('@testspectra/matchers').ClickOptions): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
200
|
+
content += ` longPress(target: any, options?: import('@testspectra/matchers').LongPressOptions | number): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
201
|
+
content += ` type(target: any, value: string, options?: import('@testspectra/matchers').TypeOptions): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
202
|
+
content += ` clear(target: any): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
203
|
+
content += ` select(target: any, value: string): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
204
|
+
content += ` hover(target: any): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
205
|
+
content += ` pressKey(key: import('@testspectra/matchers').KeyOption | string): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
206
|
+
content += ` dragDrop(sourceTarget: any, destTarget: any): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
207
|
+
content += ` scroll(options?: import('@testspectra/matchers').ScrollOptions): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
208
|
+
content += ` swipe(options: import('@testspectra/matchers').SwipeOptions): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
209
|
+
content += ` wait(durationMs: number): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
210
|
+
content += ` waitForElement(target: any, timeoutMs?: number): import('@testspectra/matchers').SingleElementRunner;\n`;
|
|
211
|
+
content += `}\n\n`;
|
|
212
|
+
content += `interface TestSpectraCustomActions {\n`;
|
|
212
213
|
const declaredActions = new Set();
|
|
213
214
|
for (const actionsDir of actionsDirs) {
|
|
214
215
|
if (!fs.existsSync(actionsDir))
|
|
@@ -259,6 +260,7 @@ export class TypeGenerator {
|
|
|
259
260
|
}
|
|
260
261
|
}
|
|
261
262
|
content += `}\n`;
|
|
263
|
+
content += `type TestSpectraActions = SpectraStaticInstance & TestSpectraCustomActions;\n`;
|
|
262
264
|
content += `declare const Spectra: TestSpectraActions;\n\n`;
|
|
263
265
|
// 3. Shared Steps Global Interface (Local + Shared)
|
|
264
266
|
content += `interface TestSpectraSteps {\n`;
|
package/package.json
CHANGED
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "NodeNext",
|
|
6
|
-
"types": ["node", "@wdio/globals/types", "@wdio/mocha-framework"],
|
|
7
|
-
"plugins": [
|
|
8
|
-
{ "name": "@testspectra/cli" }
|
|
9
|
-
],
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"strict": true,
|
|
12
|
-
"noEmit": true
|
|
13
|
-
},
|
|
14
2
|
"files": [],
|
|
15
3
|
"references": [
|
|
16
|
-
{ "path": "./tsconfig.
|
|
17
|
-
{ "path": "./tsconfig.android.json" },
|
|
18
|
-
{ "path": "./tsconfig.ios.json" }
|
|
4
|
+
{ "path": "./tsconfig.spectra.json" }
|
|
19
5
|
]
|
|
20
6
|
}
|
|
@@ -3,18 +3,17 @@
|
|
|
3
3
|
"target": "ES2022",
|
|
4
4
|
"module": "NodeNext",
|
|
5
5
|
"moduleResolution": "NodeNext",
|
|
6
|
-
"types": ["node", "@wdio/globals/types", "@wdio/mocha-framework"],
|
|
7
|
-
"plugins": [
|
|
8
|
-
{ "name": "@testspectra/cli" }
|
|
9
|
-
],
|
|
10
6
|
"skipLibCheck": true,
|
|
11
7
|
"strict": true,
|
|
12
|
-
"noEmit": true
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"plugins": [
|
|
10
|
+
{ "name": "@testspectra/cli" }
|
|
11
|
+
]
|
|
13
12
|
},
|
|
14
13
|
"files": [],
|
|
15
14
|
"references": [
|
|
16
|
-
{ "path": "./tsconfig.web.json" },
|
|
17
|
-
{ "path": "./tsconfig.android.json" },
|
|
18
|
-
{ "path": "./tsconfig.ios.json" }
|
|
15
|
+
{ "path": "./tsconfig.spectra.web.json" },
|
|
16
|
+
{ "path": "./tsconfig.spectra.android.json" },
|
|
17
|
+
{ "path": "./tsconfig.spectra.ios.json" }
|
|
19
18
|
]
|
|
20
19
|
}
|
|
@@ -25,11 +25,10 @@
|
|
|
25
25
|
"type-check": {
|
|
26
26
|
"executor": "nx:run-commands",
|
|
27
27
|
"options": {
|
|
28
|
-
"command": "tsc -b",
|
|
29
|
-
"cwd": "
|
|
28
|
+
"command": "tsc -b tsconfig.spectra.json",
|
|
29
|
+
"cwd": "."
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
"tags": ["scope:auth", "type:e2e"]
|
|
34
|
-
"implicitDependencies": ["@testspectra/feature-auth"]
|
|
33
|
+
"tags": ["scope:auth", "type:e2e"]
|
|
35
34
|
}
|
|
@@ -25,11 +25,10 @@
|
|
|
25
25
|
"type-check": {
|
|
26
26
|
"executor": "nx:run-commands",
|
|
27
27
|
"options": {
|
|
28
|
-
"command": "tsc -b",
|
|
29
|
-
"cwd": "
|
|
28
|
+
"command": "tsc -b tsconfig.spectra.json",
|
|
29
|
+
"cwd": "."
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
"tags": ["scope:catalog", "type:e2e"]
|
|
34
|
-
"implicitDependencies": ["@testspectra/feature-catalog"]
|
|
33
|
+
"tags": ["scope:catalog", "type:e2e"]
|
|
35
34
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export default class NavigationBar {
|
|
2
|
-
static get logo() {
|
|
2
|
+
static get logo(): ChainablePromiseElement {
|
|
3
3
|
return $('header .logo');
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
static get profileMenu() {
|
|
6
|
+
static get profileMenu(): ChainablePromiseElement {
|
|
7
7
|
return $('header .user-profile');
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"composite": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"types": ["node", "@wdio/globals/types", "@wdio/mocha-framework"]
|
|
11
|
+
},
|
|
12
|
+
"include": [
|
|
13
|
+
".testspectra/types/android.d.ts",
|
|
14
|
+
".testspectra/types/fixtures.d.ts",
|
|
15
|
+
"spectra.config.ts",
|
|
16
|
+
"modules/**/e2e/**/*.ts",
|
|
17
|
+
"packages/**/e2e/**/*.ts",
|
|
18
|
+
"shared/testing/**/*.ts"
|
|
19
|
+
],
|
|
20
|
+
"exclude": [
|
|
21
|
+
"node_modules",
|
|
22
|
+
"dist",
|
|
23
|
+
"**/page-objects/**/web.ts",
|
|
24
|
+
"**/page-objects/**/ios.ts",
|
|
25
|
+
"**/steps/**/web.step.ts",
|
|
26
|
+
"**/steps/**/ios.step.ts",
|
|
27
|
+
"**/actions/**/web.action.ts",
|
|
28
|
+
"**/actions/**/ios.action.ts",
|
|
29
|
+
"**/global-hooks/**/web.hook.ts",
|
|
30
|
+
"**/global-hooks/**/ios.hook.ts",
|
|
31
|
+
"**/specs/**/hooks/**/web.hook.ts",
|
|
32
|
+
"**/specs/**/hooks/**/ios.hook.ts",
|
|
33
|
+
"**/specs/**/web.test.ts",
|
|
34
|
+
"**/specs/**/ios.test.ts"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"composite": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"types": ["node", "@wdio/globals/types", "@wdio/mocha-framework"]
|
|
11
|
+
},
|
|
12
|
+
"include": [
|
|
13
|
+
".testspectra/types/ios.d.ts",
|
|
14
|
+
".testspectra/types/fixtures.d.ts",
|
|
15
|
+
"spectra.config.ts",
|
|
16
|
+
"modules/**/e2e/**/*.ts",
|
|
17
|
+
"packages/**/e2e/**/*.ts",
|
|
18
|
+
"shared/testing/**/*.ts"
|
|
19
|
+
],
|
|
20
|
+
"exclude": [
|
|
21
|
+
"node_modules",
|
|
22
|
+
"dist",
|
|
23
|
+
"**/page-objects/**/web.ts",
|
|
24
|
+
"**/page-objects/**/android.ts",
|
|
25
|
+
"**/steps/**/web.step.ts",
|
|
26
|
+
"**/steps/**/android.step.ts",
|
|
27
|
+
"**/actions/**/web.action.ts",
|
|
28
|
+
"**/actions/**/android.action.ts",
|
|
29
|
+
"**/global-hooks/**/web.hook.ts",
|
|
30
|
+
"**/global-hooks/**/android.hook.ts",
|
|
31
|
+
"**/specs/**/hooks/**/web.hook.ts",
|
|
32
|
+
"**/specs/**/hooks/**/android.hook.ts",
|
|
33
|
+
"**/specs/**/web.test.ts",
|
|
34
|
+
"**/specs/**/android.test.ts"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -3,18 +3,17 @@
|
|
|
3
3
|
"target": "ES2022",
|
|
4
4
|
"module": "NodeNext",
|
|
5
5
|
"moduleResolution": "NodeNext",
|
|
6
|
-
"types": ["node", "@wdio/globals/types", "@wdio/mocha-framework"],
|
|
7
|
-
"plugins": [
|
|
8
|
-
{ "name": "@testspectra/cli" }
|
|
9
|
-
],
|
|
10
6
|
"skipLibCheck": true,
|
|
11
7
|
"strict": true,
|
|
12
|
-
"noEmit": true
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"plugins": [
|
|
10
|
+
{ "name": "@testspectra/cli" }
|
|
11
|
+
]
|
|
13
12
|
},
|
|
14
13
|
"files": [],
|
|
15
14
|
"references": [
|
|
16
|
-
{ "path": "./tsconfig.web.json" },
|
|
17
|
-
{ "path": "./tsconfig.android.json" },
|
|
18
|
-
{ "path": "./tsconfig.ios.json" }
|
|
15
|
+
{ "path": "./tsconfig.spectra.web.json" },
|
|
16
|
+
{ "path": "./tsconfig.spectra.android.json" },
|
|
17
|
+
{ "path": "./tsconfig.spectra.ios.json" }
|
|
19
18
|
]
|
|
20
19
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"composite": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"types": ["node", "@wdio/globals/types", "@wdio/mocha-framework"]
|
|
11
|
+
},
|
|
12
|
+
"include": [
|
|
13
|
+
".testspectra/types/web.d.ts",
|
|
14
|
+
".testspectra/types/fixtures.d.ts",
|
|
15
|
+
"spectra.config.ts",
|
|
16
|
+
"modules/**/e2e/**/*.ts",
|
|
17
|
+
"packages/**/e2e/**/*.ts",
|
|
18
|
+
"shared/testing/**/*.ts"
|
|
19
|
+
],
|
|
20
|
+
"exclude": [
|
|
21
|
+
"node_modules",
|
|
22
|
+
"dist",
|
|
23
|
+
"**/page-objects/**/android.ts",
|
|
24
|
+
"**/page-objects/**/ios.ts",
|
|
25
|
+
"**/page-objects/**/mobile.ts",
|
|
26
|
+
"**/steps/**/android.step.ts",
|
|
27
|
+
"**/steps/**/ios.step.ts",
|
|
28
|
+
"**/steps/**/mobile.step.ts",
|
|
29
|
+
"**/actions/**/android.action.ts",
|
|
30
|
+
"**/actions/**/ios.action.ts",
|
|
31
|
+
"**/actions/**/mobile.action.ts",
|
|
32
|
+
"**/global-hooks/**/android.hook.ts",
|
|
33
|
+
"**/global-hooks/**/ios.hook.ts",
|
|
34
|
+
"**/global-hooks/**/mobile.hook.ts",
|
|
35
|
+
"**/specs/**/hooks/**/android.hook.ts",
|
|
36
|
+
"**/specs/**/hooks/**/ios.hook.ts",
|
|
37
|
+
"**/specs/**/hooks/**/mobile.hook.ts",
|
|
38
|
+
"**/specs/**/android.test.ts",
|
|
39
|
+
"**/specs/**/ios.test.ts",
|
|
40
|
+
"**/specs/**/mobile.test.ts"
|
|
41
|
+
]
|
|
42
|
+
}
|