testdriverai 5.7.7 → 5.7.9

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,4 +1,10 @@
1
- name: TestDriver.ai / Run / Regressions
1
+ name: TestDriver.ai
2
+
3
+ permissions:
4
+ actions: read
5
+ contents: read
6
+ statuses: write
7
+ pull-requests: write
2
8
 
3
9
  on:
4
10
  push:
@@ -6,17 +12,11 @@ on:
6
12
  pull_request:
7
13
  workflow_dispatch:
8
14
  schedule:
9
- - cron: '0 13 * * *' # Every day at 1 PM UTC (adjust if needed for timezone)
10
-
11
- permissions:
12
- actions: read
13
- contents: read
14
- statuses: write
15
- pull-requests: write
15
+ - cron: "0 0 * * *"
16
16
 
17
17
  jobs:
18
18
  gather-test-files:
19
- name: Setup Test Matrix (./testdriver/*.yml)
19
+ name: Gather Test Files
20
20
  runs-on: ubuntu-latest
21
21
  outputs:
22
22
  test_files: ${{ steps.test_list.outputs.files }}
@@ -25,44 +25,38 @@ jobs:
25
25
  uses: actions/checkout@v2
26
26
  with:
27
27
  ref: ${{ github.event.ref }}
28
+
28
29
  - name: Find all test files and extract filenames
29
30
  id: test_list
30
31
  run: |
31
- FILES=$(ls ./testdriver/*.yml)
32
+ FILES=$(ls ./testdriver/*.yaml)
32
33
  FILENAMES=$(basename -a $FILES)
33
34
  FILES_JSON=$(echo "$FILENAMES" | jq -R -s -c 'split("\n")[:-1]')
34
35
  echo "::set-output name=files::$FILES_JSON"
35
-
36
36
  test:
37
37
  needs: gather-test-files
38
- runs-on: ${{ matrix.os }}
38
+ runs-on: ubuntu-latest
39
39
  strategy:
40
40
  matrix:
41
+ os: [linux, windows]
41
42
  test: ${{ fromJson(needs.gather-test-files.outputs.test_files) }}
42
- os: ['linux', 'windows']
43
43
  fail-fast: false
44
- name: ${{ matrix.test }} (${{ matrix.os }})
44
+ name: ${{ matrix.os }} - ${{ matrix.test }}
45
45
  steps:
46
46
  - name: Check out repository
47
47
  uses: actions/checkout@v2
48
- with:
49
- ref: ${{ github.event.ref }}
50
-
51
- - name: Display filename being tested
52
- run: echo "Running job for file: ${{ matrix.test }} on ${{ matrix.os }}"
53
48
 
54
49
  - uses: testdriverai/action@main
55
50
  with:
56
- key: ${{ secrets.TESTDRIVER_API_KEY }}
57
- os: ${{ matrix.os }}
58
- version: "5.2.3"
59
- prompt: 1. /run testdriver/${{ matrix.test }}
51
+ os: ${{ contains(matrix.os, 'windows') && 'windows' || 'linux' }}
52
+ version: "alpha"
60
53
  prerun: |
61
- cd $env:TEMP
62
- npm init -y
63
- npm install dashcam-chrome
64
- Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "--start-maximized", "--load-extension=$(pwd)/node_modules/dashcam-chrome/build", "${{ env.TD_WEBSITE }}"
65
54
  exit
55
+ key: ${{ secrets.TESTDRIVER_API_KEY }}
56
+ prompt: |
57
+ 1. /run testdriver/${{ matrix.test }}
66
58
  env:
67
59
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68
60
  FORCE_COLOR: "3"
61
+ TD_WEBSITE: "https://testdriver-sandbox.vercel.app"
62
+ WEBSITE_URL: "example.com"
package/agent.js CHANGED
@@ -621,7 +621,7 @@ const generate = async (type, count, baseYaml, skipYaml = false) => {
621
621
  logger.info("");
622
622
 
623
623
  if (baseYaml && !skipYaml) {
624
- await run(baseYaml, false, false);
624
+ await run(baseYaml, false, false, false);
625
625
  }
626
626
 
627
627
  let image = await system.captureScreenBase64();
@@ -1068,7 +1068,7 @@ let runRawYML = async (yml) => {
1068
1068
  // this will load a regression test from a file location
1069
1069
  // it parses the markdown file and executes the codeblocks exactly as if they were
1070
1070
  // generated by the AI in a single prompt
1071
- let run = async (file = thisFile, shouldSave = false, shouldExit = true) => {
1071
+ let run = async (file = thisFile, shouldSave = false, shouldExit = true, pushToHistory = true) => {
1072
1072
  setTerminalWindowTransparency(true);
1073
1073
  emitter.emit(events.interactive, false);
1074
1074
 
@@ -1092,10 +1092,12 @@ let run = async (file = thisFile, shouldSave = false, shouldExit = true) => {
1092
1092
  logger.info(``, null);
1093
1093
  logger.info(chalk.yellow(`> ${step.prompt || "no prompt"}`), null);
1094
1094
 
1095
- executionHistory.push({
1096
- prompt: step.prompt,
1097
- commands: [], // run will overwrite the commands
1098
- });
1095
+ if (pushToHistory) {
1096
+ executionHistory.push({
1097
+ prompt: step.prompt,
1098
+ commands: [], // run will overwrite the commands
1099
+ });
1100
+ }
1099
1101
 
1100
1102
  if (!step.commands && !step.prompt) {
1101
1103
  logger.info(chalk.red("No commands or prompt found"));
@@ -1167,7 +1169,7 @@ const iffy = async (condition, then, otherwise, depth) => {
1167
1169
  const embed = async (file, depth) => {
1168
1170
  analytics.track("embed", { file });
1169
1171
 
1170
- logger.info(generator.jsonToManual({ command: "embed", file }));
1172
+ logger.info(generator.jsonToManual({ command: "run", file }));
1171
1173
 
1172
1174
  depth = depth + 1;
1173
1175
 
@@ -1280,7 +1282,7 @@ const start = async () => {
1280
1282
  } else if (thisCommand == "run") {
1281
1283
  await buildEnv();
1282
1284
  errorLimit = 100;
1283
- run(thisFile);
1285
+ run(thisFile, false, true, true);
1284
1286
  } else if (thisCommand == "init") {
1285
1287
  await init();
1286
1288
  process.exit(0);
@@ -1352,7 +1354,7 @@ const runPrerun = async () => {
1352
1354
  "prerun.yaml",
1353
1355
  );
1354
1356
  if (fs.existsSync(prerunFile)) {
1355
- await run(prerunFile, false, false);
1357
+ await run(prerunFile, false, false, false);
1356
1358
  }
1357
1359
  };
1358
1360
 
package/lib/commands.js CHANGED
@@ -53,7 +53,7 @@ class AiError extends Error {
53
53
  }
54
54
  }
55
55
 
56
- const commandOrControl = platform() === "darwin" ? "command" : "control";
56
+ const commandOrControl = platform() === "mac" ? "command" : "control";
57
57
 
58
58
  const findImageOnScreen = async (relativePath, haystack, restrictToWindow) => {
59
59
  // move the file from filePath to `testdriver/screenshots`
@@ -488,11 +488,19 @@ let commands = {
488
488
  }
489
489
  });
490
490
 
491
+ logger.info(
492
+ chalk.dim(
493
+ `pressing ${keysPressed[0]} with modifiers: ${modsToPress.join(", ")}`,
494
+ ),
495
+ true,
496
+ );
497
+
491
498
  modsToPress.forEach((key) => {
492
499
  robot.keyToggle(key, "down");
493
- });
500
+ })
494
501
 
495
502
  robot.keyTap(keysPressed[0], modsToPress);
503
+
496
504
  } else {
497
505
  await sandbox.send({ type: "press", keys: keysPressed });
498
506
  }
@@ -795,7 +803,7 @@ let commands = {
795
803
  chalk.dim(`running value of \`${plat}\` on this machine...`),
796
804
  true,
797
805
  );
798
- result = await exec(windows_code, { cwd: cwd() });
806
+ result = await exec(windows_code, { cwd: cwd(), shell: "powershell.exe" });
799
807
  } else if (plat == "mac") {
800
808
  logger.info(
801
809
  chalk.dim(`running value of \`${plat}\` on this machine...`),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "5.7.7",
3
+ "version": "5.7.9",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -0,0 +1,7 @@
1
+ version: 5.7.7
2
+ session: 682f5d92811bd5a322c0e636
3
+ steps:
4
+ - prompt: assert the testdriver login page shows
5
+ commands:
6
+ - command: assert
7
+ expect: the TestDriver.ai Sandbox login page is displayed
@@ -0,0 +1,40 @@
1
+ version: 5.7.7
2
+ session: 682f5fc22856e2eb40664269
3
+ steps:
4
+ - prompt: fetch user data from API
5
+ commands:
6
+ - command: exec
7
+ output: user
8
+ lang: js
9
+ linux: >
10
+ const response = await
11
+ fetch('https://jsonplaceholder.typicode.com/users');
12
+
13
+ const user = await response.json();
14
+
15
+ console.log('user', user[0]);
16
+
17
+ result = user[0].email;
18
+ mac: >
19
+ const response = await
20
+ fetch('https://jsonplaceholder.typicode.com/users');
21
+
22
+ const user = await response.json();
23
+
24
+ console.log('user', user[0]);
25
+
26
+ result = user[0].email;
27
+ - command: hover-text
28
+ text: Username
29
+ description: input field for username
30
+ action: click
31
+ - command: type
32
+ text: ${OUTPUT.user}
33
+ - prompt: assert that the username field shows a valid email address
34
+ commands:
35
+ - command: focus-application
36
+ name: Google Chrome
37
+ - command: assert
38
+ expect: >-
39
+ the username field contains "Sincere@april.biz" which is a valid email
40
+ address
@@ -0,0 +1,21 @@
1
+ version: 5.1.1
2
+ session: 67f00511acbd9ccac373edf7
3
+ steps:
4
+ - prompt: launch chrome
5
+ commands:
6
+ - command: exec
7
+ lang: shell
8
+ linux: |
9
+ jumpapp google-chrome --disable-fre --no-default-browser-check --no-first-run "${TD_WEBSITE}" &
10
+ exit
11
+ mac: |
12
+ open -na "Google Chrome" --args --disable-fre --no-default-browser-check --no-first-run --disable-features=PasswordManagerEnabled "${TD_WEBSITE}" &
13
+ exit
14
+ windows:
15
+ Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "--start-maximized", "${TD_WEBSITE}"
16
+ exit
17
+ - command: wait-for-text
18
+ text: ${TD_WEBSITE}
19
+ timeout: 30000
20
+ - command: assert
21
+ expect: Google Chrome is running
@@ -0,0 +1,17 @@
1
+ version: 5.7.7
2
+ session: 682f60bf2856e2eb4066427f
3
+ steps:
4
+ - commands:
5
+ - command: run
6
+ file: testdriver/snippets/login.yaml
7
+ - prompt: click on the image of a shopping cart
8
+ commands:
9
+ - command: focus-application
10
+ name: Google Chrome
11
+ - command: hover-image
12
+ description: shopping cart icon next to the Cart text in the top right corner
13
+ action: click
14
+ - prompt: assert that you see an empty shopping cart
15
+ commands:
16
+ - command: assert
17
+ expect: Your cart is empty
@@ -0,0 +1,28 @@
1
+ version: 5.7.7
2
+ session: 682f62f6811bd5a322c0e726
3
+ steps:
4
+ - commands:
5
+ - command: run
6
+ file: testdriver/snippets/login.yaml
7
+ - prompt: click on add to cart under the testdriver hat
8
+ commands:
9
+ - command: focus-application
10
+ name: Google Chrome
11
+ - command: hover-text
12
+ text: Add to Cart
13
+ description: add to cart button under TestDriver Hat
14
+ action: click
15
+ - prompt: click on the cart
16
+ commands:
17
+ - command: focus-application
18
+ name: Google Chrome
19
+ - command: hover-text
20
+ text: Cart
21
+ description: cart button in the top right corner
22
+ action: click
23
+ - prompt: assert the testdriver hat is in the cart
24
+ commands:
25
+ - command: focus-application
26
+ name: Google Chrome
27
+ - command: assert
28
+ expect: TestDriver Hat is in the cart
@@ -0,0 +1,13 @@
1
+ version: 5.7.7
2
+ session: 682f5aab811bd5a322c0e5a1
3
+ steps:
4
+ - prompt: click on sign in
5
+ commands:
6
+ - command: focus-application
7
+ name: Google Chrome
8
+ - command: hover-text
9
+ text: Sign In
10
+ description: black button below the password field
11
+ action: click
12
+ - command: assert
13
+ expect: an error shows that fields are required
@@ -0,0 +1,19 @@
1
+ version: 5.1.1
2
+ session: 67f00511acbd9ccac373edf7
3
+ steps:
4
+ - prompt: launch chrome
5
+ commands:
6
+ - command: exec
7
+ lang: shell
8
+ linux: |
9
+ jumpapp google-chrome --disable-fre --no-default-browser-check --no-first-run "${TD_WEBSITE}" &
10
+ exit
11
+ mac: |
12
+ open -na "Google Chrome" --args --disable-fre --no-default-browser-check --no-first-run --disable-features=PasswordManagerEnabled "${TD_WEBSITE}" &
13
+ exit
14
+ windows:
15
+ Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "--start-maximized", "${TD_WEBSITE}"
16
+ exit
17
+ - command: wait-for-text
18
+ text: ${TD_WEBSITE}
19
+ timeout: 30000
@@ -0,0 +1,15 @@
1
+ version: 5.7.7
2
+ session: 682f5d92811bd5a322c0e636
3
+ steps:
4
+ - commands:
5
+ - command: run
6
+ file: testdriver/snippets/login.yaml
7
+ - prompt: assert the testdriver login page shows
8
+ commands:
9
+ - command: match-image
10
+ path: cart.png
11
+ action: click
12
+ - prompt: assert that you see an empty shopping cart
13
+ commands:
14
+ - command: assert
15
+ expect: Your cart is empty
@@ -0,0 +1,13 @@
1
+ version: 5.7.7
2
+ session: 682f645a2856e2eb406642f8
3
+ steps:
4
+ - prompt: press command d
5
+ commands:
6
+ - command: focus-application
7
+ name: Google Chrome
8
+ - command: press-keys
9
+ keys:
10
+ - command
11
+ - d
12
+ - command: assert
13
+ expect: the bookmark dialog is open
@@ -1,16 +1,7 @@
1
- version: 5.6.2
2
- session: 681cdec532fef6c6f161c4a4
1
+ version: 5.7.7
2
+ session: 682f66241f5b5f003ee139cb
3
3
  steps:
4
- - prompt: search for the current track in spotify
4
+ - prompt: remember the username of the user who cannot login
5
5
  commands:
6
6
  - command: focus-application
7
- name: spotify
8
- - command: remember
9
- output: track
10
- description: the track now playing in spotify
11
- - command: hover-text
12
- text: What do you want to play?
13
- description: the spotify search bar
14
- action: click
15
- - command: type
16
- text: ${OUTPUT.track}
7
+ name: Google Chrome
@@ -0,0 +1,20 @@
1
+ version: 5.7.7
2
+ session: 682f62a1811bd5a322c0e70b
3
+ steps:
4
+ - commands:
5
+ - command: run
6
+ file: testdriver/snippets/login.yaml
7
+ - prompt: scroll until text testdriver socks
8
+ commands:
9
+ - command: focus-application
10
+ name: Google Chrome
11
+ - command: scroll-until-text
12
+ text: testdriver socks
13
+ direction: down
14
+ method: keyboard
15
+ - prompt: assert testdriver socks appears on screen
16
+ commands:
17
+ - command: focus-application
18
+ name: Google Chrome
19
+ - command: assert
20
+ expect: TestDriver Socks appears on screen
@@ -0,0 +1,23 @@
1
+ version: 5.7.7
2
+ session: 682f6071811bd5a322c0e6dd
3
+ steps:
4
+ - prompt: log into the app
5
+ commands:
6
+ - command: focus-application
7
+ name: Google Chrome
8
+ - command: hover-text
9
+ text: Username
10
+ description: username input field
11
+ action: click
12
+ - command: type
13
+ text: standard_user
14
+ - command: hover-text
15
+ text: Password
16
+ description: password input field
17
+ action: click
18
+ - command: type
19
+ text: secret_password
20
+ - command: hover-text
21
+ text: Sign in
22
+ description: sign in button
23
+ action: click
@@ -0,0 +1,29 @@
1
+ version: 5.7.7
2
+ session: 682f5c4c811bd5a322c0e5c1
3
+ steps:
4
+ - prompt: enter standard_user within the username field
5
+ commands:
6
+ - command: focus-application
7
+ name: Google Chrome
8
+ - command: hover-text
9
+ text: Username
10
+ description: input field for username
11
+ action: click
12
+ - command: type
13
+ text: standard_user
14
+ - prompt: assert that standard_user shows in the username field
15
+ commands:
16
+ - command: assert
17
+ expect: the username field contains "standard_user"
18
+ - prompt: click on sign in
19
+ commands:
20
+ - command: hover-text
21
+ text: Sign in
22
+ description: black button below the password field
23
+ action: click
24
+ - prompt: assert that "please fill out this field" shows in the password field
25
+ commands:
26
+ - command: focus-application
27
+ name: Google Chrome
28
+ - command: assert
29
+ expect: Please fill out this field is visible near the password field
@@ -1,15 +0,0 @@
1
- version: 5.6.5
2
- session: 682a09d01e7bdbd8dadde346
3
- steps:
4
- - prompt: focus chrome
5
- commands:
6
- - command: focus-application
7
- name: Google Chrome
8
- - prompt: focus chrome
9
- commands:
10
- - command: focus-application
11
- name: Google Chrome
12
- - prompt: focus chrome
13
- commands:
14
- - command: focus-application
15
- name: Google Chrome
@@ -1,25 +0,0 @@
1
- version: 5.7.0
2
- session: 682a077a1e7bdbd8dadde32f
3
- steps:
4
- - prompt: open chrome
5
- commands:
6
- - command: press-keys
7
- keys:
8
- - command
9
- - space
10
- - command: type
11
- text: Google Chrome
12
- - command: press-keys
13
- keys:
14
- - enter
15
- - prompt: search for youtube
16
- commands:
17
- - command: press-keys
18
- keys:
19
- - command
20
- - space
21
- - command: type
22
- text: Google Chrome
23
- - command: press-keys
24
- keys:
25
- - enter
@@ -1,5 +0,0 @@
1
- version: 5.6.2
2
- session: 681cdec532fef6c6f161c4a4
3
- steps:
4
- - prompt: focus spotify
5
- - prompt: focus chrome
@@ -1,7 +0,0 @@
1
- version: 5.6.6
2
- session: 6824e7ff58a65c2836a75af3
3
- steps:
4
- - prompt: log in
5
- commands:
6
- - command: focus-application
7
- name: Google Chrome
@@ -1,7 +0,0 @@
1
- version: 5.6.6
2
- session: 6824e81ca8c2f5886f8c8eb8
3
- steps:
4
- - prompt: log in
5
- commands:
6
- - command: focus-application
7
- name: Google Chrome