@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.
- package/README.md +32 -0
- package/index.js +502 -41
- package/package.json +1 -1
- package/templates/cypress-template/README.md +32 -0
- package/templates/cypress-template/allurerc.mjs +10 -0
- package/templates/cypress-template/config/README.md +5 -0
- package/templates/cypress-template/config/environments.ts +1 -0
- package/templates/cypress-template/config/runtime-config.ts +1 -0
- package/templates/cypress-template/config/secret-manager.ts +1 -0
- package/templates/cypress-template/cypress/e2e/README.md +6 -0
- package/templates/cypress-template/cypress/e2e/ui-journey.cy.ts +1 -0
- package/templates/cypress-template/cypress/support/README.md +5 -0
- package/templates/cypress-template/cypress/support/app-config.ts +1 -0
- package/templates/cypress-template/cypress/support/commands.ts +1 -0
- package/templates/cypress-template/cypress/support/data/README.md +5 -0
- package/templates/cypress-template/cypress/support/data/data-factory.ts +1 -0
- package/templates/cypress-template/cypress/support/data/id-generator.ts +1 -0
- package/templates/cypress-template/cypress/support/data/seeded-faker.ts +1 -0
- package/templates/cypress-template/cypress/support/e2e.ts +1 -0
- package/templates/cypress-template/cypress/support/pages/README.md +5 -0
- package/templates/cypress-template/cypress/support/pages/login-page.ts +1 -0
- package/templates/cypress-template/cypress/support/pages/people-page.ts +1 -0
- package/templates/cypress-template/cypress.config.ts +17 -1
- package/templates/cypress-template/eslint.config.mjs +1 -1
- package/templates/cypress-template/package-lock.json +2857 -109
- package/templates/cypress-template/package.json +4 -0
- package/templates/cypress-template/scripts/README.md +5 -0
- package/templates/cypress-template/scripts/generate-allure-report.mjs +66 -0
- package/templates/cypress-template/scripts/run-cypress.mjs +1 -0
- package/templates/cypress-template/tsconfig.json +1 -1
- package/templates/playwright-template/README.md +20 -0
- package/templates/playwright-template/components/README.md +5 -0
- package/templates/playwright-template/config/README.md +5 -0
- package/templates/playwright-template/config/environments.ts +1 -0
- package/templates/playwright-template/config/runtime-config.ts +1 -0
- package/templates/playwright-template/config/secret-manager.ts +1 -0
- package/templates/playwright-template/data/factories/README.md +6 -0
- package/templates/playwright-template/data/factories/data-factory.ts +1 -0
- package/templates/playwright-template/data/generators/README.md +5 -0
- package/templates/playwright-template/data/generators/id-generator.ts +1 -0
- package/templates/playwright-template/data/generators/seeded-faker.ts +1 -0
- package/templates/playwright-template/fixtures/README.md +5 -0
- package/templates/playwright-template/fixtures/test-fixtures.ts +1 -0
- package/templates/playwright-template/pages/README.md +6 -0
- package/templates/playwright-template/pages/base-page.ts +1 -0
- package/templates/playwright-template/pages/login-page.ts +1 -0
- package/templates/playwright-template/pages/people-page.ts +1 -0
- package/templates/playwright-template/playwright.config.ts +1 -0
- package/templates/playwright-template/reporters/README.md +5 -0
- package/templates/playwright-template/reporters/structured-reporter.ts +1 -0
- package/templates/playwright-template/scripts/README.md +5 -0
- package/templates/playwright-template/scripts/generate-allure-report.mjs +1 -0
- package/templates/playwright-template/tests/README.md +7 -0
- package/templates/playwright-template/tests/api-people.spec.ts +1 -0
- package/templates/playwright-template/tests/ui-journey.spec.ts +1 -0
- package/templates/playwright-template/utils/README.md +5 -0
- package/templates/playwright-template/utils/logger.ts +1 -0
- package/templates/playwright-template/utils/test-step.ts +1 -0
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
"demo:ui": "node ./demo-apps/ui-demo-app/src/server.js",
|
|
12
12
|
"lint": "eslint .",
|
|
13
13
|
"typecheck": "tsc --noEmit",
|
|
14
|
+
"report:allure": "node ./scripts/generate-allure-report.mjs",
|
|
15
|
+
"report:allure:open": "allure open reports/allure",
|
|
14
16
|
"ci": "bash ./scripts/run-tests.sh"
|
|
15
17
|
},
|
|
16
18
|
"dependencies": {
|
|
@@ -24,6 +26,8 @@
|
|
|
24
26
|
"@types/node": "^22.7.4",
|
|
25
27
|
"@typescript-eslint/eslint-plugin": "^8.8.1",
|
|
26
28
|
"@typescript-eslint/parser": "^8.8.1",
|
|
29
|
+
"allure": "^3.3.1",
|
|
30
|
+
"allure-cypress": "^3.3.3",
|
|
27
31
|
"cypress": "^13.17.0",
|
|
28
32
|
"eslint": "^9.12.0",
|
|
29
33
|
"typescript": "^5.6.2"
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Builds a local Allure report from raw test results after a test run completes.
|
|
2
|
+
import { AllureReport, readConfig } from "@allurereport/core";
|
|
3
|
+
import { readdir, rm, stat } from "node:fs/promises";
|
|
4
|
+
import { join, resolve } from "node:path";
|
|
5
|
+
import process from "node:process";
|
|
6
|
+
|
|
7
|
+
const cwd = process.cwd();
|
|
8
|
+
const resultsDir = resolve(cwd, "allure-results");
|
|
9
|
+
const outputDir = resolve(cwd, "reports/allure");
|
|
10
|
+
|
|
11
|
+
const collectResultFiles = async () => {
|
|
12
|
+
const entries = (await readdir(resultsDir)).sort();
|
|
13
|
+
const files = [];
|
|
14
|
+
|
|
15
|
+
for (const entry of entries) {
|
|
16
|
+
const filePath = join(resultsDir, entry);
|
|
17
|
+
const entryStat = await stat(filePath);
|
|
18
|
+
|
|
19
|
+
if (entryStat.isFile()) {
|
|
20
|
+
files.push(filePath);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return files;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const generateReport = async () => {
|
|
28
|
+
try {
|
|
29
|
+
await stat(resultsDir);
|
|
30
|
+
} catch {
|
|
31
|
+
process.stdout.write("Skipping Allure report generation because allure-results does not exist.\n");
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const files = await collectResultFiles();
|
|
36
|
+
|
|
37
|
+
if (files.length === 0) {
|
|
38
|
+
process.stdout.write("Skipping Allure report generation because no result files were found.\n");
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
await rm(outputDir, { force: true, recursive: true });
|
|
43
|
+
|
|
44
|
+
const config = await readConfig(cwd, "allurerc.mjs", { output: outputDir });
|
|
45
|
+
const report = new AllureReport(config);
|
|
46
|
+
|
|
47
|
+
await report.start();
|
|
48
|
+
|
|
49
|
+
for (const file of files) {
|
|
50
|
+
await report.readFile(file);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
await report.done();
|
|
54
|
+
|
|
55
|
+
process.stdout.write("Allure report generated at reports/allure/index.html\n");
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
generateReport().catch((error) => {
|
|
59
|
+
if (error instanceof Error) {
|
|
60
|
+
process.stderr.write(`${error.message}\n`);
|
|
61
|
+
} else {
|
|
62
|
+
process.stderr.write(`${String(error)}\n`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
process.exit(1);
|
|
66
|
+
});
|
|
@@ -13,6 +13,7 @@ This is a Playwright + TypeScript automation framework template for UI and API t
|
|
|
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 and Docker](#ci-and-docker)
|
|
17
18
|
|
|
18
19
|
## Feature set
|
|
@@ -21,6 +22,7 @@ This is a Playwright + TypeScript automation framework template for UI and API t
|
|
|
21
22
|
- page object pattern with selectors kept out of tests
|
|
22
23
|
- shared fixtures for config, logging, data, and page objects
|
|
23
24
|
- generic data factory pattern with `DataFactory`
|
|
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
|
- Playwright HTML report by default
|
|
@@ -227,6 +229,24 @@ Recommended rules:
|
|
|
227
229
|
- prefer semantic selectors such as `getByRole`, `getByLabel`, and `data-testid`
|
|
228
230
|
- keep the data layer generic until the project really needs domain-specific factories
|
|
229
231
|
|
|
232
|
+
## Template upgrades
|
|
233
|
+
|
|
234
|
+
This project includes a `.qa-patterns.json` metadata file so future CLI versions can compare the current project against the managed template baseline.
|
|
235
|
+
|
|
236
|
+
Check for available safe updates:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
npx -y @toolstackhq/create-qa-patterns upgrade check .
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Apply only safe managed-file updates:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
npx -y @toolstackhq/create-qa-patterns upgrade apply --safe .
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
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.
|
|
249
|
+
|
|
230
250
|
## CI and Docker
|
|
231
251
|
|
|
232
252
|
The CI entrypoint is:
|