@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 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 default-export a function (see defineAuthSetup).`);
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.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.5.0",
27
+ "@xera-ai/core": "^0.8.1",
27
28
  "fflate": "0.8.3"
28
29
  }
29
30
  }
@@ -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 fn = mod.default;
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 default-export a function (see defineAuthSetup).`,
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,2 +0,0 @@
1
- import type { TestAdapter } from '@xera-ai/core/adapter';
2
- export declare const WebAdapter: TestAdapter;
@@ -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>;
@@ -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>;
@@ -1,7 +0,0 @@
1
- export interface PlaywrightArgsInput {
2
- specPath: string;
3
- outputDir: string;
4
- configPath: string;
5
- grep?: string;
6
- }
7
- export declare function buildPlaywrightArgs(input: PlaywrightArgsInput): string[];
@@ -1,8 +0,0 @@
1
- export interface GherkinValidateResult {
2
- ok: boolean;
3
- errors: Array<{
4
- line: number;
5
- message: string;
6
- }>;
7
- }
8
- export declare function validateGherkin(content: string): GherkinValidateResult;
@@ -1,8 +0,0 @@
1
- import { type SelectorWarning } from './selector-rules';
2
- export interface LintResult {
3
- ok: boolean;
4
- warnings: Array<SelectorWarning & {
5
- file: string;
6
- }>;
7
- }
8
- export declare function lintTicket(ticketDir: string): Promise<LintResult>;
@@ -1,5 +0,0 @@
1
- export interface SharedPom {
2
- className: string;
3
- absolutePath: string;
4
- }
5
- export declare function scanSharedPoms(repoRoot: string): SharedPom[];
@@ -1,6 +0,0 @@
1
- export interface PromoteInput {
2
- repoRoot: string;
3
- ticket: string;
4
- className: string;
5
- }
6
- export declare function promotePom(input: PromoteInput): Promise<void>;
@@ -1,9 +0,0 @@
1
- export interface SelectorWarning {
2
- rule: 'no-auto-classname' | 'prefer-role-over-css' | 'no-xpath';
3
- line: number;
4
- text: string;
5
- message: string;
6
- }
7
- export declare function lintSelectors(source: string): {
8
- warnings: SelectorWarning[];
9
- };
@@ -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,6 +0,0 @@
1
- import { type NormalizedRun } from './scrub';
2
- export interface NormalizeRunInput {
3
- runId: string;
4
- runDir: string;
5
- }
6
- export declare function normalizeRun(input: NormalizeRunInput): Promise<NormalizedRun>;
@@ -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;
@@ -1,5 +0,0 @@
1
- export interface TraceEntries {
2
- /** Filename → text contents */
3
- files: Record<string, string>;
4
- }
5
- export declare function unzipTrace(tracePath: string): TraceEntries;