@xera-ai/web 0.3.0 → 0.8.1
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/index.js +2 -2
- package/package.json +4 -3
- package/src/auth-setup/runner.ts +4 -2
- package/dist/adapter.d.ts +0 -2
- package/dist/auth-setup/define.d.ts +0 -15
- package/dist/auth-setup/playwright-state.d.ts +0 -1
- package/dist/auth-setup/runner.d.ts +0 -11
- package/dist/executor/index.d.ts +0 -18
- package/dist/executor/playwright-args.d.ts +0 -7
- package/dist/generator/gherkin-validate.d.ts +0 -8
- package/dist/generator/lint.d.ts +0 -8
- package/dist/generator/pom-scan.d.ts +0 -5
- package/dist/generator/promote.d.ts +0 -6
- package/dist/generator/selector-rules.d.ts +0 -9
- package/dist/generator/typecheck.d.ts +0 -10
- package/dist/index.d.ts +0 -17
- package/dist/trace-normalizer/normalize.d.ts +0 -6
- package/dist/trace-normalizer/parse.d.ts +0 -36
- package/dist/trace-normalizer/scrub.d.ts +0 -28
- package/dist/trace-normalizer/unzip.d.ts +0 -5
package/dist/index.js
CHANGED
|
@@ -283,9 +283,9 @@ import { pathToFileURL } from "url";
|
|
|
283
283
|
import { writeAuthState } from "@xera-ai/core";
|
|
284
284
|
async function runAuthSetup(input) {
|
|
285
285
|
const mod = await import(pathToFileURL(input.setupScriptPath).href);
|
|
286
|
-
const fn = mod.default;
|
|
286
|
+
const fn = mod.default ?? mod.web;
|
|
287
287
|
if (typeof fn !== "function") {
|
|
288
|
-
throw new Error(`Auth setup script at ${input.setupScriptPath} must
|
|
288
|
+
throw new Error(`Auth setup script at ${input.setupScriptPath} must export a defineAuthSetup function as default or named "web" export.`);
|
|
289
289
|
}
|
|
290
290
|
const context = await input.browser.newContext();
|
|
291
291
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xera-ai/web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -17,13 +17,14 @@
|
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "bun build ./src/index.ts --outdir ./dist --target bun --external @playwright/test --external @xera-ai/core --external @cucumber/gherkin --external @cucumber/messages --external fflate",
|
|
20
|
-
"typecheck": "tsc --noEmit"
|
|
20
|
+
"typecheck": "tsc --noEmit",
|
|
21
|
+
"prepublishOnly": "bun run build"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
24
|
"@cucumber/gherkin": "39.1.0",
|
|
24
25
|
"@cucumber/messages": "32.3.1",
|
|
25
26
|
"@playwright/test": "1.60.0",
|
|
26
|
-
"@xera-ai/core": "^0.
|
|
27
|
+
"@xera-ai/core": "^0.8.1",
|
|
27
28
|
"fflate": "0.8.3"
|
|
28
29
|
}
|
|
29
30
|
}
|
package/src/auth-setup/runner.ts
CHANGED
|
@@ -14,10 +14,12 @@ export interface RunAuthSetupInput {
|
|
|
14
14
|
|
|
15
15
|
export async function runAuthSetup(input: RunAuthSetupInput): Promise<void> {
|
|
16
16
|
const mod = await import(pathToFileURL(input.setupScriptPath).href);
|
|
17
|
-
const
|
|
17
|
+
// Support both `export default defineAuthSetup(...)` and `export const web = defineAuthSetup(...)`.
|
|
18
|
+
// The named `web` export is the scaffold default for mixed-shape projects (web + http in one file).
|
|
19
|
+
const fn = mod.default ?? mod.web;
|
|
18
20
|
if (typeof fn !== 'function') {
|
|
19
21
|
throw new Error(
|
|
20
|
-
`Auth setup script at ${input.setupScriptPath} must
|
|
22
|
+
`Auth setup script at ${input.setupScriptPath} must export a defineAuthSetup function as default or named "web" export.`,
|
|
21
23
|
);
|
|
22
24
|
}
|
|
23
25
|
const context = await input.browser.newContext();
|
package/dist/adapter.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Page } from '@playwright/test';
|
|
2
|
-
export interface AuthRoleCreds {
|
|
3
|
-
email: string;
|
|
4
|
-
password: string;
|
|
5
|
-
}
|
|
6
|
-
export interface AuthSetupResult {
|
|
7
|
-
/** Optional explicit expiry hint, ms since epoch. */
|
|
8
|
-
expiresAt?: number;
|
|
9
|
-
}
|
|
10
|
-
export type AuthSetupFn = (page: Page, role: string, creds: AuthRoleCreds) => Promise<AuthSetupResult | void>;
|
|
11
|
-
/**
|
|
12
|
-
* Helper to type-narrow the user's auth setup function. Users import this in
|
|
13
|
-
* `shared/auth-setup.ts`.
|
|
14
|
-
*/
|
|
15
|
-
export declare function defineAuthSetup(fn: AuthSetupFn): AuthSetupFn;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function stagePlaywrightState(authDir: string, role: string): string;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Browser } from '@playwright/test';
|
|
2
|
-
import type { AuthRoleCreds } from './define';
|
|
3
|
-
export interface RunAuthSetupInput {
|
|
4
|
-
role: string;
|
|
5
|
-
creds: AuthRoleCreds;
|
|
6
|
-
setupScriptPath: string;
|
|
7
|
-
authDir: string;
|
|
8
|
-
browser: Browser;
|
|
9
|
-
now?: Date;
|
|
10
|
-
}
|
|
11
|
-
export declare function runAuthSetup(input: RunAuthSetupInput): Promise<void>;
|
package/dist/executor/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface SpawnResult {
|
|
2
|
-
exitCode: number;
|
|
3
|
-
}
|
|
4
|
-
export type SpawnFn = (cmd: string, args: string[], env: NodeJS.ProcessEnv) => Promise<SpawnResult>;
|
|
5
|
-
export interface RunPlaywrightInput {
|
|
6
|
-
specPath: string;
|
|
7
|
-
configPath: string;
|
|
8
|
-
outputDir: string;
|
|
9
|
-
grep?: string;
|
|
10
|
-
env?: NodeJS.ProcessEnv;
|
|
11
|
-
spawn?: SpawnFn;
|
|
12
|
-
}
|
|
13
|
-
export interface RunPlaywrightResult {
|
|
14
|
-
outcome: 'PASS' | 'FAIL';
|
|
15
|
-
rawReportPath: string;
|
|
16
|
-
exitCode: number;
|
|
17
|
-
}
|
|
18
|
-
export declare function runPlaywright(input: RunPlaywrightInput): Promise<RunPlaywrightResult>;
|
package/dist/generator/lint.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface TypecheckResult {
|
|
2
|
-
ok: boolean;
|
|
3
|
-
errors: string[];
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Type-check the ticket's TypeScript files using the project's root tsconfig.
|
|
7
|
-
* Errors are filtered to those whose path contains the ticket directory, so the
|
|
8
|
-
* skill sees only the locally relevant ones.
|
|
9
|
-
*/
|
|
10
|
-
export declare function typecheckTicket(ticketDir: string): Promise<TypecheckResult>;
|
package/dist/index.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export { CREDIT_CARD_RE, EMAIL_RE, EMAIL_RE_G, JWT_RE, PHONE_RE, PHONE_RE_G, SENSITIVE_BODY_KEYS, SENSITIVE_HEADERS, scrubBodyJson, scrubFreeText, scrubHeaders, } from '@xera-ai/core';
|
|
2
|
-
export * from './adapter';
|
|
3
|
-
export * from './auth-setup/define';
|
|
4
|
-
export * from './auth-setup/playwright-state';
|
|
5
|
-
export * from './auth-setup/runner';
|
|
6
|
-
export * from './executor';
|
|
7
|
-
export * from './executor/playwright-args';
|
|
8
|
-
export * from './generator/gherkin-validate';
|
|
9
|
-
export * from './generator/lint';
|
|
10
|
-
export * from './generator/pom-scan';
|
|
11
|
-
export * from './generator/promote';
|
|
12
|
-
export * from './generator/selector-rules';
|
|
13
|
-
export * from './generator/typecheck';
|
|
14
|
-
export * from './trace-normalizer/normalize';
|
|
15
|
-
export * from './trace-normalizer/parse';
|
|
16
|
-
export * from './trace-normalizer/scrub';
|
|
17
|
-
export * from './trace-normalizer/unzip';
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { NormalizedRun } from './scrub';
|
|
2
|
-
interface PWAttachment {
|
|
3
|
-
name: string;
|
|
4
|
-
path?: string;
|
|
5
|
-
contentType?: string;
|
|
6
|
-
}
|
|
7
|
-
interface PWResult {
|
|
8
|
-
status: string;
|
|
9
|
-
duration: number;
|
|
10
|
-
error?: {
|
|
11
|
-
message?: string;
|
|
12
|
-
stack?: string;
|
|
13
|
-
};
|
|
14
|
-
attachments?: PWAttachment[];
|
|
15
|
-
}
|
|
16
|
-
interface PWTest {
|
|
17
|
-
results: PWResult[];
|
|
18
|
-
}
|
|
19
|
-
interface PWSpec {
|
|
20
|
-
title: string;
|
|
21
|
-
ok: boolean;
|
|
22
|
-
tests: PWTest[];
|
|
23
|
-
}
|
|
24
|
-
interface PWSuite {
|
|
25
|
-
title: string;
|
|
26
|
-
specs?: PWSpec[];
|
|
27
|
-
suites?: PWSuite[];
|
|
28
|
-
}
|
|
29
|
-
interface PWReport {
|
|
30
|
-
stats: {
|
|
31
|
-
unexpected: number;
|
|
32
|
-
};
|
|
33
|
-
suites: PWSuite[];
|
|
34
|
-
}
|
|
35
|
-
export declare function parsePlaywrightReport(report: PWReport, runId: string): NormalizedRun;
|
|
36
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export interface NormalizedNetworkEntry {
|
|
2
|
-
method: string;
|
|
3
|
-
url: string;
|
|
4
|
-
status: number;
|
|
5
|
-
requestHeaders?: Record<string, string>;
|
|
6
|
-
requestBody?: unknown;
|
|
7
|
-
responseHeaders?: Record<string, string>;
|
|
8
|
-
responseBody?: unknown;
|
|
9
|
-
}
|
|
10
|
-
export interface NormalizedScenario {
|
|
11
|
-
name: string;
|
|
12
|
-
outcome: 'PASS' | 'FAIL' | 'SKIPPED';
|
|
13
|
-
failure?: {
|
|
14
|
-
step?: string;
|
|
15
|
-
errorMessage?: string;
|
|
16
|
-
domSnapshotAtFailure?: string;
|
|
17
|
-
networkAtFailure?: NormalizedNetworkEntry[];
|
|
18
|
-
consoleAtFailure?: string[];
|
|
19
|
-
screenshotPath?: string;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export interface NormalizedRun {
|
|
23
|
-
runId: string;
|
|
24
|
-
outcome: 'PASS' | 'FAIL';
|
|
25
|
-
scenarios: NormalizedScenario[];
|
|
26
|
-
scrubbed_fields_count: number;
|
|
27
|
-
}
|
|
28
|
-
export declare function scrub(run: NormalizedRun): NormalizedRun;
|