@elench/testkit 0.1.122 → 0.1.124

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.
@@ -1,4 +1,4 @@
1
- import { execa } from "execa";
1
+ import { spawn } from "node:child_process";
2
2
 
3
3
  export async function verifySeed(context = {}) {
4
4
  const args = context.args || {};
@@ -150,7 +150,7 @@ async function runScalar(databaseUrl, query, context) {
150
150
  }
151
151
 
152
152
  async function runPsql(databaseUrl, query, context) {
153
- const result = await execa(
153
+ const result = await runProcess(
154
154
  "psql",
155
155
  [
156
156
  databaseUrl,
@@ -172,11 +172,34 @@ async function runPsql(databaseUrl, query, context) {
172
172
  }
173
173
  );
174
174
  if (result.exitCode !== 0) {
175
- throw new Error(result.stderr || result.shortMessage || `psql failed with exit code ${result.exitCode}`);
175
+ throw new Error(result.stderr || `psql failed with exit code ${result.exitCode}`);
176
176
  }
177
177
  return result;
178
178
  }
179
179
 
180
+ function runProcess(command, args, options) {
181
+ return new Promise((resolve, reject) => {
182
+ const child = spawn(command, args, {
183
+ cwd: options.cwd,
184
+ env: options.env,
185
+ stdio: ["ignore", "pipe", "pipe"],
186
+ });
187
+ const stdout = [];
188
+ const stderr = [];
189
+
190
+ child.stdout.on("data", (chunk) => stdout.push(Buffer.from(chunk)));
191
+ child.stderr.on("data", (chunk) => stderr.push(Buffer.from(chunk)));
192
+ child.on("error", reject);
193
+ child.on("close", (exitCode) => {
194
+ resolve({
195
+ exitCode: exitCode ?? 1,
196
+ stderr: Buffer.concat(stderr).toString("utf8"),
197
+ stdout: Buffer.concat(stdout).toString("utf8"),
198
+ });
199
+ });
200
+ });
201
+ }
202
+
180
203
  function normalizeStatementList(value, label) {
181
204
  const values = Array.isArray(value) ? value : value == null ? [] : [value];
182
205
  if (values.length === 0) {
@@ -222,6 +222,7 @@ export interface UiAuthConfig {
222
222
  loginExpect?: number | number[];
223
223
  loginPagePath?: string;
224
224
  loginPath?: string;
225
+ password?: string;
225
226
  passwordSelector?: string;
226
227
  profiles?: Record<string, UiProvisionProfileConfig>;
227
228
  sessionPath?: string;
package/lib/ui/index.d.ts CHANGED
@@ -18,6 +18,31 @@ export interface UiSandboxFixture {
18
18
  page: import("@playwright/test").Page;
19
19
  }
20
20
 
21
+ export interface UiProvisionedOrganization {
22
+ id: string;
23
+ name: string;
24
+ role?: string;
25
+ slug?: string;
26
+ [key: string]: unknown;
27
+ }
28
+
29
+ export interface UiProvisionedIdentity {
30
+ credentials: { email: string; password: string };
31
+ organizations: UiProvisionedOrganization[];
32
+ profile: string;
33
+ seeded: Record<string, unknown>;
34
+ session: Record<string, unknown>;
35
+ token?: string;
36
+ user?: {
37
+ homeOrganizationId?: string | null;
38
+ id?: string;
39
+ mustChangePassword?: boolean;
40
+ name?: string;
41
+ timeZone?: string | null;
42
+ [key: string]: unknown;
43
+ };
44
+ }
45
+
21
46
  export declare function createUiSandbox(options?: UiSandboxOptions): {
22
47
  expect: typeof import("@playwright/test").expect;
23
48
  test: import("@playwright/test").TestType<
@@ -31,7 +56,7 @@ export interface ProvisionedUiSandbox {
31
56
  id: string;
32
57
  backendBaseUrl: string;
33
58
  frontendBaseUrl: string;
34
- identity: unknown;
59
+ identity: UiProvisionedIdentity | null;
35
60
  owner: {
36
61
  email: string;
37
62
  id: string;
@@ -87,12 +112,12 @@ export declare function provisionUiIdentity(
87
112
  options?: Record<string, unknown>
88
113
  ): Promise<{
89
114
  credentials: { email: string; password: string };
90
- organizations: unknown[];
115
+ organizations: UiProvisionedOrganization[];
91
116
  profile: string;
92
117
  seeded: Record<string, unknown>;
93
118
  session: Record<string, unknown>;
94
119
  token?: string;
95
- user?: Record<string, unknown>;
120
+ user?: UiProvisionedIdentity["user"];
96
121
  }>;
97
122
  export declare function loginWithCredentials(
98
123
  page: import("@playwright/test").Page,
@@ -102,14 +127,14 @@ export declare function loginWithCredentials(
102
127
  ): Promise<void>;
103
128
  export declare function loginAsProvisioned(
104
129
  page: import("@playwright/test").Page,
105
- identity: { credentials: { email: string; password: string } },
130
+ identity: UiProvisionedIdentity,
106
131
  options?: Record<string, unknown>
107
- ): Promise<unknown>;
132
+ ): Promise<UiProvisionedIdentity>;
108
133
  export declare function loginAsUiProfile(
109
134
  page: import("@playwright/test").Page,
110
135
  profileName?: string,
111
136
  options?: Record<string, unknown>
112
- ): Promise<unknown>;
137
+ ): Promise<UiProvisionedIdentity>;
113
138
  export declare function persistUiSessionStorage(
114
139
  page: import("@playwright/test").Page,
115
140
  identity: unknown,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/next-analysis",
3
- "version": "0.1.122",
3
+ "version": "0.1.124",
4
4
  "description": "SWC-backed Next.js source analysis primitives for Erench tools",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit-bridge",
3
- "version": "0.1.122",
3
+ "version": "0.1.124",
4
4
  "description": "Browser bridge helpers for testkit",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "typecheck": "tsc -p tsconfig.json --noEmit"
23
23
  },
24
24
  "dependencies": {
25
- "@elench/testkit-protocol": "0.1.122"
25
+ "@elench/testkit-protocol": "0.1.124"
26
26
  },
27
27
  "private": false
28
28
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit-protocol",
3
- "version": "0.1.122",
3
+ "version": "0.1.124",
4
4
  "description": "Shared browser protocol for testkit bridge and extension consumers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/ts-analysis",
3
- "version": "0.1.122",
3
+ "version": "0.1.124",
4
4
  "description": "TypeScript compiler-backed source analysis primitives for Erench tools",
5
5
  "type": "module",
6
6
  "exports": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit",
3
- "version": "0.1.122",
3
+ "version": "0.1.124",
4
4
  "description": "Assistant-first CLI for running, inspecting, and debugging local testkit suites",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -95,10 +95,10 @@
95
95
  },
96
96
  "dependencies": {
97
97
  "@babel/code-frame": "^7.29.0",
98
- "@elench/next-analysis": "0.1.122",
99
- "@elench/testkit-bridge": "0.1.122",
100
- "@elench/testkit-protocol": "0.1.122",
101
- "@elench/ts-analysis": "0.1.122",
98
+ "@elench/next-analysis": "0.1.124",
99
+ "@elench/testkit-bridge": "0.1.124",
100
+ "@elench/testkit-protocol": "0.1.124",
101
+ "@elench/ts-analysis": "0.1.124",
102
102
  "@oclif/core": "^4.10.6",
103
103
  "@playwright/test": "^1.52.0",
104
104
  "esbuild": "^0.25.11",