intellitester 0.2.15 → 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.
@@ -274,6 +274,7 @@ var workflowConfigSchema = z.object({
274
274
  var WorkflowDefinitionSchema = z.object({
275
275
  name: nonEmptyString2.describe("The name of the workflow"),
276
276
  platform: z.enum(["web", "android", "ios"]).default("web").describe("The platform to run the workflow on"),
277
+ variables: z.record(z.string(), z.string()).optional().describe("Workflow-level variables available to all tests"),
277
278
  config: workflowConfigSchema.optional(),
278
279
  continueOnFailure: z.boolean().default(false).describe("Continue running subsequent tests even if a test fails"),
279
280
  tests: z.array(testReferenceSchema).min(1, "Workflow must contain at least one test").describe("List of test files to execute in this workflow")
@@ -2198,6 +2199,17 @@ Starting workflow: ${workflow.name}`);
2198
2199
  }
2199
2200
  setupAppwriteTracking(page, executionContext);
2200
2201
  }
2202
+ if (workflow.variables) {
2203
+ for (const [key, value] of Object.entries(workflow.variables)) {
2204
+ if (!executionContext.variables.has(key)) {
2205
+ const interpolated = value.replace(/\{\{(\w+)\}\}/g, (match, varName) => {
2206
+ if (varName === "uuid") return crypto2.randomUUID().split("-")[0];
2207
+ return executionContext.variables.get(varName) ?? match;
2208
+ });
2209
+ executionContext.variables.set(key, interpolated);
2210
+ }
2211
+ }
2212
+ }
2201
2213
  const testResults = [];
2202
2214
  let workflowFailed = false;
2203
2215
  for (const [index, testRef] of workflow.tests.entries()) {
@@ -2381,11 +2393,13 @@ async function runWorkflow(workflow, workflowFilePath, options = {}) {
2381
2393
  process.env.INTELLITESTER_TRACK_URL = `http://localhost:${trackingServer.port}`;
2382
2394
  }
2383
2395
  let serverProcess = null;
2384
- if (workflow.config?.webServer) {
2396
+ const webServerConfig = workflow.config?.webServer ?? options.webServer;
2397
+ if (webServerConfig) {
2385
2398
  try {
2399
+ const serverCwd = workflow.config?.webServer ? workflowDir : process.cwd();
2386
2400
  serverProcess = await startWebServer({
2387
- ...workflow.config.webServer,
2388
- cwd: workflowDir
2401
+ ...webServerConfig,
2402
+ cwd: serverCwd
2389
2403
  });
2390
2404
  } catch (error) {
2391
2405
  console.error("Failed to start web server:", error);
@@ -2420,6 +2434,15 @@ async function runWorkflow(workflow, workflowFilePath, options = {}) {
2420
2434
  apiKey: workflow.config.appwrite.apiKey
2421
2435
  } : void 0
2422
2436
  };
2437
+ if (workflow.variables) {
2438
+ for (const [key, value] of Object.entries(workflow.variables)) {
2439
+ const interpolated = value.replace(/\{\{(\w+)\}\}/g, (match, varName) => {
2440
+ if (varName === "uuid") return crypto2.randomUUID().split("-")[0];
2441
+ return executionContext.variables.get(varName) ?? match;
2442
+ });
2443
+ executionContext.variables.set(key, interpolated);
2444
+ }
2445
+ }
2423
2446
  try {
2424
2447
  const result = await runWorkflowWithContext(workflow, workflowFilePath, {
2425
2448
  ...options,
@@ -2536,5 +2559,5 @@ Collected ${serverResources.length} server-tracked resources`);
2536
2559
  }
2537
2560
 
2538
2561
  export { ActionSchema, IntellitesterConfigSchema, LocatorSchema, TestConfigSchema, TestDefinitionSchema, cleanupConfigSchema, cleanupDiscoverSchema, collectMissingEnvVars, createAIProvider, createTestContext, isPipelineContent, isPipelineFile, isWorkflowContent, isWorkflowFile, killServer, loadIntellitesterConfig, loadPipelineDefinition, loadTestDefinition, loadWorkflowDefinition, parseIntellitesterConfig, parsePipelineDefinition, parseTestDefinition, parseWorkflowDefinition, previewConfigSchema, runWebTest, runWorkflow, runWorkflowWithContext, setupAppwriteTracking, startTrackingServer, startWebServer };
2539
- //# sourceMappingURL=chunk-MRTD4FLN.js.map
2540
- //# sourceMappingURL=chunk-MRTD4FLN.js.map
2562
+ //# sourceMappingURL=chunk-VPJNNQKB.js.map
2563
+ //# sourceMappingURL=chunk-VPJNNQKB.js.map