intellitester 0.2.16 → 0.2.19

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.
@@ -9,6 +9,7 @@ var path = require('path');
9
9
  var child_process = require('child_process');
10
10
  var playwright = require('playwright');
11
11
  var prompts = require('prompts');
12
+ var uniqueNamesGenerator = require('unique-names-generator');
12
13
  var nodeAppwrite = require('node-appwrite');
13
14
  var anthropic = require('@llamaindex/anthropic');
14
15
  var openai = require('@llamaindex/openai');
@@ -50,6 +51,36 @@ var inputActionSchema = zod.z.object({
50
51
  target: LocatorSchema,
51
52
  value: zod.z.string().describe("Text to input (can reference variables with ${VAR_NAME})")
52
53
  }).describe("Input text into a field");
54
+ var clearActionSchema = zod.z.object({
55
+ type: zod.z.literal("clear"),
56
+ target: LocatorSchema
57
+ }).describe("Clear the contents of an input field");
58
+ var hoverActionSchema = zod.z.object({
59
+ type: zod.z.literal("hover"),
60
+ target: LocatorSchema
61
+ }).describe("Hover over an element");
62
+ var selectActionSchema = zod.z.object({
63
+ type: zod.z.literal("select"),
64
+ target: LocatorSchema,
65
+ value: zod.z.string().describe("Option value, label, or index to select")
66
+ }).describe("Select an option from a dropdown");
67
+ var checkActionSchema = zod.z.object({
68
+ type: zod.z.literal("check"),
69
+ target: LocatorSchema
70
+ }).describe("Check a checkbox");
71
+ var uncheckActionSchema = zod.z.object({
72
+ type: zod.z.literal("uncheck"),
73
+ target: LocatorSchema
74
+ }).describe("Uncheck a checkbox");
75
+ var pressActionSchema = zod.z.object({
76
+ type: zod.z.literal("press"),
77
+ key: nonEmptyString.describe("Key to press (e.g., Enter, Tab, Escape, ArrowDown)"),
78
+ target: LocatorSchema.optional().describe("Element to focus before pressing key")
79
+ }).describe("Press a keyboard key");
80
+ var focusActionSchema = zod.z.object({
81
+ type: zod.z.literal("focus"),
82
+ target: LocatorSchema
83
+ }).describe("Focus an element");
53
84
  var assertActionSchema = zod.z.object({
54
85
  type: zod.z.literal("assert"),
55
86
  target: LocatorSchema,
@@ -110,6 +141,13 @@ var ActionSchema = zod.z.discriminatedUnion("type", [
110
141
  navigateActionSchema,
111
142
  tapActionSchema,
112
143
  inputActionSchema,
144
+ clearActionSchema,
145
+ hoverActionSchema,
146
+ selectActionSchema,
147
+ checkActionSchema,
148
+ uncheckActionSchema,
149
+ pressActionSchema,
150
+ focusActionSchema,
113
151
  assertActionSchema,
114
152
  waitActionSchema,
115
153
  scrollActionSchema,
@@ -448,6 +486,19 @@ var isPipelineContent = (content) => {
448
486
  return false;
449
487
  }
450
488
  };
489
+ function generateRandomUsername() {
490
+ const numberDictionary = uniqueNamesGenerator.NumberDictionary.generate({ min: 0, max: 99 });
491
+ const username = uniqueNamesGenerator.uniqueNamesGenerator({
492
+ dictionaries: [uniqueNamesGenerator.adjectives, uniqueNamesGenerator.animals, numberDictionary],
493
+ separator: "",
494
+ style: "capital",
495
+ length: 3
496
+ });
497
+ if (username.length > 30) {
498
+ return username.slice(0, 30);
499
+ }
500
+ return username;
501
+ }
451
502
 
452
503
  // src/integrations/email/inbucketClient.ts
453
504
  var InbucketClient = class {
@@ -988,6 +1039,9 @@ function interpolateVariables(value, variables) {
988
1039
  if (varName === "uuid") {
989
1040
  return crypto2__default.default.randomUUID().split("-")[0];
990
1041
  }
1042
+ if (varName === "randomUsername") {
1043
+ return generateRandomUsername();
1044
+ }
991
1045
  return variables.get(varName) ?? match;
992
1046
  });
993
1047
  }
@@ -1332,6 +1386,53 @@ async function executeActionWithRetry(page, action, index, options) {
1332
1386
  await runInput(page, action.target, action.value, context);
1333
1387
  break;
1334
1388
  }
1389
+ case "clear": {
1390
+ if (debugMode) console.log(`[DEBUG] Clearing element:`, action.target);
1391
+ const handle = resolveLocator(page, action.target);
1392
+ await handle.clear();
1393
+ break;
1394
+ }
1395
+ case "hover": {
1396
+ if (debugMode) console.log(`[DEBUG] Hovering element:`, action.target);
1397
+ const handle = resolveLocator(page, action.target);
1398
+ await handle.hover();
1399
+ break;
1400
+ }
1401
+ case "select": {
1402
+ const interpolated = interpolateVariables(action.value, context.variables);
1403
+ if (debugMode) console.log(`[DEBUG] Selecting: ${interpolated}`);
1404
+ const handle = resolveLocator(page, action.target);
1405
+ await handle.selectOption(interpolated);
1406
+ break;
1407
+ }
1408
+ case "check": {
1409
+ if (debugMode) console.log(`[DEBUG] Checking:`, action.target);
1410
+ const handle = resolveLocator(page, action.target);
1411
+ await handle.check();
1412
+ break;
1413
+ }
1414
+ case "uncheck": {
1415
+ if (debugMode) console.log(`[DEBUG] Unchecking:`, action.target);
1416
+ const handle = resolveLocator(page, action.target);
1417
+ await handle.uncheck();
1418
+ break;
1419
+ }
1420
+ case "press": {
1421
+ if (debugMode) console.log(`[DEBUG] Pressing key: ${action.key}`);
1422
+ if (action.target) {
1423
+ const handle = resolveLocator(page, action.target);
1424
+ await handle.press(action.key);
1425
+ } else {
1426
+ await page.keyboard.press(action.key);
1427
+ }
1428
+ break;
1429
+ }
1430
+ case "focus": {
1431
+ if (debugMode) console.log(`[DEBUG] Focusing:`, action.target);
1432
+ const handle = resolveLocator(page, action.target);
1433
+ await handle.focus();
1434
+ break;
1435
+ }
1335
1436
  case "assert": {
1336
1437
  if (debugMode) {
1337
1438
  console.log(`[DEBUG] Asserting element:`, action.target);
@@ -1798,6 +1899,9 @@ function interpolateWorkflowVariables(value, currentVariables, testResults) {
1798
1899
  if (path3 === "uuid") {
1799
1900
  return crypto2__default.default.randomUUID().split("-")[0];
1800
1901
  }
1902
+ if (path3 === "randomUsername") {
1903
+ return generateRandomUsername();
1904
+ }
1801
1905
  return currentVariables.get(path3) ?? match;
1802
1906
  });
1803
1907
  }
@@ -1819,6 +1923,9 @@ async function runTestInWorkflow(test, page, context, options, _workflowDir, wor
1819
1923
  if (varName === "uuid") {
1820
1924
  return crypto2__default.default.randomUUID().split("-")[0];
1821
1925
  }
1926
+ if (varName === "randomUsername") {
1927
+ return generateRandomUsername();
1928
+ }
1822
1929
  return context.variables.get(varName) ?? match;
1823
1930
  });
1824
1931
  };
@@ -1863,6 +1970,53 @@ async function runTestInWorkflow(test, page, context, options, _workflowDir, wor
1863
1970
  await handle.fill(interpolated);
1864
1971
  break;
1865
1972
  }
1973
+ case "clear": {
1974
+ if (debugMode) console.log(` [DEBUG] Clearing element:`, action.target);
1975
+ const handle = resolveLocator2(action.target);
1976
+ await handle.clear();
1977
+ break;
1978
+ }
1979
+ case "hover": {
1980
+ if (debugMode) console.log(` [DEBUG] Hovering element:`, action.target);
1981
+ const handle = resolveLocator2(action.target);
1982
+ await handle.hover();
1983
+ break;
1984
+ }
1985
+ case "select": {
1986
+ const interpolated = interpolateVariables2(action.value);
1987
+ if (debugMode) console.log(` [DEBUG] Selecting: ${interpolated}`);
1988
+ const handle = resolveLocator2(action.target);
1989
+ await handle.selectOption(interpolated);
1990
+ break;
1991
+ }
1992
+ case "check": {
1993
+ if (debugMode) console.log(` [DEBUG] Checking:`, action.target);
1994
+ const handle = resolveLocator2(action.target);
1995
+ await handle.check();
1996
+ break;
1997
+ }
1998
+ case "uncheck": {
1999
+ if (debugMode) console.log(` [DEBUG] Unchecking:`, action.target);
2000
+ const handle = resolveLocator2(action.target);
2001
+ await handle.uncheck();
2002
+ break;
2003
+ }
2004
+ case "press": {
2005
+ if (debugMode) console.log(` [DEBUG] Pressing key: ${action.key}`);
2006
+ if (action.target) {
2007
+ const handle = resolveLocator2(action.target);
2008
+ await handle.press(action.key);
2009
+ } else {
2010
+ await page.keyboard.press(action.key);
2011
+ }
2012
+ break;
2013
+ }
2014
+ case "focus": {
2015
+ if (debugMode) console.log(` [DEBUG] Focusing:`, action.target);
2016
+ const handle = resolveLocator2(action.target);
2017
+ await handle.focus();
2018
+ break;
2019
+ }
1866
2020
  case "assert": {
1867
2021
  if (debugMode) console.log(` [DEBUG] Assert:`, action.target);
1868
2022
  const handle = resolveLocator2(action.target);
@@ -2213,6 +2367,7 @@ Starting workflow: ${workflow.name}`);
2213
2367
  if (!executionContext.variables.has(key)) {
2214
2368
  const interpolated = value.replace(/\{\{(\w+)\}\}/g, (match, varName) => {
2215
2369
  if (varName === "uuid") return crypto2__default.default.randomUUID().split("-")[0];
2370
+ if (varName === "randomUsername") return generateRandomUsername();
2216
2371
  return executionContext.variables.get(varName) ?? match;
2217
2372
  });
2218
2373
  executionContext.variables.set(key, interpolated);
@@ -2248,6 +2403,9 @@ Starting workflow: ${workflow.name}`);
2248
2403
  if (varName === "uuid") {
2249
2404
  return crypto2__default.default.randomUUID().split("-")[0];
2250
2405
  }
2406
+ if (varName === "randomUsername") {
2407
+ return generateRandomUsername();
2408
+ }
2251
2409
  return executionContext.variables.get(varName) ?? match;
2252
2410
  });
2253
2411
  executionContext.variables.set(key, interpolated);
@@ -2447,6 +2605,7 @@ async function runWorkflow(workflow, workflowFilePath, options = {}) {
2447
2605
  for (const [key, value] of Object.entries(workflow.variables)) {
2448
2606
  const interpolated = value.replace(/\{\{(\w+)\}\}/g, (match, varName) => {
2449
2607
  if (varName === "uuid") return crypto2__default.default.randomUUID().split("-")[0];
2608
+ if (varName === "randomUsername") return generateRandomUsername();
2450
2609
  return executionContext.variables.get(varName) ?? match;
2451
2610
  });
2452
2611
  executionContext.variables.set(key, interpolated);
@@ -2577,6 +2736,7 @@ exports.cleanupDiscoverSchema = cleanupDiscoverSchema;
2577
2736
  exports.collectMissingEnvVars = collectMissingEnvVars;
2578
2737
  exports.createAIProvider = createAIProvider;
2579
2738
  exports.createTestContext = createTestContext;
2739
+ exports.generateRandomUsername = generateRandomUsername;
2580
2740
  exports.isPipelineContent = isPipelineContent;
2581
2741
  exports.isPipelineFile = isPipelineFile;
2582
2742
  exports.isWorkflowContent = isWorkflowContent;
@@ -2597,5 +2757,5 @@ exports.runWorkflowWithContext = runWorkflowWithContext;
2597
2757
  exports.setupAppwriteTracking = setupAppwriteTracking;
2598
2758
  exports.startTrackingServer = startTrackingServer;
2599
2759
  exports.startWebServer = startWebServer;
2600
- //# sourceMappingURL=chunk-LRXAHJTM.cjs.map
2601
- //# sourceMappingURL=chunk-LRXAHJTM.cjs.map
2760
+ //# sourceMappingURL=chunk-LFCMPHWU.cjs.map
2761
+ //# sourceMappingURL=chunk-LFCMPHWU.cjs.map