@toolstackhq/create-qa-patterns 1.0.12 → 1.0.14

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 (58) hide show
  1. package/README.md +32 -0
  2. package/index.js +502 -41
  3. package/package.json +1 -1
  4. package/templates/cypress-template/README.md +32 -0
  5. package/templates/cypress-template/allurerc.mjs +10 -0
  6. package/templates/cypress-template/config/README.md +5 -0
  7. package/templates/cypress-template/config/environments.ts +1 -0
  8. package/templates/cypress-template/config/runtime-config.ts +1 -0
  9. package/templates/cypress-template/config/secret-manager.ts +1 -0
  10. package/templates/cypress-template/cypress/e2e/README.md +6 -0
  11. package/templates/cypress-template/cypress/e2e/ui-journey.cy.ts +1 -0
  12. package/templates/cypress-template/cypress/support/README.md +5 -0
  13. package/templates/cypress-template/cypress/support/app-config.ts +1 -0
  14. package/templates/cypress-template/cypress/support/commands.ts +1 -0
  15. package/templates/cypress-template/cypress/support/data/README.md +5 -0
  16. package/templates/cypress-template/cypress/support/data/data-factory.ts +1 -0
  17. package/templates/cypress-template/cypress/support/data/id-generator.ts +1 -0
  18. package/templates/cypress-template/cypress/support/data/seeded-faker.ts +1 -0
  19. package/templates/cypress-template/cypress/support/e2e.ts +1 -0
  20. package/templates/cypress-template/cypress/support/pages/README.md +5 -0
  21. package/templates/cypress-template/cypress/support/pages/login-page.ts +1 -0
  22. package/templates/cypress-template/cypress/support/pages/people-page.ts +1 -0
  23. package/templates/cypress-template/cypress.config.ts +17 -1
  24. package/templates/cypress-template/eslint.config.mjs +1 -1
  25. package/templates/cypress-template/package-lock.json +2857 -109
  26. package/templates/cypress-template/package.json +4 -0
  27. package/templates/cypress-template/scripts/README.md +5 -0
  28. package/templates/cypress-template/scripts/generate-allure-report.mjs +66 -0
  29. package/templates/cypress-template/scripts/run-cypress.mjs +1 -0
  30. package/templates/cypress-template/tsconfig.json +1 -1
  31. package/templates/playwright-template/README.md +20 -0
  32. package/templates/playwright-template/components/README.md +5 -0
  33. package/templates/playwright-template/config/README.md +5 -0
  34. package/templates/playwright-template/config/environments.ts +1 -0
  35. package/templates/playwright-template/config/runtime-config.ts +1 -0
  36. package/templates/playwright-template/config/secret-manager.ts +1 -0
  37. package/templates/playwright-template/data/factories/README.md +6 -0
  38. package/templates/playwright-template/data/factories/data-factory.ts +1 -0
  39. package/templates/playwright-template/data/generators/README.md +5 -0
  40. package/templates/playwright-template/data/generators/id-generator.ts +1 -0
  41. package/templates/playwright-template/data/generators/seeded-faker.ts +1 -0
  42. package/templates/playwright-template/fixtures/README.md +5 -0
  43. package/templates/playwright-template/fixtures/test-fixtures.ts +1 -0
  44. package/templates/playwright-template/pages/README.md +6 -0
  45. package/templates/playwright-template/pages/base-page.ts +1 -0
  46. package/templates/playwright-template/pages/login-page.ts +1 -0
  47. package/templates/playwright-template/pages/people-page.ts +1 -0
  48. package/templates/playwright-template/playwright.config.ts +1 -0
  49. package/templates/playwright-template/reporters/README.md +5 -0
  50. package/templates/playwright-template/reporters/structured-reporter.ts +1 -0
  51. package/templates/playwright-template/scripts/README.md +5 -0
  52. package/templates/playwright-template/scripts/generate-allure-report.mjs +1 -0
  53. package/templates/playwright-template/tests/README.md +7 -0
  54. package/templates/playwright-template/tests/api-people.spec.ts +1 -0
  55. package/templates/playwright-template/tests/ui-journey.spec.ts +1 -0
  56. package/templates/playwright-template/utils/README.md +5 -0
  57. package/templates/playwright-template/utils/logger.ts +1 -0
  58. package/templates/playwright-template/utils/test-step.ts +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolstackhq/create-qa-patterns",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "CLI for generating QA framework templates.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -13,6 +13,7 @@ This is a Cypress + TypeScript automation framework template for a small determi
13
13
  - [Reports and artifacts](#reports-and-artifacts)
14
14
  - [Add a new test](#add-a-new-test)
15
15
  - [Extend the framework](#extend-the-framework)
16
+ - [Template upgrades](#template-upgrades)
16
17
  - [CI](#ci)
17
18
 
18
19
  ## Feature set
@@ -21,9 +22,11 @@ This is a Cypress + TypeScript automation framework template for a small determi
21
22
  - Cypress-native custom commands for common user actions
22
23
  - page modules that own selectors and keep spec files focused on behavior
23
24
  - generic `DataFactory` helpers for repeatable UI data
25
+ - folder-level `README.md` guides and file-header comments for easier onboarding
24
26
  - multi-environment runtime config with `dev`, `staging`, and `prod`
25
27
  - env-based secret resolution with a replaceable `SecretProvider`
26
28
  - built-in screenshots and videos on failure
29
+ - optional single-file Allure report
27
30
  - ESLint rules that keep selectors out of spec files
28
31
  - bundled deterministic UI demo app and GitHub Actions workflow
29
32
 
@@ -79,6 +82,12 @@ If you want to run the demo app manually for debugging:
79
82
  npm run demo:ui
80
83
  ```
81
84
 
85
+ If you want an Allure report after a run:
86
+
87
+ ```bash
88
+ npm run report:allure
89
+ ```
90
+
82
91
  Default local values:
83
92
 
84
93
  - UI base URL: `http://127.0.0.1:3000`
@@ -134,6 +143,7 @@ npm run demo:ui
134
143
  npm run lint
135
144
  npm run typecheck
136
145
  npm run cy:run
146
+ npm run report:allure
137
147
  ```
138
148
 
139
149
  ## Reports and artifacts
@@ -142,9 +152,13 @@ Outputs:
142
152
 
143
153
  - Cypress videos: `reports/videos`
144
154
  - Cypress screenshots: `reports/screenshots`
155
+ - Allure single file: `reports/allure/index.html`
156
+ - raw Allure results: `allure-results`
145
157
 
146
158
  The default Cypress terminal output is kept as the main reporting path.
147
159
 
160
+ If you only want Cypress's built-in output, remove the `allureCypress(...)` call in `cypress.config.ts`.
161
+
148
162
  ## Add a new test
149
163
 
150
164
  Create tests under `cypress/e2e/`.
@@ -184,6 +198,24 @@ Recommended rules:
184
198
  - use Cypress commands for workflows, not giant helper classes
185
199
  - keep the data layer generic until the project really needs domain-specific factories
186
200
 
201
+ ## Template upgrades
202
+
203
+ This project includes a `.qa-patterns.json` metadata file so future CLI versions can compare the current project against the managed template baseline.
204
+
205
+ Check for available safe updates:
206
+
207
+ ```bash
208
+ npx -y @toolstackhq/create-qa-patterns upgrade check .
209
+ ```
210
+
211
+ Apply only safe managed-file updates:
212
+
213
+ ```bash
214
+ npx -y @toolstackhq/create-qa-patterns upgrade apply --safe .
215
+ ```
216
+
217
+ The upgrade flow is conservative. It updates framework infrastructure such as config, scripts, workflows, and package metadata when those files are still unchanged from the generated baseline. If you changed a managed file yourself, the CLI reports a conflict instead of overwriting it.
218
+
187
219
  ## CI
188
220
 
189
221
  The included workflow lives at:
@@ -0,0 +1,10 @@
1
+ export default {
2
+ name: "qa-patterns Cypress Template",
3
+ plugins: {
4
+ awesome: {
5
+ options: {
6
+ singleFile: true
7
+ }
8
+ }
9
+ }
10
+ };
@@ -0,0 +1,5 @@
1
+ # Config
2
+
3
+ This folder resolves environment-specific values for the Cypress template.
4
+
5
+ - Keep defaults, secret lookup, and runtime parsing here.
@@ -1,3 +1,4 @@
1
+ // Defines the built-in environment defaults used when env vars are not provided.
1
2
  import type { TestEnvironment } from "./test-env";
2
3
 
3
4
  type EnvironmentDefaults = {
@@ -1,3 +1,4 @@
1
+ // Builds the runtime configuration object that tests and fixtures consume.
1
2
  import path from "node:path";
2
3
 
3
4
  import dotenv from "dotenv";
@@ -1,3 +1,4 @@
1
+ // Minimal secret abstraction so env-based secrets can later be replaced cleanly.
1
2
  import type { TestEnvironment } from "./test-env";
2
3
 
3
4
  export interface SecretProvider {
@@ -0,0 +1,6 @@
1
+ # E2E Specs
2
+
3
+ This folder holds Cypress scenarios.
4
+
5
+ - Keep specs focused on workflow validation.
6
+ - Use custom commands and page modules instead of raw selectors.
@@ -1,3 +1,4 @@
1
+ // Starter Cypress scenario that demonstrates the preferred spec style for this template.
1
2
  import { DataFactory } from "../support/data/data-factory";
2
3
  import { loadAppConfig } from "../support/app-config";
3
4
  import { peoplePage } from "../support/pages/people-page";
@@ -0,0 +1,5 @@
1
+ # Support
2
+
3
+ This folder contains the reusable Cypress support layer.
4
+
5
+ - Put custom commands, shared config, page modules, and test data helpers here.
@@ -1,3 +1,4 @@
1
+ // Reads runtime values from Cypress env so specs stay clean and framework-aware.
1
2
  type Credentials = {
2
3
  username: string;
3
4
  password: string;
@@ -1,3 +1,4 @@
1
+ // Registers the custom Cypress commands that the starter specs rely on.
1
2
  import type { PersonRecord } from "./data/data-factory";
2
3
  import { loginPage } from "./pages/login-page";
3
4
  import { peoplePage } from "./pages/people-page";
@@ -0,0 +1,5 @@
1
+ # Data
2
+
3
+ This folder holds generic test data builders and generators.
4
+
5
+ - Keep data simple and readable for starter projects.
@@ -1,3 +1,4 @@
1
+ // Generic data builders that keep tests readable and deterministic.
1
2
  import { createSeededFaker } from "./seeded-faker";
2
3
  import { IdGenerator } from "./id-generator";
3
4
 
@@ -1,3 +1,4 @@
1
+ // Deterministic id generator for repeatable local and CI runs.
1
2
  export class IdGenerator {
2
3
  private readonly counters = new Map<string, number>();
3
4
 
@@ -1,3 +1,4 @@
1
+ // Seeded faker wrapper so generated values stay stable for a given run id.
1
2
  import { Faker, en } from "@faker-js/faker";
2
3
 
3
4
  function hashSeed(value: string): number {
@@ -1 +1,2 @@
1
+ import "allure-cypress";
1
2
  import "./commands";
@@ -0,0 +1,5 @@
1
+ # Pages
2
+
3
+ This folder holds Cypress page modules.
4
+
5
+ - Keep selectors and reusable UI actions here instead of in spec files.
@@ -1,3 +1,4 @@
1
+ // Page module for the login screen used by custom Cypress commands.
1
2
  export const loginPage = {
2
3
  visit(): Cypress.Chainable {
3
4
  return cy.visit("/login");
@@ -1,3 +1,4 @@
1
+ // Page module for the people screen used in the starter Cypress journey.
1
2
  import type { PersonRecord } from "../data/data-factory";
2
3
 
3
4
  export const peoplePage = {
@@ -1,3 +1,7 @@
1
+ // Central Cypress configuration for specs, retries, artifacts, and runtime env values.
2
+ import * as os from "node:os";
3
+
4
+ import { allureCypress } from "allure-cypress/reporter";
1
5
  import { defineConfig } from "cypress";
2
6
 
3
7
  import { loadRuntimeConfig } from "./config/runtime-config";
@@ -9,7 +13,19 @@ export default defineConfig({
9
13
  baseUrl: runtimeConfig.uiBaseUrl,
10
14
  specPattern: "cypress/e2e/**/*.cy.ts",
11
15
  supportFile: "cypress/support/e2e.ts",
12
- setupNodeEvents(_on, config) {
16
+ setupNodeEvents(on, config) {
17
+ // Keep Cypress terminal output as the default path most users expect.
18
+ // Remove the Allure line below if you prefer to stay with Cypress output only.
19
+ allureCypress(on, config, {
20
+ resultsDir: "allure-results",
21
+ environmentInfo: {
22
+ os_platform: os.platform(),
23
+ os_release: os.release(),
24
+ os_version: os.version(),
25
+ node_version: process.version
26
+ }
27
+ });
28
+
13
29
  config.env = {
14
30
  ...config.env,
15
31
  testEnv: runtimeConfig.testEnv,
@@ -22,7 +22,7 @@ const nodeGlobals = {
22
22
 
23
23
  export default [
24
24
  {
25
- ignores: ["demo-apps/**", "node_modules/**", "reports/**"]
25
+ ignores: ["demo-apps/**", "node_modules/**", "reports/**", "allure-results/**", "allure-report/**"]
26
26
  },
27
27
  js.configs.recommended,
28
28
  {