@testspectra/cli 1.0.27 → 1.0.28
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 +2 -2
- package/dist/commands/init.js +12 -14
- package/package.json +1 -1
package/dist/commands/add.js
CHANGED
|
@@ -362,8 +362,8 @@ export async function addCommand(moduleNameArg, options = {}) {
|
|
|
362
362
|
// Create starter page object
|
|
363
363
|
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
364
|
fs.writeFileSync(path.join(poDir, "common.ts"), poContent, "utf-8");
|
|
365
|
-
// Create starter test spec
|
|
366
|
-
const specContent = `
|
|
365
|
+
// Create starter test spec (Zero-import, flat it() block)
|
|
366
|
+
const specContent = `it("should verify ${targetModule} page components", async () => {\n await ${targetModule}Page.open();\n await ${targetModule}Page.mainTitle.shouldBeVisible();\n});\n`;
|
|
367
367
|
fs.writeFileSync(path.join(specDir, "web.test.ts"), specContent, "utf-8");
|
|
368
368
|
TypeGenerator.writeDeclarationFiles(cwd);
|
|
369
369
|
p.log.success(chalk.green(`Created Page Object: ./page-objects/${targetModule}Page/common.ts`));
|
package/dist/commands/init.js
CHANGED
|
@@ -471,24 +471,22 @@ TestSpectra completely eliminates boilerplate \`import\` statements across all t
|
|
|
471
471
|
|
|
472
472
|
### Code Example:
|
|
473
473
|
\`\`\`typescript
|
|
474
|
-
//
|
|
475
|
-
// 🌟 NOTICE: 100% Zero-Import
|
|
474
|
+
// packages/features/auth/e2e/specs/Auth/TC-AUTH-01/web.test.ts
|
|
475
|
+
// 🌟 NOTICE: 100% Zero-Import & Flat Execution! (No import statement, no describe wrapper)
|
|
476
476
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
await NavigationBar.goToLogin();
|
|
477
|
+
it("should navigate via shared header and login with local POM", async () => {
|
|
478
|
+
// 1. Consumed from Shared Testing Library (${sharedTestingRelPath}/page-objects/NavigationBar)
|
|
479
|
+
await NavigationBar.goToLogin();
|
|
481
480
|
|
|
482
|
-
|
|
483
|
-
|
|
481
|
+
// 2. Consumed from Shared Testing Library (${sharedTestingRelPath}/steps/loginAsAdmin)
|
|
482
|
+
await Step.loginAsAdmin();
|
|
484
483
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
484
|
+
// 3. Consumed from Local Feature POM (page-objects/LoginPage)
|
|
485
|
+
await LoginPage.flashAlert.shouldBeVisible();
|
|
486
|
+
await LoginPage.flashAlert.shouldContainText("Welcome");
|
|
488
487
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
});
|
|
488
|
+
// 4. Consumed from Shared Testing Library Custom Action (${sharedTestingRelPath}/actions/dismissBanner)
|
|
489
|
+
await Spectra.dismissBanner();
|
|
492
490
|
});
|
|
493
491
|
\`\`\`
|
|
494
492
|
|