intellitester 0.2.13 → 0.2.15

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,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- var chunkUM7RXADM_cjs = require('../chunk-UM7RXADM.cjs');
4
+ var chunkUYGFHRPT_cjs = require('../chunk-UYGFHRPT.cjs');
5
5
  var chunkARJYJVRM_cjs = require('../chunk-ARJYJVRM.cjs');
6
6
  require('../chunk-QMYM2TCH.cjs');
7
7
  require('../chunk-PAKODOH4.cjs');
@@ -158,7 +158,7 @@ ${"=".repeat(60)}`);
158
158
  }
159
159
  let trackingServer = null;
160
160
  try {
161
- trackingServer = await chunkUM7RXADM_cjs.startTrackingServer({ port: 0 });
161
+ trackingServer = await chunkUYGFHRPT_cjs.startTrackingServer({ port: 0 });
162
162
  console.log(`Tracking server started on port ${trackingServer.port}`);
163
163
  } catch (error) {
164
164
  console.warn("Failed to start tracking server:", error);
@@ -170,7 +170,7 @@ ${"=".repeat(60)}`);
170
170
  let serverProcess = null;
171
171
  if (pipeline.config?.webServer) {
172
172
  try {
173
- serverProcess = await chunkUM7RXADM_cjs.startWebServer({
173
+ serverProcess = await chunkUYGFHRPT_cjs.startWebServer({
174
174
  ...pipeline.config.webServer,
175
175
  cwd: pipelineDir
176
176
  });
@@ -182,14 +182,14 @@ ${"=".repeat(60)}`);
182
182
  }
183
183
  const signalCleanup = async () => {
184
184
  console.log("\n\nInterrupted - cleaning up...");
185
- chunkUM7RXADM_cjs.killServer(serverProcess);
185
+ chunkUYGFHRPT_cjs.killServer(serverProcess);
186
186
  if (trackingServer) await trackingServer.stop();
187
187
  process.exit(1);
188
188
  };
189
189
  process.on("SIGINT", signalCleanup);
190
190
  process.on("SIGTERM", signalCleanup);
191
191
  const browserName = options.browser ?? pipeline.config?.web?.browser ?? "chromium";
192
- const headless = options.headed ? false : pipeline.config?.web?.headless ?? true;
192
+ const headless = options.headed === true ? false : pipeline.config?.web?.headless ?? true;
193
193
  const browser = await getBrowser(browserName).launch({ headless });
194
194
  const browserContext = await browser.newContext();
195
195
  const page = await browserContext.newPage();
@@ -198,7 +198,7 @@ ${"=".repeat(60)}`);
198
198
  variables: /* @__PURE__ */ new Map(),
199
199
  lastEmail: null,
200
200
  emailClient: null,
201
- appwriteContext: chunkUM7RXADM_cjs.createTestContext(),
201
+ appwriteContext: chunkUYGFHRPT_cjs.createTestContext(),
202
202
  appwriteConfig: pipeline.config?.appwrite ? {
203
203
  endpoint: pipeline.config.appwrite.endpoint,
204
204
  projectId: pipeline.config.appwrite.projectId,
@@ -206,7 +206,7 @@ ${"=".repeat(60)}`);
206
206
  } : void 0
207
207
  };
208
208
  if (pipeline.config?.appwrite) {
209
- chunkUM7RXADM_cjs.setupAppwriteTracking(page, executionContext);
209
+ chunkUYGFHRPT_cjs.setupAppwriteTracking(page, executionContext);
210
210
  }
211
211
  const completedIds = /* @__PURE__ */ new Set();
212
212
  const failedIds = /* @__PURE__ */ new Set();
@@ -273,7 +273,7 @@ ${"=".repeat(40)}`);
273
273
  console.log(`File: ${workflowRef.file}`);
274
274
  console.log(`${"=".repeat(40)}`);
275
275
  try {
276
- const workflowDefinition = await chunkUM7RXADM_cjs.loadWorkflowDefinition(workflowFilePath);
276
+ const workflowDefinition = await chunkUYGFHRPT_cjs.loadWorkflowDefinition(workflowFilePath);
277
277
  if (workflowRef.variables) {
278
278
  for (const [key, value] of Object.entries(workflowRef.variables)) {
279
279
  const interpolated = value.replace(/\{\{(\w+)\}\}/g, (match, varName) => {
@@ -294,7 +294,7 @@ ${"=".repeat(40)}`);
294
294
  sessionId,
295
295
  testStartTime
296
296
  };
297
- const result = await chunkUM7RXADM_cjs.runWorkflowWithContext(
297
+ const result = await chunkUYGFHRPT_cjs.runWorkflowWithContext(
298
298
  workflowDefinition,
299
299
  workflowFilePath,
300
300
  workflowOptions
@@ -431,7 +431,7 @@ ${"=".repeat(60)}`);
431
431
  process.off("SIGTERM", signalCleanup);
432
432
  await browserContext.close();
433
433
  await browser.close();
434
- chunkUM7RXADM_cjs.killServer(serverProcess);
434
+ chunkUYGFHRPT_cjs.killServer(serverProcess);
435
435
  if (trackingServer) {
436
436
  await trackingServer.stop();
437
437
  }
@@ -1096,7 +1096,7 @@ function cleanYamlResponse(response) {
1096
1096
  return cleaned;
1097
1097
  }
1098
1098
  async function generateTest(naturalLanguage, options) {
1099
- const provider = chunkUM7RXADM_cjs.createAIProvider(options.aiConfig);
1099
+ const provider = chunkUYGFHRPT_cjs.createAIProvider(options.aiConfig);
1100
1100
  let systemPrompt = SYSTEM_PROMPT;
1101
1101
  if (options.source !== null) {
1102
1102
  const sourceConfig = options.source ?? {};
@@ -1128,7 +1128,7 @@ Please fix the issue and generate valid YAML.`;
1128
1128
  const yaml$1 = cleanYamlResponse(response);
1129
1129
  lastYaml = yaml$1;
1130
1130
  const parsed = yaml.parse(yaml$1);
1131
- const validated = chunkUM7RXADM_cjs.TestDefinitionSchema.parse(parsed);
1131
+ const validated = chunkUYGFHRPT_cjs.TestDefinitionSchema.parse(parsed);
1132
1132
  return {
1133
1133
  success: true,
1134
1134
  test: validated,
@@ -1400,7 +1400,7 @@ var discoverTestFiles = async (testsDir = "tests") => {
1400
1400
  const allFiles = await collectYamlFiles(absoluteDir);
1401
1401
  const pipelines = [];
1402
1402
  const workflows = [];
1403
- const tests = [];
1403
+ const allTests = [];
1404
1404
  for (const file of allFiles) {
1405
1405
  const name = path4__namespace.default.basename(file).toLowerCase();
1406
1406
  if (name.endsWith(".pipeline.yaml") || name.endsWith(".pipeline.yml")) {
@@ -1408,10 +1408,47 @@ var discoverTestFiles = async (testsDir = "tests") => {
1408
1408
  } else if (name.endsWith(".workflow.yaml") || name.endsWith(".workflow.yml")) {
1409
1409
  workflows.push(file);
1410
1410
  } else if (name.endsWith(".test.yaml") || name.endsWith(".test.yml")) {
1411
- tests.push(file);
1411
+ allTests.push(file);
1412
1412
  }
1413
1413
  }
1414
- return { pipelines, workflows, tests };
1414
+ const { parse: parse2 } = await import('yaml');
1415
+ const workflowsInPipelines = /* @__PURE__ */ new Set();
1416
+ for (const pipelineFile of pipelines) {
1417
+ try {
1418
+ const content = await fs3__default.default.readFile(pipelineFile, "utf8");
1419
+ const pipeline = parse2(content);
1420
+ const pipelineDir = path4__namespace.default.dirname(pipelineFile);
1421
+ if (pipeline?.workflows && Array.isArray(pipeline.workflows)) {
1422
+ for (const workflowRef of pipeline.workflows) {
1423
+ if (workflowRef?.file) {
1424
+ const absoluteWorkflowPath = path4__namespace.default.resolve(pipelineDir, workflowRef.file);
1425
+ workflowsInPipelines.add(absoluteWorkflowPath);
1426
+ }
1427
+ }
1428
+ }
1429
+ } catch {
1430
+ }
1431
+ }
1432
+ const standaloneWorkflows = workflows.filter((wf) => !workflowsInPipelines.has(wf));
1433
+ const testsInWorkflows = /* @__PURE__ */ new Set();
1434
+ for (const workflowFile of workflows) {
1435
+ try {
1436
+ const content = await fs3__default.default.readFile(workflowFile, "utf8");
1437
+ const workflow = parse2(content);
1438
+ const workflowDir = path4__namespace.default.dirname(workflowFile);
1439
+ if (workflow?.tests && Array.isArray(workflow.tests)) {
1440
+ for (const testRef of workflow.tests) {
1441
+ if (testRef?.file) {
1442
+ const absoluteTestPath = path4__namespace.default.resolve(workflowDir, testRef.file);
1443
+ testsInWorkflows.add(absoluteTestPath);
1444
+ }
1445
+ }
1446
+ }
1447
+ } catch {
1448
+ }
1449
+ }
1450
+ const standaloneTests = allTests.filter((test) => !testsInWorkflows.has(test));
1451
+ return { pipelines, workflows: standaloneWorkflows, tests: standaloneTests };
1415
1452
  };
1416
1453
  var writeFileIfMissing = async (filePath, contents) => {
1417
1454
  if (await fileExists(filePath)) return;
@@ -1469,7 +1506,7 @@ var validateCommand = async (target) => {
1469
1506
  throw new Error(`No YAML files found at ${absoluteTarget}`);
1470
1507
  }
1471
1508
  for (const file of files) {
1472
- await chunkUM7RXADM_cjs.loadTestDefinition(file);
1509
+ await chunkUYGFHRPT_cjs.loadTestDefinition(file);
1473
1510
  console.log(`\u2713 ${path4__namespace.default.relative(process2__default.default.cwd(), file)} valid`);
1474
1511
  }
1475
1512
  };
@@ -1486,8 +1523,8 @@ var runTestCommand = async (target, options) => {
1486
1523
  const configContent = await fs3__default.default.readFile(CONFIG_FILENAME, "utf8");
1487
1524
  parsedConfig = parse2(configContent);
1488
1525
  }
1489
- const configMissing = parsedConfig ? chunkUM7RXADM_cjs.collectMissingEnvVars(parsedConfig) : [];
1490
- const testMissing = chunkUM7RXADM_cjs.collectMissingEnvVars(parsedTest);
1526
+ const configMissing = parsedConfig ? chunkUYGFHRPT_cjs.collectMissingEnvVars(parsedConfig) : [];
1527
+ const testMissing = chunkUYGFHRPT_cjs.collectMissingEnvVars(parsedTest);
1491
1528
  const allMissing = [.../* @__PURE__ */ new Set([...configMissing, ...testMissing])];
1492
1529
  if (allMissing.length > 0) {
1493
1530
  const projectRoot = await findProjectRoot(absoluteTarget);
@@ -1496,8 +1533,8 @@ var runTestCommand = async (target, options) => {
1496
1533
  process2__default.default.exit(1);
1497
1534
  }
1498
1535
  }
1499
- const test = await chunkUM7RXADM_cjs.loadTestDefinition(absoluteTarget);
1500
- const config = hasConfigFile ? await chunkUM7RXADM_cjs.loadIntellitesterConfig(CONFIG_FILENAME) : void 0;
1536
+ const test = await chunkUYGFHRPT_cjs.loadTestDefinition(absoluteTarget);
1537
+ const config = hasConfigFile ? await chunkUYGFHRPT_cjs.loadIntellitesterConfig(CONFIG_FILENAME) : void 0;
1501
1538
  const baseUrl = resolveBaseUrl(test, config?.platforms?.web?.baseUrl);
1502
1539
  const headed = options.headed ?? false;
1503
1540
  const browser = options.browser ?? "chromium";
@@ -1511,7 +1548,7 @@ var runTestCommand = async (target, options) => {
1511
1548
  console.log(
1512
1549
  `Running ${path4__namespace.default.basename(absoluteTarget)} on web (${browser}${modeFlags.length > 0 ? ", " + modeFlags.join(", ") : ""})`
1513
1550
  );
1514
- const result = await chunkUM7RXADM_cjs.runWebTest(test, {
1551
+ const result = await chunkUYGFHRPT_cjs.runWebTest(test, {
1515
1552
  baseUrl,
1516
1553
  headed,
1517
1554
  browser,
@@ -1543,7 +1580,7 @@ var generateCommand = async (prompt, options) => {
1543
1580
  const { parse: parse2 } = await import('yaml');
1544
1581
  const configContent = await fs3__default.default.readFile(CONFIG_FILENAME, "utf8");
1545
1582
  const parsedConfig = parse2(configContent);
1546
- const configMissing = chunkUM7RXADM_cjs.collectMissingEnvVars(parsedConfig);
1583
+ const configMissing = chunkUYGFHRPT_cjs.collectMissingEnvVars(parsedConfig);
1547
1584
  if (configMissing.length > 0) {
1548
1585
  const projectRoot = await findProjectRoot(CONFIG_FILENAME);
1549
1586
  const canContinue = await validateEnvVars(configMissing, projectRoot || process2__default.default.cwd());
@@ -1551,7 +1588,7 @@ var generateCommand = async (prompt, options) => {
1551
1588
  process2__default.default.exit(1);
1552
1589
  }
1553
1590
  }
1554
- const config = await chunkUM7RXADM_cjs.loadIntellitesterConfig(CONFIG_FILENAME);
1591
+ const config = await chunkUYGFHRPT_cjs.loadIntellitesterConfig(CONFIG_FILENAME);
1555
1592
  if (!config.ai) {
1556
1593
  throw new Error('AI configuration missing in intellitester.config.yaml. Add "ai:" section with provider, model, and apiKey.');
1557
1594
  }
@@ -1596,8 +1633,8 @@ var runWorkflowCommand = async (file, options) => {
1596
1633
  const configContent = await fs3__default.default.readFile(CONFIG_FILENAME, "utf8");
1597
1634
  parsedConfig = parse2(configContent);
1598
1635
  }
1599
- const configMissing = parsedConfig ? chunkUM7RXADM_cjs.collectMissingEnvVars(parsedConfig) : [];
1600
- const workflowMissing = chunkUM7RXADM_cjs.collectMissingEnvVars(parsedWorkflow);
1636
+ const configMissing = parsedConfig ? chunkUYGFHRPT_cjs.collectMissingEnvVars(parsedConfig) : [];
1637
+ const workflowMissing = chunkUYGFHRPT_cjs.collectMissingEnvVars(parsedWorkflow);
1601
1638
  const allMissing = [.../* @__PURE__ */ new Set([...configMissing, ...workflowMissing])];
1602
1639
  if (allMissing.length > 0) {
1603
1640
  const projectRoot = await findProjectRoot(workflowPath);
@@ -1606,9 +1643,9 @@ var runWorkflowCommand = async (file, options) => {
1606
1643
  process2__default.default.exit(1);
1607
1644
  }
1608
1645
  }
1609
- const workflow = await chunkUM7RXADM_cjs.loadWorkflowDefinition(workflowPath);
1610
- const config = hasConfigFile ? await chunkUM7RXADM_cjs.loadIntellitesterConfig(CONFIG_FILENAME) : void 0;
1611
- const result = await chunkUM7RXADM_cjs.runWorkflow(workflow, workflowPath, {
1646
+ const workflow = await chunkUYGFHRPT_cjs.loadWorkflowDefinition(workflowPath);
1647
+ const config = hasConfigFile ? await chunkUYGFHRPT_cjs.loadIntellitesterConfig(CONFIG_FILENAME) : void 0;
1648
+ const result = await chunkUYGFHRPT_cjs.runWorkflow(workflow, workflowPath, {
1612
1649
  headed: options.visible,
1613
1650
  browser: options.browser,
1614
1651
  interactive: options.interactive,
@@ -1653,8 +1690,8 @@ var runPipelineCommand = async (file, options) => {
1653
1690
  const configContent = await fs3__default.default.readFile(CONFIG_FILENAME, "utf8");
1654
1691
  parsedConfig = parse2(configContent);
1655
1692
  }
1656
- const configMissing = parsedConfig ? chunkUM7RXADM_cjs.collectMissingEnvVars(parsedConfig) : [];
1657
- const pipelineMissing = chunkUM7RXADM_cjs.collectMissingEnvVars(parsedPipeline);
1693
+ const configMissing = parsedConfig ? chunkUYGFHRPT_cjs.collectMissingEnvVars(parsedConfig) : [];
1694
+ const pipelineMissing = chunkUYGFHRPT_cjs.collectMissingEnvVars(parsedPipeline);
1658
1695
  const allMissing = [.../* @__PURE__ */ new Set([...configMissing, ...pipelineMissing])];
1659
1696
  if (allMissing.length > 0) {
1660
1697
  const projectRoot = await findProjectRoot(pipelinePath);
@@ -1663,8 +1700,8 @@ var runPipelineCommand = async (file, options) => {
1663
1700
  process2__default.default.exit(1);
1664
1701
  }
1665
1702
  }
1666
- const pipeline = await chunkUM7RXADM_cjs.loadPipelineDefinition(pipelinePath);
1667
- hasConfigFile ? await chunkUM7RXADM_cjs.loadIntellitesterConfig(CONFIG_FILENAME) : void 0;
1703
+ const pipeline = await chunkUYGFHRPT_cjs.loadPipelineDefinition(pipelinePath);
1704
+ hasConfigFile ? await chunkUYGFHRPT_cjs.loadIntellitesterConfig(CONFIG_FILENAME) : void 0;
1668
1705
  const result = await runPipeline(pipeline, pipelinePath, {
1669
1706
  headed: options.visible,
1670
1707
  browser: options.browser,
@@ -1719,7 +1756,7 @@ var main = async () => {
1719
1756
  const browser = resolveBrowserName(options.browser || "chrome");
1720
1757
  if (options.preview) {
1721
1758
  const hasConfigFile = await fileExists(CONFIG_FILENAME);
1722
- const config = hasConfigFile ? await chunkUM7RXADM_cjs.loadIntellitesterConfig(CONFIG_FILENAME) : void 0;
1759
+ const config = hasConfigFile ? await chunkUYGFHRPT_cjs.loadIntellitesterConfig(CONFIG_FILENAME) : void 0;
1723
1760
  const { cleanup } = await buildAndPreview(config, process2__default.default.cwd());
1724
1761
  previewCleanup = cleanup;
1725
1762
  }
@@ -1751,14 +1788,22 @@ var main = async () => {
1751
1788
  for (const pipeline of discovered.pipelines) {
1752
1789
  try {
1753
1790
  await runPipelineCommand(pipeline, runOpts);
1754
- } catch {
1791
+ } catch (error) {
1792
+ console.error(`
1793
+ \u274C Pipeline failed: ${path4__namespace.default.basename(pipeline)}`);
1794
+ console.error(` ${error instanceof Error ? error.message : String(error)}
1795
+ `);
1755
1796
  failed = true;
1756
1797
  }
1757
1798
  }
1758
1799
  for (const workflow of discovered.workflows) {
1759
1800
  try {
1760
1801
  await runWorkflowCommand(workflow, runOpts);
1761
- } catch {
1802
+ } catch (error) {
1803
+ console.error(`
1804
+ \u274C Workflow failed: ${path4__namespace.default.basename(workflow)}`);
1805
+ console.error(` ${error instanceof Error ? error.message : String(error)}
1806
+ `);
1762
1807
  failed = true;
1763
1808
  }
1764
1809
  }
@@ -1771,7 +1816,11 @@ var main = async () => {
1771
1816
  interactive: options.interactive,
1772
1817
  debug: options.debug
1773
1818
  });
1774
- } catch {
1819
+ } catch (error) {
1820
+ console.error(`
1821
+ \u274C Test failed: ${path4__namespace.default.basename(test)}`);
1822
+ console.error(` ${error instanceof Error ? error.message : String(error)}
1823
+ `);
1775
1824
  failed = true;
1776
1825
  }
1777
1826
  }
@@ -1780,21 +1829,21 @@ var main = async () => {
1780
1829
  }
1781
1830
  return;
1782
1831
  }
1783
- if (chunkUM7RXADM_cjs.isPipelineFile(file)) {
1832
+ if (chunkUYGFHRPT_cjs.isPipelineFile(file)) {
1784
1833
  await runPipelineCommand(file, runOpts);
1785
1834
  return;
1786
1835
  }
1787
- if (chunkUM7RXADM_cjs.isWorkflowFile(file)) {
1836
+ if (chunkUYGFHRPT_cjs.isWorkflowFile(file)) {
1788
1837
  await runWorkflowCommand(file, runOpts);
1789
1838
  return;
1790
1839
  }
1791
1840
  const fileContent = await fs3__default.default.readFile(path4__namespace.default.resolve(file), "utf8");
1792
- if (chunkUM7RXADM_cjs.isPipelineContent(fileContent)) {
1841
+ if (chunkUYGFHRPT_cjs.isPipelineContent(fileContent)) {
1793
1842
  console.log(`Note: Detected as pipeline by content structure`);
1794
1843
  await runPipelineCommand(file, runOpts);
1795
1844
  return;
1796
1845
  }
1797
- if (chunkUM7RXADM_cjs.isWorkflowContent(fileContent)) {
1846
+ if (chunkUYGFHRPT_cjs.isWorkflowContent(fileContent)) {
1798
1847
  console.log(`Note: Detected as workflow by content structure`);
1799
1848
  await runWorkflowCommand(file, runOpts);
1800
1849
  return;
@@ -1875,7 +1924,7 @@ Found ${failedCleanups.length} failed cleanup(s):
1875
1924
  if (!hasConfigFile) {
1876
1925
  throw new Error(`No ${CONFIG_FILENAME} found. Cannot retry cleanup without provider configuration.`);
1877
1926
  }
1878
- const config = await chunkUM7RXADM_cjs.loadIntellitesterConfig(CONFIG_FILENAME);
1927
+ const config = await chunkUYGFHRPT_cjs.loadIntellitesterConfig(CONFIG_FILENAME);
1879
1928
  const failedCleanups = await chunkARJYJVRM_cjs.loadFailedCleanups(process2__default.default.cwd());
1880
1929
  if (failedCleanups.length === 0) {
1881
1930
  console.log("No failed cleanups to retry.");