testdriverai 7.2.55 → 7.2.57
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/.env.example +2 -0
- package/.github/workflows/acceptance-windows-scheduled.yaml +29 -28
- package/.github/workflows/acceptance.yaml +54 -52
- package/.github/workflows/testdriver.yml +157 -156
- package/.github/workflows/windows-self-hosted.yaml +60 -46
- package/docs/docs.json +1 -0
- package/docs/v7/captcha.mdx +160 -0
- package/examples/captcha-api.test.mjs +50 -0
- package/examples/hover-text-with-description.test.mjs +9 -6
- package/interfaces/cli/commands/init.js +48 -21
- package/lib/captcha/solver.js +296 -0
- package/lib/core/Dashcam.js +135 -95
- package/lib/vitest/hooks.mjs +175 -126
- package/lib/vitest/setup-aws.mjs +69 -46
- package/package.json +1 -1
- package/sdk.d.ts +67 -20
- package/sdk.js +733 -402
- package/test/captcha-solver.test.mjs +70 -0
- package/test/chrome-remote-debugging.test.mjs +66 -0
- package/vitest.config.mjs +10 -6
package/.env.example
CHANGED
|
@@ -7,7 +7,7 @@ permissions:
|
|
|
7
7
|
on:
|
|
8
8
|
schedule:
|
|
9
9
|
# Every day at midnight UTC
|
|
10
|
-
- cron:
|
|
10
|
+
- cron: "0 0 * * *"
|
|
11
11
|
workflow_dispatch: # Allow manual trigger
|
|
12
12
|
|
|
13
13
|
jobs:
|
|
@@ -15,6 +15,7 @@ jobs:
|
|
|
15
15
|
uses: ./.github/workflows/windows-self-hosted.yaml
|
|
16
16
|
secrets:
|
|
17
17
|
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
18
|
+
TWOCAPTCHA_API_KEY: ${{ secrets.TWOCAPTCHA_API_KEY }}
|
|
18
19
|
TD_WEBSITE: ${{ secrets.TD_WEBSITE }}
|
|
19
20
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
20
21
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
@@ -23,31 +24,31 @@ jobs:
|
|
|
23
24
|
needs: test-windows
|
|
24
25
|
runs-on: ubuntu-latest
|
|
25
26
|
if: always()
|
|
26
|
-
|
|
27
|
+
|
|
27
28
|
steps:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
29
|
+
- name: Install Sentry CLI
|
|
30
|
+
run: npm install -g @sentry/cli
|
|
31
|
+
|
|
32
|
+
- name: Report to Sentry Cron
|
|
33
|
+
run: |
|
|
34
|
+
sentry-cli monitors run testdriver-windows-acceptance -- echo "Windows tests completed"
|
|
35
|
+
env:
|
|
36
|
+
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
|
37
|
+
|
|
38
|
+
- name: Download test results
|
|
39
|
+
uses: actions/download-artifact@v4
|
|
40
|
+
with:
|
|
41
|
+
name: test-results-windows
|
|
42
|
+
|
|
43
|
+
- name: Upload test results to Sentry Prevent
|
|
44
|
+
if: ${{ !cancelled() }}
|
|
45
|
+
uses: getsentry/prevent-action@v0
|
|
46
|
+
with:
|
|
47
|
+
token: ${{ secrets.SENTRY_PREVENT_TOKEN }}
|
|
48
|
+
|
|
49
|
+
- name: Publish Test Results
|
|
50
|
+
uses: EnricoMi/publish-unit-test-result-action@v2
|
|
51
|
+
if: always()
|
|
52
|
+
with:
|
|
53
|
+
files: test-report.junit.xml
|
|
54
|
+
check_name: Test Results (Windows Scheduled)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
name: Acceptance Tests
|
|
2
2
|
permissions:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
id-token: write
|
|
4
|
+
contents: write
|
|
5
|
+
pull-requests: write
|
|
6
|
+
checks: write
|
|
7
7
|
on:
|
|
8
8
|
pull_request:
|
|
9
|
-
branches: [
|
|
9
|
+
branches: [main]
|
|
10
10
|
|
|
11
11
|
concurrency:
|
|
12
12
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
@@ -15,46 +15,48 @@ concurrency:
|
|
|
15
15
|
jobs:
|
|
16
16
|
test-linux:
|
|
17
17
|
runs-on: ubuntu-latest
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
steps:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- name: Run Linux tests
|
|
32
|
-
run: npx vitest run examples/*.test.mjs
|
|
33
|
-
env:
|
|
34
|
-
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
35
|
-
TD_OS: linux
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Setup Node.js
|
|
23
|
+
uses: actions/setup-node@v4
|
|
24
|
+
with:
|
|
25
|
+
node-version: "20"
|
|
26
|
+
cache: "npm"
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: npm ci
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
- name: Run Linux tests
|
|
32
|
+
run: npx vitest run examples/*.test.mjs
|
|
33
|
+
env:
|
|
34
|
+
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
35
|
+
TWOCAPTCHA_API_KEY: ${{ secrets.TWOCAPTCHA_API_KEY }}
|
|
36
|
+
TD_OS: linux
|
|
42
37
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
- name: Upload test results to Sentry Prevent
|
|
39
|
+
if: ${{ !cancelled() }}
|
|
40
|
+
uses: getsentry/prevent-action@v0
|
|
41
|
+
with:
|
|
42
|
+
token: ${{ secrets.SENTRY_PREVENT_TOKEN }}
|
|
43
|
+
|
|
44
|
+
- name: Publish Test Results
|
|
45
|
+
uses: EnricoMi/publish-unit-test-result-action@v2
|
|
46
|
+
if: always()
|
|
47
|
+
with:
|
|
48
|
+
files: test-report.junit.xml
|
|
49
|
+
comment_mode: always
|
|
50
|
+
check_name: Test Results (Linux)
|
|
50
51
|
|
|
51
52
|
test-windows:
|
|
52
53
|
if: contains(github.event.pull_request.labels.*.name, 'test-windows')
|
|
53
54
|
uses: ./.github/workflows/windows-self-hosted.yaml
|
|
54
55
|
with:
|
|
55
|
-
test_pattern:
|
|
56
|
+
test_pattern: "examples/*.test.mjs"
|
|
56
57
|
secrets:
|
|
57
58
|
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
59
|
+
TWOCAPTCHA_API_KEY: ${{ secrets.TWOCAPTCHA_API_KEY }}
|
|
58
60
|
TD_WEBSITE: ${{ secrets.TD_WEBSITE }}
|
|
59
61
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
60
62
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
@@ -63,23 +65,23 @@ jobs:
|
|
|
63
65
|
needs: test-windows
|
|
64
66
|
runs-on: ubuntu-latest
|
|
65
67
|
if: always() && contains(github.event.pull_request.labels.*.name, 'test-windows')
|
|
66
|
-
|
|
68
|
+
|
|
67
69
|
steps:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
- name: Download test results
|
|
71
|
+
uses: actions/download-artifact@v4
|
|
72
|
+
with:
|
|
73
|
+
name: test-results-windows
|
|
72
74
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
- name: Upload test results to Sentry Prevent
|
|
76
|
+
if: ${{ !cancelled() }}
|
|
77
|
+
uses: getsentry/prevent-action@v0
|
|
78
|
+
with:
|
|
79
|
+
token: ${{ secrets.SENTRY_PREVENT_TOKEN }}
|
|
78
80
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
- name: Publish Test Results
|
|
82
|
+
uses: EnricoMi/publish-unit-test-result-action@v2
|
|
83
|
+
if: always()
|
|
84
|
+
with:
|
|
85
|
+
files: test-report.junit.xml
|
|
86
|
+
comment_mode: always
|
|
87
|
+
check_name: Test Results (Windows)
|
|
@@ -2,168 +2,169 @@ name: TestDriver.ai Tests
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
branches: [
|
|
5
|
+
branches: [main, master]
|
|
6
6
|
pull_request:
|
|
7
|
-
branches: [
|
|
7
|
+
branches: [main, master]
|
|
8
8
|
|
|
9
9
|
jobs:
|
|
10
10
|
test:
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
permissions:
|
|
14
14
|
contents: read
|
|
15
|
-
pull-requests: write
|
|
15
|
+
pull-requests: write # Required to post comments on PRs
|
|
16
16
|
|
|
17
17
|
steps:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Setup Node.js
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: "20"
|
|
24
|
+
cache: "npm"
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: npm ci
|
|
28
|
+
|
|
29
|
+
- name: Run TestDriver.ai tests
|
|
30
|
+
env:
|
|
31
|
+
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
32
|
+
TWOCAPTCHA_API_KEY: ${{ secrets.TWOCAPTCHA_API_KEY }}
|
|
33
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
34
|
+
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
35
|
+
run: npx vitest run
|
|
36
|
+
|
|
37
|
+
- name: Upload test results
|
|
38
|
+
if: always()
|
|
39
|
+
uses: actions/upload-artifact@v4
|
|
40
|
+
with:
|
|
41
|
+
name: test-results
|
|
42
|
+
path: test-results/
|
|
43
|
+
retention-days: 30
|
|
44
|
+
|
|
45
|
+
# Init command test - only runs on PRs, not on main/master
|
|
46
|
+
- name: Create test directory for init
|
|
47
|
+
if: github.event_name == 'pull_request'
|
|
48
|
+
run: |
|
|
49
|
+
mkdir -p /tmp/test-init-project
|
|
50
|
+
cd /tmp/test-init-project
|
|
51
|
+
|
|
52
|
+
- name: Run init command (skip prompts)
|
|
53
|
+
if: github.event_name == 'pull_request'
|
|
54
|
+
working-directory: /tmp/test-init-project
|
|
55
|
+
run: |
|
|
56
|
+
# Create .env with API key first to skip the prompt
|
|
57
|
+
echo "TD_API_KEY=${{ secrets.TD_API_KEY }}" > .env
|
|
58
|
+
|
|
59
|
+
# Run init command using the CLI from the repo
|
|
60
|
+
node ${{ github.workspace }}/bin/testdriverai.js init
|
|
61
|
+
env:
|
|
62
|
+
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
63
|
+
|
|
64
|
+
- name: Verify project structure
|
|
65
|
+
if: github.event_name == 'pull_request'
|
|
66
|
+
working-directory: /tmp/test-init-project
|
|
67
|
+
run: |
|
|
68
|
+
echo "Checking generated files..."
|
|
69
|
+
|
|
70
|
+
# Check for package.json
|
|
71
|
+
if [ ! -f "package.json" ]; then
|
|
72
|
+
echo "❌ package.json not found"
|
|
73
|
+
exit 1
|
|
74
|
+
fi
|
|
75
|
+
echo "✓ package.json exists"
|
|
76
|
+
|
|
77
|
+
# Check for vitest config
|
|
78
|
+
if [ ! -f "vitest.config.js" ]; then
|
|
79
|
+
echo "❌ vitest.config.js not found"
|
|
80
|
+
exit 1
|
|
81
|
+
fi
|
|
82
|
+
echo "✓ vitest.config.js exists"
|
|
83
|
+
|
|
84
|
+
# Check for test file
|
|
85
|
+
if [ ! -f "tests/example.test.js" ]; then
|
|
86
|
+
echo "❌ tests/example.test.js not found"
|
|
87
|
+
exit 1
|
|
88
|
+
fi
|
|
89
|
+
echo "✓ tests/example.test.js exists"
|
|
90
|
+
|
|
91
|
+
# Check for .env file
|
|
92
|
+
if [ ! -f ".env" ]; then
|
|
93
|
+
echo "❌ .env not found"
|
|
94
|
+
exit 1
|
|
95
|
+
fi
|
|
96
|
+
echo "✓ .env exists"
|
|
97
|
+
|
|
98
|
+
# Check for .gitignore
|
|
99
|
+
if [ ! -f ".gitignore" ]; then
|
|
100
|
+
echo "❌ .gitignore not found"
|
|
101
|
+
exit 1
|
|
102
|
+
fi
|
|
103
|
+
echo "✓ .gitignore exists"
|
|
104
|
+
|
|
105
|
+
# Check for GitHub workflow
|
|
106
|
+
if [ ! -f ".github/workflows/testdriver.yml" ]; then
|
|
107
|
+
echo "❌ .github/workflows/testdriver.yml not found"
|
|
108
|
+
exit 1
|
|
109
|
+
fi
|
|
110
|
+
echo "✓ .github/workflows/testdriver.yml exists"
|
|
111
|
+
|
|
112
|
+
- name: Verify vitest config contents
|
|
113
|
+
if: github.event_name == 'pull_request'
|
|
114
|
+
working-directory: /tmp/test-init-project
|
|
115
|
+
run: |
|
|
116
|
+
echo "Checking vitest.config.js contents..."
|
|
117
|
+
|
|
118
|
+
# Check for TestDriver reporter
|
|
119
|
+
if ! grep -q "TestDriver()" vitest.config.js; then
|
|
120
|
+
echo "❌ TestDriver reporter not found in vitest.config.js"
|
|
121
|
+
cat vitest.config.js
|
|
122
|
+
exit 1
|
|
123
|
+
fi
|
|
124
|
+
echo "✓ TestDriver reporter is configured"
|
|
125
|
+
|
|
126
|
+
# Check for setupFiles
|
|
127
|
+
if ! grep -q "setupFiles.*testdriverai/vitest/setup" vitest.config.js; then
|
|
128
|
+
echo "❌ setupFiles not configured correctly"
|
|
129
|
+
cat vitest.config.js
|
|
130
|
+
exit 1
|
|
131
|
+
fi
|
|
132
|
+
echo "✓ setupFiles is configured"
|
|
133
|
+
|
|
134
|
+
- name: Verify test file contents
|
|
135
|
+
if: github.event_name == 'pull_request'
|
|
136
|
+
working-directory: /tmp/test-init-project
|
|
137
|
+
run: |
|
|
138
|
+
echo "Checking test file contents..."
|
|
139
|
+
|
|
140
|
+
# Check for .provision usage
|
|
141
|
+
if ! grep -q "\.provision\.chrome" tests/example.test.js; then
|
|
142
|
+
echo "❌ Test does not use .provision.chrome"
|
|
143
|
+
cat tests/example.test.js
|
|
144
|
+
exit 1
|
|
145
|
+
fi
|
|
146
|
+
echo "✓ Test uses .provision.chrome"
|
|
147
|
+
|
|
148
|
+
# Check for TestDriver import
|
|
149
|
+
if ! grep -q "from 'testdriverai/vitest/hooks'" tests/example.test.js; then
|
|
150
|
+
echo "❌ Test does not import from testdriverai/vitest/hooks"
|
|
151
|
+
cat tests/example.test.js
|
|
152
|
+
exit 1
|
|
153
|
+
fi
|
|
154
|
+
echo "✓ Test imports TestDriver from vitest/hooks"
|
|
155
|
+
|
|
156
|
+
- name: Run the generated test
|
|
157
|
+
if: github.event_name == 'pull_request'
|
|
158
|
+
working-directory: /tmp/test-init-project
|
|
159
|
+
run: npm test
|
|
160
|
+
env:
|
|
161
|
+
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
162
|
+
|
|
163
|
+
- name: Upload init test results
|
|
164
|
+
if: always() && github.event_name == 'pull_request'
|
|
165
|
+
uses: actions/upload-artifact@v4
|
|
166
|
+
with:
|
|
167
|
+
name: test-init-results
|
|
168
|
+
path: /tmp/test-init-project/test-results/
|
|
169
|
+
retention-days: 7
|
|
170
|
+
if-no-files-found: warn
|