@checksum-ai/runtime 1.0.6 → 1.0.7

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.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@checksum-ai/runtime",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Checksum.ai test runtime",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
9
  "dependencies": {
10
- "playwright-test-cs": "npm:@playwright/test@^1.37.0"
10
+ "playwright-test-cs": "npm:@playwright/test@1.37.0"
11
11
  },
12
12
  "repository": {
13
13
  "type": "git",
package/postinstall.js CHANGED
@@ -7,8 +7,13 @@ try {
7
7
  const packageJsonPath = path.join(process.cwd(), "package.json");
8
8
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath));
9
9
 
10
+ // verify that the package.json has a scripts section
11
+ if (!packageJson.scripts) {
12
+ packageJson.scripts = {};
13
+ }
14
+
10
15
  packageJson.scripts["checksum"] =
11
- "node ./node_modules/@checksum-ai/runtime/cli.js";
16
+ "ts-node --esm --skipIgnore ./node_modules/@checksum-ai/runtime/cli.ts";
12
17
 
13
18
  fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
14
19
  } catch (e) {
@@ -19,7 +24,7 @@ try {
19
24
  (async () => {
20
25
  try {
21
26
  console.log("Installing checksum files and folders");
22
- await execCmd("npm run checksum install");
27
+ await execCmd("npm run checksum init");
23
28
  } catch (e) {
24
29
  console.log("Failed installing checksum files and folders, ", e);
25
30
  process.exit(1);
package/types.ts ADDED
@@ -0,0 +1,58 @@
1
+ import { Page } from "@playwright/test";
2
+
3
+ /**
4
+ * Checksum runtime root folder
5
+ */
6
+ export const CHECKSUM_ROOT_FOLDER = "checksum";
7
+
8
+ /**
9
+ * Checksum runtime running mode -
10
+ * normal - tests run normally
11
+ * heal - checksum will attempt to heal tests that failed using fallback
12
+ * refactor - checksum will attempt to refactor and improve your tests
13
+ */
14
+ export enum RunMode {
15
+ Normal = "normal",
16
+ Heal = "heal",
17
+ Refactor = "refactor",
18
+ }
19
+
20
+ export interface IChecksumPage extends Page {
21
+ initWithTest: (testInfo) => Promise<void>;
22
+ checksumId: (id: string) => IChecksumPage;
23
+ checksumStep: (thought: string, testFunction?: () => void) => IChecksumPage;
24
+ testId: (testId: string) => void;
25
+ }
26
+
27
+ export type RuntimeOptions = {
28
+ /**
29
+ * fallback to ESRA if the action selector is not found
30
+ */
31
+ actionsESRAfallback: boolean;
32
+ actionsLLMFallback: boolean; // use LLM fallback if action selector is not found
33
+ // actionsChangeSelectors: boolean; // change the selector of the action if found better match
34
+ // existingAssertionsESRAfallback: boolean; // fallback to ESRA if the existing assertion selector is not found
35
+ // existingAssertionsChangeSelectors: boolean; // change the selector of existing assertion if found better match
36
+ newAssertionsEnabled: boolean; // add new assertions
37
+ writeTraceFile: boolean; // saves trace file at the end of the test
38
+ useMockData: boolean; // use mocked data
39
+ printLogs: boolean; // print logs to console
40
+ };
41
+
42
+ export type ChecksumConfig = {
43
+ runMode: RunMode;
44
+ apiKey: string;
45
+ baseURL: string;
46
+ username?: string;
47
+ password?: string;
48
+ options?: RuntimeOptions;
49
+
50
+ apiURL: string;
51
+ uploadAgentHOST: string;
52
+ uploadAgentPort: number;
53
+ };
54
+
55
+ export type TestSuiteSession = {
56
+ uuid: string;
57
+ uploadURL: string;
58
+ };