intellitester 0.2.14 → 0.2.16

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.
@@ -283,6 +283,7 @@ var workflowConfigSchema = zod.z.object({
283
283
  var WorkflowDefinitionSchema = zod.z.object({
284
284
  name: nonEmptyString2.describe("The name of the workflow"),
285
285
  platform: zod.z.enum(["web", "android", "ios"]).default("web").describe("The platform to run the workflow on"),
286
+ variables: zod.z.record(zod.z.string(), zod.z.string()).optional().describe("Workflow-level variables available to all tests"),
286
287
  config: workflowConfigSchema.optional(),
287
288
  continueOnFailure: zod.z.boolean().default(false).describe("Continue running subsequent tests even if a test fails"),
288
289
  tests: zod.z.array(testReferenceSchema).min(1, "Workflow must contain at least one test").describe("List of test files to execute in this workflow")
@@ -2207,6 +2208,17 @@ Starting workflow: ${workflow.name}`);
2207
2208
  }
2208
2209
  setupAppwriteTracking(page, executionContext);
2209
2210
  }
2211
+ if (workflow.variables) {
2212
+ for (const [key, value] of Object.entries(workflow.variables)) {
2213
+ if (!executionContext.variables.has(key)) {
2214
+ const interpolated = value.replace(/\{\{(\w+)\}\}/g, (match, varName) => {
2215
+ if (varName === "uuid") return crypto2__default.default.randomUUID().split("-")[0];
2216
+ return executionContext.variables.get(varName) ?? match;
2217
+ });
2218
+ executionContext.variables.set(key, interpolated);
2219
+ }
2220
+ }
2221
+ }
2210
2222
  const testResults = [];
2211
2223
  let workflowFailed = false;
2212
2224
  for (const [index, testRef] of workflow.tests.entries()) {
@@ -2390,11 +2402,13 @@ async function runWorkflow(workflow, workflowFilePath, options = {}) {
2390
2402
  process.env.INTELLITESTER_TRACK_URL = `http://localhost:${trackingServer.port}`;
2391
2403
  }
2392
2404
  let serverProcess = null;
2393
- if (workflow.config?.webServer) {
2405
+ const webServerConfig = workflow.config?.webServer ?? options.webServer;
2406
+ if (webServerConfig) {
2394
2407
  try {
2408
+ const serverCwd = workflow.config?.webServer ? workflowDir : process.cwd();
2395
2409
  serverProcess = await startWebServer({
2396
- ...workflow.config.webServer,
2397
- cwd: workflowDir
2410
+ ...webServerConfig,
2411
+ cwd: serverCwd
2398
2412
  });
2399
2413
  } catch (error) {
2400
2414
  console.error("Failed to start web server:", error);
@@ -2429,6 +2443,15 @@ async function runWorkflow(workflow, workflowFilePath, options = {}) {
2429
2443
  apiKey: workflow.config.appwrite.apiKey
2430
2444
  } : void 0
2431
2445
  };
2446
+ if (workflow.variables) {
2447
+ for (const [key, value] of Object.entries(workflow.variables)) {
2448
+ const interpolated = value.replace(/\{\{(\w+)\}\}/g, (match, varName) => {
2449
+ if (varName === "uuid") return crypto2__default.default.randomUUID().split("-")[0];
2450
+ return executionContext.variables.get(varName) ?? match;
2451
+ });
2452
+ executionContext.variables.set(key, interpolated);
2453
+ }
2454
+ }
2432
2455
  try {
2433
2456
  const result = await runWorkflowWithContext(workflow, workflowFilePath, {
2434
2457
  ...options,
@@ -2574,5 +2597,5 @@ exports.runWorkflowWithContext = runWorkflowWithContext;
2574
2597
  exports.setupAppwriteTracking = setupAppwriteTracking;
2575
2598
  exports.startTrackingServer = startTrackingServer;
2576
2599
  exports.startWebServer = startWebServer;
2577
- //# sourceMappingURL=chunk-UYGFHRPT.cjs.map
2578
- //# sourceMappingURL=chunk-UYGFHRPT.cjs.map
2600
+ //# sourceMappingURL=chunk-LRXAHJTM.cjs.map
2601
+ //# sourceMappingURL=chunk-LRXAHJTM.cjs.map