testdriverai 5.7.9 → 5.7.11
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/.github/workflows/testdriver.yml +68 -11
- package/README.md +0 -2
- package/electron/overlay.js +13 -12
- package/index.js +1 -1
- package/lib/overlay.js +7 -2
- package/package.json +1 -1
- package/testdriver/exec-js.yaml +9 -0
- package/testdriver/lifecycle/prerun.yaml +4 -4
- package/testdriver/press-keys.yaml +3 -3
- package/testdriver/screenshots/cart.png +0 -0
- package/testdriver/screenshots/linux/cart.png +0 -0
- package/testdriver/screenshots/mac/cart.png +0 -0
- package/testdriver/screenshots/windows/cart.png +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
name: TestDriver.ai
|
|
2
2
|
|
|
3
3
|
permissions:
|
|
4
|
+
contents: write
|
|
5
|
+
pull-requests: write
|
|
4
6
|
actions: read
|
|
5
|
-
contents: read
|
|
6
7
|
statuses: write
|
|
7
|
-
pull-requests: write
|
|
8
8
|
|
|
9
9
|
on:
|
|
10
10
|
push:
|
|
@@ -12,7 +12,7 @@ on:
|
|
|
12
12
|
pull_request:
|
|
13
13
|
workflow_dispatch:
|
|
14
14
|
schedule:
|
|
15
|
-
- cron: "0 0 * * *"
|
|
15
|
+
- cron: "0 0 * * *"
|
|
16
16
|
|
|
17
17
|
jobs:
|
|
18
18
|
gather-test-files:
|
|
@@ -23,17 +23,17 @@ jobs:
|
|
|
23
23
|
steps:
|
|
24
24
|
- name: Check out repository
|
|
25
25
|
uses: actions/checkout@v2
|
|
26
|
-
with:
|
|
27
|
-
ref: ${{ github.event.ref }}
|
|
28
26
|
|
|
29
|
-
- name: Find all test files
|
|
27
|
+
- name: Find all test files
|
|
30
28
|
id: test_list
|
|
31
29
|
run: |
|
|
32
30
|
FILES=$(ls ./testdriver/*.yaml)
|
|
33
31
|
FILENAMES=$(basename -a $FILES)
|
|
34
32
|
FILES_JSON=$(echo "$FILENAMES" | jq -R -s -c 'split("\n")[:-1]')
|
|
35
|
-
echo "
|
|
36
|
-
|
|
33
|
+
echo "files=$FILES_JSON" >> $GITHUB_OUTPUT
|
|
34
|
+
|
|
35
|
+
run-tests:
|
|
36
|
+
name: Run Tests
|
|
37
37
|
needs: gather-test-files
|
|
38
38
|
runs-on: ubuntu-latest
|
|
39
39
|
strategy:
|
|
@@ -41,12 +41,13 @@ jobs:
|
|
|
41
41
|
os: [linux, windows]
|
|
42
42
|
test: ${{ fromJson(needs.gather-test-files.outputs.test_files) }}
|
|
43
43
|
fail-fast: false
|
|
44
|
-
name: ${{ matrix.os }} - ${{ matrix.test }}
|
|
45
44
|
steps:
|
|
46
45
|
- name: Check out repository
|
|
47
46
|
uses: actions/checkout@v2
|
|
48
47
|
|
|
49
|
-
-
|
|
48
|
+
- name: Run TestDriver
|
|
49
|
+
id: testdriver
|
|
50
|
+
uses: testdriverai/action@main
|
|
50
51
|
with:
|
|
51
52
|
os: ${{ contains(matrix.os, 'windows') && 'windows' || 'linux' }}
|
|
52
53
|
version: "alpha"
|
|
@@ -59,4 +60,60 @@ jobs:
|
|
|
59
60
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
60
61
|
FORCE_COLOR: "3"
|
|
61
62
|
TD_WEBSITE: "https://testdriver-sandbox.vercel.app"
|
|
62
|
-
|
|
63
|
+
TD_VM_RESOLUTION: "1920x1080"
|
|
64
|
+
|
|
65
|
+
- name: Write MDX to shared snippets dir
|
|
66
|
+
run: |
|
|
67
|
+
mkdir -p snippets
|
|
68
|
+
FILE_NAME=$(basename "${{ matrix.test }}")
|
|
69
|
+
TEST_FILE="testdriver/$FILE_NAME"
|
|
70
|
+
DEST_FILE="snippets/${{ matrix.os }}-${FILE_NAME}.mdx"
|
|
71
|
+
|
|
72
|
+
URL="${{ steps.testdriver.outputs.link }}"
|
|
73
|
+
PARAMS="embed=true×tamp=60000&playbackRate=2"
|
|
74
|
+
|
|
75
|
+
if [[ "$URL" == *\?* ]]; then
|
|
76
|
+
EMBED_URL="${URL}&${PARAMS}"
|
|
77
|
+
else
|
|
78
|
+
EMBED_URL="${URL}?${PARAMS}"
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
echo "<iframe src=\"$EMBED_URL\" />" > "$DEST_FILE"
|
|
82
|
+
echo >> "$DEST_FILE"
|
|
83
|
+
echo '```yaml' >> "$DEST_FILE"
|
|
84
|
+
cat "$TEST_FILE" >> "$DEST_FILE"
|
|
85
|
+
echo '```' >> "$DEST_FILE"
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
- name: Upload snippets artifact
|
|
89
|
+
uses: actions/upload-artifact@v4
|
|
90
|
+
with:
|
|
91
|
+
name: snippets-${{ matrix.os }}-${{ matrix.test }}
|
|
92
|
+
path: snippets/
|
|
93
|
+
retention-days: 1
|
|
94
|
+
|
|
95
|
+
create-snippets-commit:
|
|
96
|
+
name: Commit Snippets
|
|
97
|
+
needs: run-tests
|
|
98
|
+
runs-on: ubuntu-latest
|
|
99
|
+
if: github.event_name != 'pull_request'
|
|
100
|
+
steps:
|
|
101
|
+
- name: Check out current branch
|
|
102
|
+
uses: actions/checkout@v3
|
|
103
|
+
with:
|
|
104
|
+
ref: ${{ github.ref }}
|
|
105
|
+
|
|
106
|
+
- name: Download all snippets artifacts
|
|
107
|
+
uses: actions/download-artifact@v4
|
|
108
|
+
with:
|
|
109
|
+
path: docs/snippets/tests
|
|
110
|
+
pattern: snippets-*
|
|
111
|
+
merge-multiple: true
|
|
112
|
+
|
|
113
|
+
- name: Commit updated snippets
|
|
114
|
+
run: |
|
|
115
|
+
git config --global user.name 'github-actions[bot]'
|
|
116
|
+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
117
|
+
git add docs/snippets/tests
|
|
118
|
+
git diff --cached --quiet && echo "No changes to commit" || git commit -m "Update test snippets [skip ci]"
|
|
119
|
+
git push
|
package/README.md
CHANGED
package/electron/overlay.js
CHANGED
|
@@ -15,8 +15,7 @@ let tray = null;
|
|
|
15
15
|
|
|
16
16
|
const app = electronApp || remote;
|
|
17
17
|
if (!app) {
|
|
18
|
-
|
|
19
|
-
process.exit(1);
|
|
18
|
+
exit(1, "No Electron app");
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
// Seems like the direct process id is not the electron process id
|
|
@@ -115,7 +114,7 @@ app.whenReady().then(() => {
|
|
|
115
114
|
// window.webContents.openDevTools();
|
|
116
115
|
|
|
117
116
|
ipc.serve(() => {
|
|
118
|
-
console.
|
|
117
|
+
console.error("Serving IPC");
|
|
119
118
|
for (const event of eventsArray) {
|
|
120
119
|
ipc.server.on(event, (data) => {
|
|
121
120
|
if (event === "show-window") {
|
|
@@ -132,33 +131,35 @@ app.whenReady().then(() => {
|
|
|
132
131
|
// overlay processes alive
|
|
133
132
|
const timeout = setTimeout(
|
|
134
133
|
() => {
|
|
135
|
-
|
|
136
|
-
process.exit(0);
|
|
134
|
+
exit(0, "IPC No connected clients for 5 minutes");
|
|
137
135
|
},
|
|
138
136
|
1000 * 60 * 5,
|
|
139
137
|
);
|
|
140
138
|
|
|
141
139
|
ipc.server.on("connect", () => {
|
|
142
|
-
console.
|
|
140
|
+
console.error("Client connected");
|
|
143
141
|
clearTimeout(timeout);
|
|
144
142
|
});
|
|
145
143
|
|
|
146
144
|
ipc.server.on("socket.disconnected", function () {
|
|
147
145
|
// We exit because we want the renderer process to be single use
|
|
148
146
|
// and not stay alive if the cli gets disconnected
|
|
149
|
-
|
|
150
|
-
process.exit();
|
|
147
|
+
exit(0, "IPC Client disconnected");
|
|
151
148
|
});
|
|
152
149
|
|
|
153
150
|
ipc.server.on("error", () => {
|
|
154
|
-
|
|
155
|
-
process.exit(1);
|
|
151
|
+
exit(1, "IPC Server error");
|
|
156
152
|
});
|
|
157
153
|
|
|
158
154
|
ipc.server.on("destroy", () => {
|
|
159
|
-
|
|
160
|
-
process.exit(1);
|
|
155
|
+
exit(1, "IPC Server destroyed");
|
|
161
156
|
});
|
|
162
157
|
|
|
163
158
|
ipc.server.start();
|
|
164
159
|
});
|
|
160
|
+
|
|
161
|
+
function exit(code = 0, reason = "") {
|
|
162
|
+
console.error(`Exiting with code ${code} and reason: "${reason}"`);
|
|
163
|
+
console.log(`Exiting with code ${code} and reason: "${reason}"`);
|
|
164
|
+
process.exit(code);
|
|
165
|
+
}
|
package/index.js
CHANGED
|
@@ -33,7 +33,7 @@ if (process.argv[2] === "--renderer") {
|
|
|
33
33
|
detached: true,
|
|
34
34
|
});
|
|
35
35
|
logger.info(`Started renderer, process ID: ${electronProcess.pid}`);
|
|
36
|
-
process.exit(0);
|
|
36
|
+
setTimeout(() => process.exit(0), 200);
|
|
37
37
|
} catch (err) {
|
|
38
38
|
logger.error("%s", err);
|
|
39
39
|
process.exit(1);
|
package/lib/overlay.js
CHANGED
|
@@ -24,7 +24,7 @@ module.exports.createOverlayProcess = ({ id, detached = false } = {}) => {
|
|
|
24
24
|
|
|
25
25
|
// Fork the Electron process with overlay.js as an argument
|
|
26
26
|
electronProcess = fork(electronCliPath, args, {
|
|
27
|
-
stdio: "
|
|
27
|
+
stdio: "pipe",
|
|
28
28
|
env: {
|
|
29
29
|
...process.env,
|
|
30
30
|
TD_OVERLAY_ID: id,
|
|
@@ -36,7 +36,12 @@ module.exports.createOverlayProcess = ({ id, detached = false } = {}) => {
|
|
|
36
36
|
throw error;
|
|
37
37
|
}
|
|
38
38
|
return new Promise((resolve, reject) => {
|
|
39
|
-
electronProcess.on("spawn", () =>
|
|
39
|
+
electronProcess.on("spawn", () => {
|
|
40
|
+
electronProcess.stdout.on("data", (data) => {
|
|
41
|
+
logger.info(`ELECTRON: ${data.toString()}`);
|
|
42
|
+
});
|
|
43
|
+
resolve(electronProcess);
|
|
44
|
+
});
|
|
40
45
|
electronProcess.on("error", reject);
|
|
41
46
|
electronProcess.on("exit", (code) => {
|
|
42
47
|
reject(new Error(`Electron process exited with code ${code}`));
|
package/package.json
CHANGED
package/testdriver/exec-js.yaml
CHANGED
|
@@ -23,6 +23,15 @@ steps:
|
|
|
23
23
|
|
|
24
24
|
console.log('user', user[0]);
|
|
25
25
|
|
|
26
|
+
result = user[0].email;
|
|
27
|
+
windows: >
|
|
28
|
+
const response = await
|
|
29
|
+
fetch('https://jsonplaceholder.typicode.com/users');
|
|
30
|
+
|
|
31
|
+
const user = await response.json();
|
|
32
|
+
|
|
33
|
+
console.log('user', user[0]);
|
|
34
|
+
|
|
26
35
|
result = user[0].email;
|
|
27
36
|
- command: hover-text
|
|
28
37
|
text: Username
|
|
@@ -6,13 +6,13 @@ steps:
|
|
|
6
6
|
- command: exec
|
|
7
7
|
lang: shell
|
|
8
8
|
linux: |
|
|
9
|
-
jumpapp google-chrome --disable-fre --no-default-browser-check --no-first-run "${TD_WEBSITE}" &
|
|
9
|
+
jumpapp google-chrome --disable-fre --no-default-browser-check --no-first-run --guest "${TD_WEBSITE}" &
|
|
10
10
|
exit
|
|
11
11
|
mac: |
|
|
12
|
-
open -na "Google Chrome" --args --disable-fre --no-default-browser-check --no-first-run --
|
|
12
|
+
open -na "Google Chrome" --args --disable-fre --no-default-browser-check --no-first-run --guest "${TD_WEBSITE}" &
|
|
13
13
|
exit
|
|
14
|
-
windows:
|
|
15
|
-
Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "--start-maximized", "${TD_WEBSITE}"
|
|
14
|
+
windows: |
|
|
15
|
+
Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "--start-maximized --disable-fre --no-default-browser-check --no-first-run --guest", "${TD_WEBSITE}";
|
|
16
16
|
exit
|
|
17
17
|
- command: wait-for-text
|
|
18
18
|
text: ${TD_WEBSITE}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
version: 5.7.7
|
|
2
2
|
session: 682f645a2856e2eb406642f8
|
|
3
3
|
steps:
|
|
4
|
-
- prompt:
|
|
4
|
+
- prompt: create a new tab
|
|
5
5
|
commands:
|
|
6
6
|
- command: focus-application
|
|
7
7
|
name: Google Chrome
|
|
8
8
|
- command: press-keys
|
|
9
9
|
keys:
|
|
10
10
|
- command
|
|
11
|
-
-
|
|
11
|
+
- t
|
|
12
12
|
- command: assert
|
|
13
|
-
expect:
|
|
13
|
+
expect: a new tab was created
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|