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