qa-intelligence 1.0.0 → 1.1.0

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 CHANGED
@@ -18,9 +18,11 @@ Use it **without the framework template** — install the package into any exist
18
18
  npm install qa-intelligence @playwright/test
19
19
  ```
20
20
 
21
+ npm automatically installs peer dependencies (`typescript`, `@types/node`) — no separate dev-deps step needed.
22
+
21
23
  ---
22
24
 
23
- ## Quick setup (existing project)
25
+ ## Setup (existing Playwright project)
24
26
 
25
27
  ### 1. Environment (`.env`)
26
28
 
@@ -31,7 +33,26 @@ PW_WORKERS=2
31
33
  PW_RETRIES=1
32
34
  ```
33
35
 
34
- ### 2. `playwright.config.ts`
36
+ ### 2. `tsconfig.json` (TypeScript projects)
37
+
38
+ ```json
39
+ {
40
+ "compilerOptions": {
41
+ "target": "ES2022",
42
+ "module": "Node16",
43
+ "moduleResolution": "Node16",
44
+ "strict": true,
45
+ "esModuleInterop": true,
46
+ "types": ["node"],
47
+ "skipLibCheck": true
48
+ },
49
+ "include": ["tests/**/*", "playwright.config.ts"]
50
+ }
51
+ ```
52
+
53
+ > `module` and `moduleResolution` must both be `"Node16"` so TypeScript resolves the package `exports` map.
54
+
55
+ ### 3. `playwright.config.ts`
35
56
 
36
57
  ```ts
37
58
  import { defineConfig } from "@playwright/test";
@@ -53,7 +74,7 @@ export default defineConfig({
53
74
  });
54
75
  ```
55
76
 
56
- ### 3. Write tests
77
+ ### 4. Write tests
57
78
 
58
79
  Always import `test` from the package — **not** directly from Playwright:
59
80
 
@@ -73,7 +94,7 @@ import { step } from "qa-intelligence/playwright/steps";
73
94
  import { BasePage } from "qa-intelligence/playwright/basePage";
74
95
  ```
75
96
 
76
- ### 4. What you provide
97
+ ### 5. What you provide
77
98
 
78
99
  | You write | Package provides |
79
100
  |-----------|------------------|
@@ -179,6 +200,12 @@ The template uses this package under the hood.
179
200
 
180
201
  ---
181
202
 
203
+ ## Author
204
+
205
+ Built as the intelligence engine behind QA automation — Playwright hooks, AI failure analysis, and PR-aware CI. If you use this package, consider leaving a star or linking back—contributions are welcome.
206
+
207
+ ---
208
+
182
209
  ## License
183
210
 
184
211
  MIT
@@ -0,0 +1,2 @@
1
+ export declare function analyzeFailureFile(jsonFilePath: string): Promise<string | null>;
2
+ export declare function analyzeLatestFailure(): Promise<string | null>;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Enriches failure-diff with recurrence: first_seen, occurrence_count.
4
+ * Persists run history in a cache file for the next run.
5
+ */
6
+ export {};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,7 @@
1
+ export declare const env: {
2
+ ENV: "dev" | "staging" | "prod";
3
+ BASE_URL: string;
4
+ HEADLESS: boolean;
5
+ PW_WORKERS: number;
6
+ PW_RETRIES: number;
7
+ };
@@ -0,0 +1,14 @@
1
+ export interface Failure {
2
+ file: string;
3
+ line: number;
4
+ failure_type: string;
5
+ severity: string;
6
+ confidence: number;
7
+ is_flaky_suspected?: boolean;
8
+ }
9
+ export declare function computeDiff(baselineDir: string, currentDir: string): {
10
+ newFailures: Failure[];
11
+ unchangedFailures: Failure[];
12
+ fixedFailures: Failure[];
13
+ blockingFailures: Failure[];
14
+ };
@@ -0,0 +1,10 @@
1
+ import { AiFailure, FailureKey } from "./types";
2
+ export type ReadFailuresOptions = {
3
+ rootDir: string;
4
+ };
5
+ export declare function failureKey(f: AiFailure): FailureKey;
6
+ export declare function readFailures(options: ReadFailuresOptions): {
7
+ failures: AiFailure[];
8
+ byKey: Map<FailureKey, AiFailure>;
9
+ sourceFiles: string[];
10
+ };
@@ -0,0 +1,3 @@
1
+ import { DiffResult } from "./types";
2
+ export declare function formatDiffComment(diff: DiffResult): string;
3
+ export declare function hasFailureChanges(diff: DiffResult): boolean;
@@ -0,0 +1,21 @@
1
+ export type Severity = "low" | "medium" | "high";
2
+ export type FailureType = "assertion_mismatch" | "selector_not_found" | "timeout" | "navigation_failure" | "environment_error" | "unknown";
3
+ export type AiFailure = {
4
+ file: string;
5
+ line: number;
6
+ failure_type: FailureType | string;
7
+ expected?: number | string;
8
+ received?: number | string;
9
+ is_flaky_suspected?: boolean;
10
+ severity: Severity | string;
11
+ confidence: number;
12
+ first_seen?: string;
13
+ occurrence_count?: number;
14
+ };
15
+ export type FailureKey = string;
16
+ export type DiffResult = {
17
+ newFailures: AiFailure[];
18
+ unchangedFailures: AiFailure[];
19
+ fixedFailures: AiFailure[];
20
+ blockingFailures?: AiFailure[];
21
+ };
@@ -0,0 +1,6 @@
1
+ import { Page } from "@playwright/test";
2
+ export declare class BasePage {
3
+ protected page: Page;
4
+ constructor(page: Page);
5
+ protected navigate(path: string): Promise<void>;
6
+ }
@@ -0,0 +1,5 @@
1
+ import { expect } from "@playwright/test";
2
+ import { env } from "../config/env";
3
+ import "./testHooks";
4
+ export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
5
+ export { expect, env };
@@ -0,0 +1 @@
1
+ export default function globalSetup(): Promise<void>;
@@ -0,0 +1 @@
1
+ export default function globalTeardown(): Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function step<T>(name: string, fn: () => Promise<T>): Promise<T>;
@@ -0,0 +1 @@
1
+ export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
@@ -0,0 +1,7 @@
1
+ export declare const logger: {
2
+ info: (msg: string) => void;
3
+ warn: (msg: string) => void;
4
+ error: (msg: string) => void;
5
+ debug: (msg: string) => void;
6
+ };
7
+ export declare function getLogFilePath(): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qa-intelligence",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "engines": {
5
5
  "node": ">=18"
6
6
  },
@@ -25,15 +25,35 @@
25
25
  "type": "commonjs",
26
26
  "main": "dist/index.js",
27
27
  "exports": {
28
- "./playwright": "./dist/playwright/baseTest.js",
29
- "./playwright/globalSetup": "./dist/playwright/globalSetup.js",
30
- "./playwright/globalTeardown": "./dist/playwright/globalTeardown.js",
31
- "./playwright/basePage": "./dist/playwright/basePage.js",
32
- "./playwright/steps": "./dist/playwright/steps.js",
33
- "./config/env": "./dist/config/env.js"
28
+ "./playwright": {
29
+ "types": "./dist/playwright/baseTest.d.ts",
30
+ "default": "./dist/playwright/baseTest.js"
31
+ },
32
+ "./playwright/globalSetup": {
33
+ "types": "./dist/playwright/globalSetup.d.ts",
34
+ "default": "./dist/playwright/globalSetup.js"
35
+ },
36
+ "./playwright/globalTeardown": {
37
+ "types": "./dist/playwright/globalTeardown.d.ts",
38
+ "default": "./dist/playwright/globalTeardown.js"
39
+ },
40
+ "./playwright/basePage": {
41
+ "types": "./dist/playwright/basePage.d.ts",
42
+ "default": "./dist/playwright/basePage.js"
43
+ },
44
+ "./playwright/steps": {
45
+ "types": "./dist/playwright/steps.d.ts",
46
+ "default": "./dist/playwright/steps.js"
47
+ },
48
+ "./config/env": {
49
+ "types": "./dist/config/env.d.ts",
50
+ "default": "./dist/config/env.js"
51
+ }
34
52
  },
35
53
  "peerDependencies": {
36
- "@playwright/test": ">=1.40.0"
54
+ "@playwright/test": ">=1.40.0",
55
+ "typescript": ">=5.0.0",
56
+ "@types/node": ">=18.0.0"
37
57
  },
38
58
  "bin": {
39
59
  "qa-intelligence": "dist/cli/index.js",