@toolstackhq/create-qa-patterns 1.0.11 → 1.0.13
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 +14 -0
- package/index.js +116 -23
- package/package.json +1 -1
- package/templates/cypress-template/README.md +13 -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 +6 -5
- package/templates/cypress-template/config/runtime-config.ts +2 -0
- package/templates/cypress-template/config/secret-manager.ts +16 -6
- package/templates/cypress-template/config/test-env.ts +5 -9
- 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 +2 -1
- package/templates/cypress-template/cypress/support/data/id-generator.ts +10 -5
- package/templates/cypress-template/cypress/support/data/seeded-faker.ts +9 -6
- 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/.github/workflows/playwright-tests.yml +0 -14
- package/templates/playwright-template/README.md +1 -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 +4 -3
- 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
|
+
});
|
|
@@ -26,20 +26,6 @@ jobs:
|
|
|
26
26
|
working-directory: templates/playwright-template
|
|
27
27
|
run: npx playwright install --with-deps chromium
|
|
28
28
|
|
|
29
|
-
- name: Start API demo server
|
|
30
|
-
run: npm run dev --workspace @toolstackhq/api-demo-server &
|
|
31
|
-
|
|
32
|
-
- name: Start UI demo app
|
|
33
|
-
run: npm run dev --workspace @toolstackhq/ui-demo-app &
|
|
34
|
-
|
|
35
|
-
- name: Wait for demo services
|
|
36
|
-
run: |
|
|
37
|
-
for target in http://127.0.0.1:3000/health http://127.0.0.1:3001/health; do
|
|
38
|
-
until curl --silent --fail "$target" >/dev/null; do
|
|
39
|
-
sleep 1
|
|
40
|
-
done
|
|
41
|
-
done
|
|
42
|
-
|
|
43
29
|
- name: Run Playwright validation
|
|
44
30
|
working-directory: templates/playwright-template
|
|
45
31
|
env:
|
|
@@ -21,6 +21,7 @@ This is a Playwright + TypeScript automation framework template for UI and API t
|
|
|
21
21
|
- page object pattern with selectors kept out of tests
|
|
22
22
|
- shared fixtures for config, logging, data, and page objects
|
|
23
23
|
- generic data factory pattern with `DataFactory`
|
|
24
|
+
- folder-level `README.md` guides and file-header comments for easier onboarding
|
|
24
25
|
- multi-environment runtime config with `dev`, `staging`, and `prod`
|
|
25
26
|
- env-based secret resolution with a replaceable `SecretProvider`
|
|
26
27
|
- Playwright HTML report by default
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// Seeded faker wrapper so generated values stay stable for a given run id.
|
|
2
|
+
import { Faker, en } from "@faker-js/faker";
|
|
2
3
|
|
|
3
4
|
function hashSeed(value: string): number {
|
|
4
5
|
return value.split("").reduce((seed, character) => {
|
|
@@ -6,8 +7,8 @@ function hashSeed(value: string): number {
|
|
|
6
7
|
}, 0);
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
export function createSeededFaker(seedInput: string) {
|
|
10
|
-
const instance =
|
|
10
|
+
export function createSeededFaker(seedInput: string): Faker {
|
|
11
|
+
const instance = new Faker({ locale: [en] });
|
|
11
12
|
instance.seed(Math.abs(hashSeed(seedInput)));
|
|
12
13
|
return instance;
|
|
13
14
|
}
|