walkwright 0.0.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/LICENSE +21 -0
- package/README.md +276 -0
- package/bin/walkwright.js +3 -0
- package/build/aria.d.ts +92 -0
- package/build/aria.js +215 -0
- package/build/aria.js.map +1 -0
- package/build/browser.d.ts +3 -0
- package/build/browser.js +18 -0
- package/build/browser.js.map +1 -0
- package/build/chunk-5CHKYNP7.js +507 -0
- package/build/chunk-5CHKYNP7.js.map +1 -0
- package/build/chunk-6YRKPGUO.js +1197 -0
- package/build/chunk-6YRKPGUO.js.map +1 -0
- package/build/chunk-A452S7R3.js +35 -0
- package/build/chunk-A452S7R3.js.map +1 -0
- package/build/chunk-BODO6HIH.js +60 -0
- package/build/chunk-BODO6HIH.js.map +1 -0
- package/build/chunk-FJI2CMCE.js +439 -0
- package/build/chunk-FJI2CMCE.js.map +1 -0
- package/build/chunk-JYHZVRB2.js +80 -0
- package/build/chunk-JYHZVRB2.js.map +1 -0
- package/build/chunk-KQN5IYN6.js +97 -0
- package/build/chunk-KQN5IYN6.js.map +1 -0
- package/build/chunk-KTXNERHT.js +72 -0
- package/build/chunk-KTXNERHT.js.map +1 -0
- package/build/chunk-MFTC7XL2.js +141 -0
- package/build/chunk-MFTC7XL2.js.map +1 -0
- package/build/chunk-N4SSLHMP.js +108 -0
- package/build/chunk-N4SSLHMP.js.map +1 -0
- package/build/chunk-RNNW7OW2.js +270 -0
- package/build/chunk-RNNW7OW2.js.map +1 -0
- package/build/chunk-UAWBPTDW.js +51 -0
- package/build/chunk-UAWBPTDW.js.map +1 -0
- package/build/chunk-Z7CW5CAY.js +64 -0
- package/build/chunk-Z7CW5CAY.js.map +1 -0
- package/build/cli.d.ts +1 -0
- package/build/cli.js +253 -0
- package/build/cli.js.map +1 -0
- package/build/config.d.ts +13 -0
- package/build/config.js +15 -0
- package/build/config.js.map +1 -0
- package/build/descriptor.d.ts +96 -0
- package/build/descriptor.js +27 -0
- package/build/descriptor.js.map +1 -0
- package/build/device-auth.d.ts +6 -0
- package/build/device-auth.js +11 -0
- package/build/device-auth.js.map +1 -0
- package/build/locator.d.ts +140 -0
- package/build/locator.js +92 -0
- package/build/locator.js.map +1 -0
- package/build/paths.d.ts +11 -0
- package/build/paths.js +22 -0
- package/build/paths.js.map +1 -0
- package/build/pom-kcSMxwX2.d.ts +349 -0
- package/build/pom.d.ts +6 -0
- package/build/pom.js +37 -0
- package/build/pom.js.map +1 -0
- package/build/project.d.ts +13 -0
- package/build/project.js +19 -0
- package/build/project.js.map +1 -0
- package/build/provisioner.d.ts +34 -0
- package/build/provisioner.js +14 -0
- package/build/provisioner.js.map +1 -0
- package/build/recorder.d.ts +6 -0
- package/build/recorder.js +15 -0
- package/build/recorder.js.map +1 -0
- package/build/reporter.d.ts +16 -0
- package/build/reporter.js +426 -0
- package/build/reporter.js.map +1 -0
- package/build/schema.d.ts +49 -0
- package/build/schema.js +16 -0
- package/build/schema.js.map +1 -0
- package/build/storage-state.d.ts +22 -0
- package/build/storage-state.js +42 -0
- package/build/storage-state.js.map +1 -0
- package/build/store.d.ts +17 -0
- package/build/store.js +9 -0
- package/build/store.js.map +1 -0
- package/build/ui.d.ts +49 -0
- package/build/ui.js +56 -0
- package/build/ui.js.map +1 -0
- package/build/upload.d.ts +10 -0
- package/build/upload.js +8 -0
- package/build/upload.js.map +1 -0
- package/build/wait.d.ts +14 -0
- package/build/wait.js +50 -0
- package/build/wait.js.map +1 -0
- package/package.json +52 -0
- package/src/aria.ts +326 -0
- package/src/browser.ts +15 -0
- package/src/cli.ts +295 -0
- package/src/config.ts +16 -0
- package/src/descriptor.ts +179 -0
- package/src/device-auth.ts +188 -0
- package/src/locator.ts +683 -0
- package/src/paths.ts +70 -0
- package/src/pom.ts +2363 -0
- package/src/project.ts +77 -0
- package/src/provisioner.ts +183 -0
- package/src/recorder.ts +877 -0
- package/src/reporter.ts +561 -0
- package/src/schema.ts +37 -0
- package/src/storage-state.ts +71 -0
- package/src/store.ts +96 -0
- package/src/ui.ts +333 -0
- package/src/upload.ts +116 -0
- package/src/wait.ts +63 -0
package/build/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { spawn } from \"node:child_process\";\nimport { createRequire } from \"node:module\";\nimport { join } from \"node:path\";\n\nimport { ensureProject, login } from \"./device-auth.js\";\nimport {\n defaultReportsUrl,\n describeConfigPath,\n readWalkwrightConfig,\n repoName,\n writeWalkwrightConfig,\n} from \"./project.js\";\nimport {\n blank,\n bold,\n failure,\n glyph,\n line,\n logo,\n paint,\n wordmark,\n} from \"./ui.js\";\n\nconst [command, ...args] = process.argv.slice(2);\n\nswitch (command) {\n case \"walk\":\n await walkCommand(args);\n break;\n case \"login\":\n await loginCommand(args);\n break;\n case \"--version\":\n case \"-v\":\n banner();\n break;\n case undefined:\n case \"--help\":\n case \"-h\":\n case \"?\":\n help();\n break;\n default:\n fail(`unknown command ${command}`, \"walkwright --help lists the commands\");\n}\n\nfunction version(): string {\n const { version: value } = createRequire(import.meta.url)(\n \"../package.json\",\n ) as { version: string };\n\n return value;\n}\n\nfunction banner(): void {\n blank();\n\n for (const row of logo()) {\n line(row);\n }\n\n blank();\n line(paint(\"dim\", ` walkwright ${version()}`));\n blank();\n}\n\nfunction help(): void {\n const flag = (name: string, text: string): string =>\n ` ${paint(\"code\", name.padEnd(20))}${paint(\"dim\", text)}`;\n const header = (text: string): string => paint(\"accent\", text);\n\n blank();\n line(`${wordmark()} ${paint(\"dim\", version())}`);\n blank();\n line(header(\"USAGE\"));\n line(\n ` ${paint(\"text\", \"walkwright walk\")} ${paint(\"dim\", \"[flags] [playwright args...]\")}`,\n );\n line(\n ` ${paint(\"text\", \"walkwright login\")} ${paint(\"dim\", \"[--force] [--url <server>]\")}`,\n );\n blank();\n line(header(\"WALK\"));\n line(\n flag(\n \"--upload-on-fail\",\n \"upload the passing lanes even though the walk failed\",\n ),\n );\n line(flag(\"--no-upload\", \"skip the upload\"));\n line(flag(\"--branch <name>\", \"report under this branch instead of git's\"));\n line(\n flag(\"--project <name>\", \"the playwright project to run (default walk)\"),\n );\n line(flag(\"--\", \"everything after goes to playwright\"));\n blank();\n line(header(\"LOGIN\"));\n line(flag(\"--force\", \"log in again\"));\n line(\n flag(\"--url <server>\", `the review console (default ${defaultReportsUrl})`),\n );\n blank();\n line(header(\"ALSO\"));\n line(flag(\"--version\", \"the banner\"));\n line(flag(\"--help, -h, ?\", \"this\"));\n blank();\n}\n\nasync function loginCommand(args: string[]): Promise<void> {\n if (args.includes(\"--help\") || args.includes(\"-h\") || args.includes(\"?\")) {\n help();\n return;\n }\n\n const existing = readWalkwrightConfig();\n const configFile = describeConfigPath();\n\n if (existing !== undefined && !args.includes(\"--force\")) {\n line(\n paint(\"ok\", glyph.ok),\n ` already set up ${paint(\"dim\", glyph.dot)} project ${bold(existing.project)}`,\n );\n line(paint(\"dim\", ` ${configFile} ${glyph.dot} --force to log in again`));\n return;\n }\n\n const url = urlArg(args) ?? defaultReportsUrl;\n\n try {\n const sessionToken = await login(url);\n const project = await ensureProject(url, sessionToken, repoName());\n\n writeWalkwrightConfig({ url, ...project });\n line(\n paint(\"ok\", glyph.ok),\n ` wrote ${paint(\"code\", configFile)} ${paint(\"dim\", glyph.dot)} project ${bold(project.project)}`,\n );\n } catch (error) {\n failure(describe(error), \"run walkwright login again\");\n process.exit(1);\n }\n}\n\nasync function walkCommand(args: string[]): Promise<void> {\n let uploadOnFail = false;\n let noUpload = false;\n let branch: string | undefined;\n let project: string | undefined;\n const forwarded: string[] = [];\n\n let index = 0;\n let own = true;\n\n while (index < args.length) {\n const arg = args[index];\n\n if (arg === undefined) {\n break;\n }\n\n if (!own) {\n forwarded.push(arg);\n index += 1;\n continue;\n }\n\n switch (arg) {\n case \"--\":\n own = false;\n index += 1;\n break;\n case \"--help\":\n case \"-h\":\n case \"?\":\n help();\n return;\n case \"--upload-on-fail\":\n uploadOnFail = true;\n index += 1;\n break;\n case \"--no-upload\":\n noUpload = true;\n index += 1;\n break;\n case \"--branch\":\n branch = requiredValue(args, index, arg);\n index += 2;\n break;\n case \"--project\":\n project = requiredValue(args, index, arg);\n index += 2;\n break;\n default:\n forwarded.push(arg);\n index += 1;\n }\n }\n\n if (uploadOnFail && noUpload) {\n fail(\n \"--upload-on-fail and --no-upload cannot be used together\",\n \"pick one\",\n );\n }\n\n const resolver = createRequire(join(process.cwd(), \"package.json\"));\n\n let playwrightCli: string;\n\n try {\n playwrightCli = resolver.resolve(\"@playwright/test/cli\");\n } catch {\n fail(\n \"@playwright/test is not installed in this project\",\n \"pnpm add -D @playwright/test, then run walkwright walk again\",\n );\n }\n\n const env: NodeJS.ProcessEnv = { ...process.env };\n env[\"WALK_RECORDING\"] = \"1\";\n\n if (uploadOnFail) {\n env[\"WALKWRIGHT_UPLOAD_ON_FAIL\"] = \"1\";\n }\n\n if (noUpload) {\n env[\"WALKWRIGHT_NO_UPLOAD\"] = \"1\";\n }\n\n if (branch !== undefined) {\n env[\"WALKWRIGHT_BRANCH\"] = branch;\n }\n\n const exitCode = await runPlaywright(playwrightCli, project, forwarded, env);\n process.exit(exitCode);\n}\n\nfunction requiredValue(args: string[], index: number, flag: string): string {\n const value = args[index + 1];\n\n if (value === undefined || value.startsWith(\"--\")) {\n fail(`${flag} needs a value`, `walkwright walk ${flag} <value>`);\n }\n\n return value;\n}\n\nasync function runPlaywright(\n playwrightCli: string,\n project: string | undefined,\n forwarded: string[],\n env: NodeJS.ProcessEnv,\n): Promise<number> {\n return await new Promise((resolve, reject) => {\n const child = spawn(\n process.execPath,\n [playwrightCli, \"test\", `--project=${project ?? \"walk\"}`, ...forwarded],\n { stdio: \"inherit\", env, cwd: process.cwd() },\n );\n\n child.on(\"error\", (error) => {\n reject(error);\n });\n\n child.on(\"exit\", (exitCode) => {\n resolve(exitCode ?? 1);\n });\n });\n}\n\nfunction urlArg(args: string[]): string | undefined {\n const index = args.indexOf(\"--url\");\n\n if (index === -1) {\n return undefined;\n }\n\n const value = args[index + 1];\n\n if (value === undefined || value.startsWith(\"--\")) {\n fail(\"--url needs a value\", \"walkwright login --url https://…\");\n }\n\n return value;\n}\n\nfunction describe(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nfunction fail(message: string, hint: string): never {\n failure(message, hint);\n process.exit(1);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AAqBrB,IAAM,CAAC,SAAS,GAAG,IAAI,IAAI,QAAQ,KAAK,MAAM,CAAC;AAE/C,QAAQ,SAAS;AAAA,EACf,KAAK;AACH,UAAM,YAAY,IAAI;AACtB;AAAA,EACF,KAAK;AACH,UAAM,aAAa,IAAI;AACvB;AAAA,EACF,KAAK;AAAA,EACL,KAAK;AACH,WAAO;AACP;AAAA,EACF,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACH,SAAK;AACL;AAAA,EACF;AACE,SAAK,mBAAmB,OAAO,IAAI,sCAAsC;AAC7E;AAEA,SAAS,UAAkB;AACzB,QAAM,EAAE,SAAS,MAAM,IAAI,cAAc,YAAY,GAAG;AAAA,IACtD;AAAA,EACF;AAEA,SAAO;AACT;AAEA,SAAS,SAAe;AACtB,QAAM;AAEN,aAAW,OAAO,KAAK,GAAG;AACxB,SAAK,GAAG;AAAA,EACV;AAEA,QAAM;AACN,OAAK,MAAM,OAAO,iBAAiB,QAAQ,CAAC,EAAE,CAAC;AAC/C,QAAM;AACR;AAEA,SAAS,OAAa;AACpB,QAAM,OAAO,CAAC,MAAc,SAC1B,KAAK,MAAM,QAAQ,KAAK,OAAO,EAAE,CAAC,CAAC,GAAG,MAAM,OAAO,IAAI,CAAC;AAC1D,QAAM,SAAS,CAAC,SAAyB,MAAM,UAAU,IAAI;AAE7D,QAAM;AACN,OAAK,GAAG,SAAS,CAAC,IAA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AC7B,cAAQ,YAAY,CAAC;AAAA,IACvB,CAAC;AAAA,EACH,CAAC;AACH;AAEA,SAAS,OAAOA,OAAoC;AAClD,QAAM,QAAQA,MAAK,QAAQ,OAAO;AAElC,MAAI,UAAU,IAAI;AAChB,WAAO;AAAA,EACT;AAEA,QAAM,QAAQA,MAAK,QAAQ,CAAC;AAE5B,MAAI,UAAU,UAAa,MAAM,WAAW,IAAI,GAAG;AACjD,SAAK,uBAAuB,uCAAkC;AAAA,EAChE;AAEA,SAAO;AACT;AAEA,SAAS,SAAS,OAAwB;AACxC,SAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;AAEA,SAAS,KAAK,SAAiB,MAAqB;AAClD,UAAQ,SAAS,IAAI;AACrB,UAAQ,KAAK,CAAC;AAChB;","names":["args"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReporterDescription } from '@playwright/test';
|
|
2
|
+
import { ReporterOptions } from './reporter.js';
|
|
3
|
+
import '@playwright/test/reporter';
|
|
4
|
+
|
|
5
|
+
declare const walk: {
|
|
6
|
+
recording: boolean;
|
|
7
|
+
reporter(options: ReporterOptions): ReporterDescription[];
|
|
8
|
+
use: {
|
|
9
|
+
recording: boolean;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { walk };
|
package/build/config.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./chunk-UAWBPTDW.js";
|
|
2
|
+
|
|
3
|
+
// src/config.ts
|
|
4
|
+
var recording = process.env["WALK_RECORDING"] === "1";
|
|
5
|
+
var walk = {
|
|
6
|
+
recording,
|
|
7
|
+
reporter(options) {
|
|
8
|
+
return recording ? [["walkwright/reporter", options]] : [];
|
|
9
|
+
},
|
|
10
|
+
use: { recording }
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
walk
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/config.ts"],"sourcesContent":["import type { ReporterDescription } from \"@playwright/test\";\n\nimport type { RecorderFixtures } from \"./recorder.js\";\nimport type { ReporterOptions } from \"./reporter.js\";\n\nconst recording = process.env[\"WALK_RECORDING\"] === \"1\";\n\nexport const walk = {\n recording,\n\n reporter(options: ReporterOptions): ReporterDescription[] {\n return recording ? [[\"walkwright/reporter\", options]] : [];\n },\n\n use: { recording } satisfies Pick<RecorderFixtures, \"recording\">,\n};\n"],"mappings":";;;AAKA,IAAM,YAAY,QAAQ,IAAI,gBAAgB,MAAM;AAE7C,IAAM,OAAO;AAAA,EAClB;AAAA,EAEA,SAAS,SAAiD;AACxD,WAAO,YAAY,CAAC,CAAC,uBAAuB,OAAO,CAAC,IAAI,CAAC;AAAA,EAC3D;AAAA,EAEA,KAAK,EAAE,UAAU;AACnB;","names":[]}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { LocatorDescriptor, Text } from './locator.js';
|
|
3
|
+
import '@playwright/test';
|
|
4
|
+
|
|
5
|
+
interface ParamDecl {
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
declare const paramDeclSchema: z.ZodType<ParamDecl>;
|
|
9
|
+
type ElementDescriptor = {
|
|
10
|
+
locator: LocatorDescriptor;
|
|
11
|
+
params?: ParamDecl[];
|
|
12
|
+
} | {
|
|
13
|
+
surface: NestedSurfaceDescriptor;
|
|
14
|
+
} | {
|
|
15
|
+
overlay: OverlayDescriptor;
|
|
16
|
+
open?: OpaqueImpl;
|
|
17
|
+
} | {
|
|
18
|
+
opaque: true;
|
|
19
|
+
provenance: "hand";
|
|
20
|
+
};
|
|
21
|
+
interface OpaqueImpl {
|
|
22
|
+
opaque: true;
|
|
23
|
+
provenance: "hand";
|
|
24
|
+
}
|
|
25
|
+
declare const elementDescriptorSchema: z.ZodType<ElementDescriptor>;
|
|
26
|
+
interface ActionDescriptor {
|
|
27
|
+
name: string;
|
|
28
|
+
impl: OpaqueImpl;
|
|
29
|
+
}
|
|
30
|
+
declare const actionDescriptorSchema: z.ZodType<ActionDescriptor>;
|
|
31
|
+
interface RegexDescriptor {
|
|
32
|
+
pattern: string;
|
|
33
|
+
flags?: string;
|
|
34
|
+
}
|
|
35
|
+
declare const regexDescriptorSchema: z.ZodType<RegexDescriptor>;
|
|
36
|
+
type CaptureRuleDescriptor = {
|
|
37
|
+
element: string[];
|
|
38
|
+
text: string;
|
|
39
|
+
match?: RegexDescriptor;
|
|
40
|
+
} | {
|
|
41
|
+
match: RegexDescriptor;
|
|
42
|
+
text: string;
|
|
43
|
+
};
|
|
44
|
+
declare const captureRuleDescriptorSchema: z.ZodType<CaptureRuleDescriptor>;
|
|
45
|
+
interface CaptureDescriptor {
|
|
46
|
+
rules: CaptureRuleDescriptor[];
|
|
47
|
+
}
|
|
48
|
+
declare const captureDescriptorSchema: z.ZodType<CaptureDescriptor>;
|
|
49
|
+
interface SurfaceDescriptor {
|
|
50
|
+
elements: Record<string, ElementDescriptor>;
|
|
51
|
+
actions?: ActionDescriptor[];
|
|
52
|
+
capture?: CaptureDescriptor;
|
|
53
|
+
}
|
|
54
|
+
interface NestedSurfaceDescriptor extends SurfaceDescriptor {
|
|
55
|
+
root?: LocatorDescriptor;
|
|
56
|
+
}
|
|
57
|
+
declare const nestedSurfaceDescriptorSchema: z.ZodType<NestedSurfaceDescriptor>;
|
|
58
|
+
interface OverlayDescriptor extends SurfaceDescriptor {
|
|
59
|
+
root: LocatorDescriptor;
|
|
60
|
+
name?: Text;
|
|
61
|
+
recorder: {
|
|
62
|
+
label: string;
|
|
63
|
+
};
|
|
64
|
+
close: {
|
|
65
|
+
esc: boolean;
|
|
66
|
+
button?: LocatorDescriptor;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
declare const overlayDescriptorSchema: z.ZodType<OverlayDescriptor>;
|
|
70
|
+
type ReadyDescriptor = {
|
|
71
|
+
selector: string;
|
|
72
|
+
} | {
|
|
73
|
+
opaque: true;
|
|
74
|
+
};
|
|
75
|
+
interface PageDescriptor extends SurfaceDescriptor {
|
|
76
|
+
path: string;
|
|
77
|
+
name: string;
|
|
78
|
+
recorder?: {
|
|
79
|
+
group?: string[];
|
|
80
|
+
label?: string;
|
|
81
|
+
};
|
|
82
|
+
ready?: ReadyDescriptor;
|
|
83
|
+
header?: Text;
|
|
84
|
+
anchor?: LocatorDescriptor | {
|
|
85
|
+
opaque: true;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
declare const pageDescriptorSchema: z.ZodType<PageDescriptor>;
|
|
89
|
+
interface AppDescriptor {
|
|
90
|
+
ready?: ReadyDescriptor;
|
|
91
|
+
pages: PageDescriptor[];
|
|
92
|
+
capture?: CaptureDescriptor;
|
|
93
|
+
}
|
|
94
|
+
declare const appDescriptorSchema: z.ZodType<AppDescriptor>;
|
|
95
|
+
|
|
96
|
+
export { type ActionDescriptor, type AppDescriptor, type CaptureDescriptor, type CaptureRuleDescriptor, type ElementDescriptor, type NestedSurfaceDescriptor, type OpaqueImpl, type OverlayDescriptor, type PageDescriptor, type ParamDecl, type ReadyDescriptor, type RegexDescriptor, type SurfaceDescriptor, actionDescriptorSchema, appDescriptorSchema, captureDescriptorSchema, captureRuleDescriptorSchema, elementDescriptorSchema, nestedSurfaceDescriptorSchema, overlayDescriptorSchema, pageDescriptorSchema, paramDeclSchema, regexDescriptorSchema };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
actionDescriptorSchema,
|
|
3
|
+
appDescriptorSchema,
|
|
4
|
+
captureDescriptorSchema,
|
|
5
|
+
captureRuleDescriptorSchema,
|
|
6
|
+
elementDescriptorSchema,
|
|
7
|
+
nestedSurfaceDescriptorSchema,
|
|
8
|
+
overlayDescriptorSchema,
|
|
9
|
+
pageDescriptorSchema,
|
|
10
|
+
paramDeclSchema,
|
|
11
|
+
regexDescriptorSchema
|
|
12
|
+
} from "./chunk-N4SSLHMP.js";
|
|
13
|
+
import "./chunk-FJI2CMCE.js";
|
|
14
|
+
import "./chunk-UAWBPTDW.js";
|
|
15
|
+
export {
|
|
16
|
+
actionDescriptorSchema,
|
|
17
|
+
appDescriptorSchema,
|
|
18
|
+
captureDescriptorSchema,
|
|
19
|
+
captureRuleDescriptorSchema,
|
|
20
|
+
elementDescriptorSchema,
|
|
21
|
+
nestedSurfaceDescriptorSchema,
|
|
22
|
+
overlayDescriptorSchema,
|
|
23
|
+
pageDescriptorSchema,
|
|
24
|
+
paramDeclSchema,
|
|
25
|
+
regexDescriptorSchema
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { WalkwrightConfig } from './project.js';
|
|
2
|
+
|
|
3
|
+
declare function login(baseUrl: string): Promise<string>;
|
|
4
|
+
declare function ensureProject(baseUrl: string, sessionToken: string, name: string): Promise<Pick<WalkwrightConfig, "project" | "token">>;
|
|
5
|
+
|
|
6
|
+
export { ensureProject, login };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { Page, Locator } from '@playwright/test';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
type Mount = Page | Locator;
|
|
5
|
+
type Scope = Page | LazyLocator;
|
|
6
|
+
declare function pageOf(mount: Mount): Page;
|
|
7
|
+
type Text = string | {
|
|
8
|
+
pattern: string;
|
|
9
|
+
flags?: string;
|
|
10
|
+
} | {
|
|
11
|
+
param: string;
|
|
12
|
+
} | {
|
|
13
|
+
template: (string | {
|
|
14
|
+
param: string;
|
|
15
|
+
})[];
|
|
16
|
+
};
|
|
17
|
+
declare const textSchema: z.ZodType<Text>;
|
|
18
|
+
type By = {
|
|
19
|
+
by: "role";
|
|
20
|
+
role: string;
|
|
21
|
+
name?: Text;
|
|
22
|
+
exact?: true;
|
|
23
|
+
checked?: boolean;
|
|
24
|
+
expanded?: boolean;
|
|
25
|
+
selected?: boolean;
|
|
26
|
+
pressed?: boolean;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
} | {
|
|
29
|
+
by: "label" | "placeholder" | "text" | "title";
|
|
30
|
+
text: Text;
|
|
31
|
+
exact?: true;
|
|
32
|
+
} | {
|
|
33
|
+
by: "testid";
|
|
34
|
+
id: string;
|
|
35
|
+
};
|
|
36
|
+
interface LocatorFilter {
|
|
37
|
+
hasText?: Text;
|
|
38
|
+
has?: LocatorDescriptor;
|
|
39
|
+
hasNot?: LocatorDescriptor;
|
|
40
|
+
}
|
|
41
|
+
type Refinement = {
|
|
42
|
+
filter: LocatorFilter;
|
|
43
|
+
} | {
|
|
44
|
+
nth: number;
|
|
45
|
+
};
|
|
46
|
+
interface Refined {
|
|
47
|
+
refine?: Refinement[];
|
|
48
|
+
}
|
|
49
|
+
type LocatorNode = (By & Refined) | ({
|
|
50
|
+
by: "css" | "xpath";
|
|
51
|
+
selector: string;
|
|
52
|
+
} & Refined) | {
|
|
53
|
+
or: LocatorDescriptor[];
|
|
54
|
+
} | {
|
|
55
|
+
and: LocatorDescriptor[];
|
|
56
|
+
};
|
|
57
|
+
type LocatorDescriptor = LocatorNode[];
|
|
58
|
+
declare const locatorDescriptorSchema: z.ZodType<LocatorDescriptor>;
|
|
59
|
+
type Role = Parameters<Page["getByRole"]>[0];
|
|
60
|
+
declare function resolveLocator(scope: Page | Locator, locator: LocatorDescriptor, params?: Record<string, string>): Locator;
|
|
61
|
+
interface FilterOptions {
|
|
62
|
+
hasText?: string | RegExp | Text;
|
|
63
|
+
has?: LazyLocator;
|
|
64
|
+
hasNot?: LazyLocator;
|
|
65
|
+
}
|
|
66
|
+
interface LazyLocator {
|
|
67
|
+
(scope: LazyLocator): LazyLocator;
|
|
68
|
+
(scope: Page): Locator;
|
|
69
|
+
chain: LocatorDescriptor;
|
|
70
|
+
params: readonly string[];
|
|
71
|
+
getByRole: (role: Role, options?: RoleLeafOptions & {
|
|
72
|
+
name?: string | RegExp;
|
|
73
|
+
}) => LazyLocator;
|
|
74
|
+
getByLabel: (text: string | RegExp, options?: NameOptions) => LazyLocator;
|
|
75
|
+
getByPlaceholder: (text: string | RegExp, options?: NameOptions) => LazyLocator;
|
|
76
|
+
getByText: (text: string | RegExp, options?: NameOptions) => LazyLocator;
|
|
77
|
+
getByTitle: (text: string | RegExp, options?: NameOptions) => LazyLocator;
|
|
78
|
+
getByTestId: (id: string) => LazyLocator;
|
|
79
|
+
locator: (selector: string) => LazyLocator;
|
|
80
|
+
filter: (options: FilterOptions) => LazyLocator;
|
|
81
|
+
nth: (n: number) => LazyLocator;
|
|
82
|
+
first: () => LazyLocator;
|
|
83
|
+
last: () => LazyLocator;
|
|
84
|
+
or: (other: LazyLocator) => LazyLocator;
|
|
85
|
+
and: (other: LazyLocator) => LazyLocator;
|
|
86
|
+
within: (parent: LazyLocator) => LazyLocator;
|
|
87
|
+
}
|
|
88
|
+
declare function isLazyLocator(value: unknown): value is LazyLocator;
|
|
89
|
+
declare function textFrom(value: string | RegExp): Text;
|
|
90
|
+
declare function plainTextOf(text: Text, what: string): string | RegExp;
|
|
91
|
+
declare function paramNamesOf(locator: LocatorDescriptor): string[];
|
|
92
|
+
declare function lazyLocatorOf(locator: LocatorDescriptor): LazyLocator;
|
|
93
|
+
declare function css(selector: string): LazyLocator;
|
|
94
|
+
declare function xpath(selector: string): LazyLocator;
|
|
95
|
+
interface NameOptions {
|
|
96
|
+
exact?: boolean;
|
|
97
|
+
}
|
|
98
|
+
interface RoleLeafOptions extends NameOptions {
|
|
99
|
+
checked?: boolean;
|
|
100
|
+
expanded?: boolean;
|
|
101
|
+
selected?: boolean;
|
|
102
|
+
pressed?: boolean;
|
|
103
|
+
disabled?: boolean;
|
|
104
|
+
}
|
|
105
|
+
type NamedLazyLocator = (name: string | RegExp, options?: RoleLeafOptions) => LazyLocator;
|
|
106
|
+
type OptionallyNamedLazyLocator = (name?: string | RegExp, options?: RoleLeafOptions) => LazyLocator;
|
|
107
|
+
declare const button: NamedLazyLocator;
|
|
108
|
+
declare const link: NamedLazyLocator;
|
|
109
|
+
declare const heading: NamedLazyLocator;
|
|
110
|
+
declare const radio: NamedLazyLocator;
|
|
111
|
+
declare const tab: NamedLazyLocator;
|
|
112
|
+
declare const option: NamedLazyLocator;
|
|
113
|
+
declare const menuitem: NamedLazyLocator;
|
|
114
|
+
declare const columnheader: NamedLazyLocator;
|
|
115
|
+
declare const textbox: OptionallyNamedLazyLocator;
|
|
116
|
+
declare const checkbox: OptionallyNamedLazyLocator;
|
|
117
|
+
declare const combobox: OptionallyNamedLazyLocator;
|
|
118
|
+
declare const treeitem: OptionallyNamedLazyLocator;
|
|
119
|
+
declare const table: OptionallyNamedLazyLocator;
|
|
120
|
+
declare const grid: OptionallyNamedLazyLocator;
|
|
121
|
+
declare const tree: OptionallyNamedLazyLocator;
|
|
122
|
+
declare const list: OptionallyNamedLazyLocator;
|
|
123
|
+
declare const listitem: OptionallyNamedLazyLocator;
|
|
124
|
+
declare const alert: OptionallyNamedLazyLocator;
|
|
125
|
+
declare const main: OptionallyNamedLazyLocator;
|
|
126
|
+
declare const navigation: OptionallyNamedLazyLocator;
|
|
127
|
+
declare const tabpanel: OptionallyNamedLazyLocator;
|
|
128
|
+
declare const menu: OptionallyNamedLazyLocator;
|
|
129
|
+
declare const row: OptionallyNamedLazyLocator;
|
|
130
|
+
declare const cell: OptionallyNamedLazyLocator;
|
|
131
|
+
declare const listbox: OptionallyNamedLazyLocator;
|
|
132
|
+
declare const radiogroup: OptionallyNamedLazyLocator;
|
|
133
|
+
declare const dialog: OptionallyNamedLazyLocator;
|
|
134
|
+
declare const banner: OptionallyNamedLazyLocator;
|
|
135
|
+
declare function label(value: string | RegExp, options?: NameOptions): LazyLocator;
|
|
136
|
+
declare function testId(id: string): LazyLocator;
|
|
137
|
+
declare function text(value: string | RegExp, options?: NameOptions): LazyLocator;
|
|
138
|
+
declare function role(roleName: Role, name?: string | RegExp, options?: RoleLeafOptions): LazyLocator;
|
|
139
|
+
|
|
140
|
+
export { type By, type FilterOptions, type LazyLocator, type LocatorDescriptor, type LocatorFilter, type LocatorNode, type Mount, type NameOptions, type Refined, type Refinement, type Role, type RoleLeafOptions, type Scope, type Text, alert, banner, button, cell, checkbox, columnheader, combobox, css, dialog, grid, heading, isLazyLocator, label, lazyLocatorOf, link, list, listbox, listitem, locatorDescriptorSchema, main, menu, menuitem, navigation, option, pageOf, paramNamesOf, plainTextOf, radio, radiogroup, resolveLocator, role, row, tab, table, tabpanel, testId, text, textFrom, textSchema, textbox, tree, treeitem, xpath };
|
package/build/locator.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
alert,
|
|
3
|
+
banner,
|
|
4
|
+
button,
|
|
5
|
+
cell,
|
|
6
|
+
checkbox,
|
|
7
|
+
columnheader,
|
|
8
|
+
combobox,
|
|
9
|
+
css,
|
|
10
|
+
dialog,
|
|
11
|
+
grid,
|
|
12
|
+
heading,
|
|
13
|
+
isLazyLocator,
|
|
14
|
+
label,
|
|
15
|
+
lazyLocatorOf,
|
|
16
|
+
link,
|
|
17
|
+
list,
|
|
18
|
+
listbox,
|
|
19
|
+
listitem,
|
|
20
|
+
locatorDescriptorSchema,
|
|
21
|
+
main,
|
|
22
|
+
menu,
|
|
23
|
+
menuitem,
|
|
24
|
+
navigation,
|
|
25
|
+
option,
|
|
26
|
+
pageOf,
|
|
27
|
+
paramNamesOf,
|
|
28
|
+
plainTextOf,
|
|
29
|
+
radio,
|
|
30
|
+
radiogroup,
|
|
31
|
+
resolveLocator,
|
|
32
|
+
role,
|
|
33
|
+
row,
|
|
34
|
+
tab,
|
|
35
|
+
table,
|
|
36
|
+
tabpanel,
|
|
37
|
+
testId,
|
|
38
|
+
text,
|
|
39
|
+
textFrom,
|
|
40
|
+
textSchema,
|
|
41
|
+
textbox,
|
|
42
|
+
tree,
|
|
43
|
+
treeitem,
|
|
44
|
+
xpath
|
|
45
|
+
} from "./chunk-FJI2CMCE.js";
|
|
46
|
+
import "./chunk-UAWBPTDW.js";
|
|
47
|
+
export {
|
|
48
|
+
alert,
|
|
49
|
+
banner,
|
|
50
|
+
button,
|
|
51
|
+
cell,
|
|
52
|
+
checkbox,
|
|
53
|
+
columnheader,
|
|
54
|
+
combobox,
|
|
55
|
+
css,
|
|
56
|
+
dialog,
|
|
57
|
+
grid,
|
|
58
|
+
heading,
|
|
59
|
+
isLazyLocator,
|
|
60
|
+
label,
|
|
61
|
+
lazyLocatorOf,
|
|
62
|
+
link,
|
|
63
|
+
list,
|
|
64
|
+
listbox,
|
|
65
|
+
listitem,
|
|
66
|
+
locatorDescriptorSchema,
|
|
67
|
+
main,
|
|
68
|
+
menu,
|
|
69
|
+
menuitem,
|
|
70
|
+
navigation,
|
|
71
|
+
option,
|
|
72
|
+
pageOf,
|
|
73
|
+
paramNamesOf,
|
|
74
|
+
plainTextOf,
|
|
75
|
+
radio,
|
|
76
|
+
radiogroup,
|
|
77
|
+
resolveLocator,
|
|
78
|
+
role,
|
|
79
|
+
row,
|
|
80
|
+
tab,
|
|
81
|
+
table,
|
|
82
|
+
tabpanel,
|
|
83
|
+
testId,
|
|
84
|
+
text,
|
|
85
|
+
textFrom,
|
|
86
|
+
textSchema,
|
|
87
|
+
textbox,
|
|
88
|
+
tree,
|
|
89
|
+
treeitem,
|
|
90
|
+
xpath
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=locator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/build/paths.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const walkwrightDirName = ".walkwright";
|
|
2
|
+
declare function tryGit(cwd: string, args: string[]): string | undefined;
|
|
3
|
+
declare function projectDir(cwd?: string): string;
|
|
4
|
+
declare function walkwrightDir(cwd?: string): string;
|
|
5
|
+
declare function ensureWalkwrightDir(cwd?: string): string;
|
|
6
|
+
declare function configPath(cwd?: string): string;
|
|
7
|
+
declare function reportsDir(cwd?: string): string;
|
|
8
|
+
type StoreScope = "worker" | "project";
|
|
9
|
+
declare function storeDir(scope?: StoreScope, cwd?: string): string;
|
|
10
|
+
|
|
11
|
+
export { type StoreScope, configPath, ensureWalkwrightDir, projectDir, reportsDir, storeDir, tryGit, walkwrightDir, walkwrightDirName };
|
package/build/paths.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
configPath,
|
|
3
|
+
ensureWalkwrightDir,
|
|
4
|
+
projectDir,
|
|
5
|
+
reportsDir,
|
|
6
|
+
storeDir,
|
|
7
|
+
tryGit,
|
|
8
|
+
walkwrightDir,
|
|
9
|
+
walkwrightDirName
|
|
10
|
+
} from "./chunk-BODO6HIH.js";
|
|
11
|
+
import "./chunk-UAWBPTDW.js";
|
|
12
|
+
export {
|
|
13
|
+
configPath,
|
|
14
|
+
ensureWalkwrightDir,
|
|
15
|
+
projectDir,
|
|
16
|
+
reportsDir,
|
|
17
|
+
storeDir,
|
|
18
|
+
tryGit,
|
|
19
|
+
walkwrightDir,
|
|
20
|
+
walkwrightDirName
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|