testdriverai 7.5.8 → 7.5.10
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/CHANGELOG.md +14 -0
- package/agent/lib/sandbox.js +24 -0
- package/package.json +1 -1
- package/.github/agents/testdriver.agent.md +0 -641
- package/.github/copilot-instructions.md +0 -690
- package/.github/skills/testdriver-ai/SKILL.md +0 -204
- package/.github/skills/testdriver-assert/SKILL.md +0 -315
- package/.github/skills/testdriver-aws-setup/SKILL.md +0 -448
- package/.github/skills/testdriver-caching/SKILL.md +0 -124
- package/.github/skills/testdriver-captcha/SKILL.md +0 -159
- package/.github/skills/testdriver-ci-cd/SKILL.md +0 -602
- package/.github/skills/testdriver-click/SKILL.md +0 -286
- package/.github/skills/testdriver-client/SKILL.md +0 -372
- package/.github/skills/testdriver-cloud/SKILL.md +0 -119
- package/.github/skills/testdriver-customizing-devices/SKILL.md +0 -153
- package/.github/skills/testdriver-dashcam/SKILL.md +0 -418
- package/.github/skills/testdriver-debugging-with-screenshots/SKILL.md +0 -401
- package/.github/skills/testdriver-device-config/SKILL.md +0 -317
- package/.github/skills/testdriver-double-click/SKILL.md +0 -102
- package/.github/skills/testdriver-elements/SKILL.md +0 -605
- package/.github/skills/testdriver-enterprise/SKILL.md +0 -114
- package/.github/skills/testdriver-examples/SKILL.md +0 -7
- package/.github/skills/testdriver-exec/SKILL.md +0 -345
- package/.github/skills/testdriver-find/SKILL.md +0 -829
- package/.github/skills/testdriver-focus-application/SKILL.md +0 -293
- package/.github/skills/testdriver-generating-tests/SKILL.md +0 -36
- package/.github/skills/testdriver-hover/SKILL.md +0 -278
- package/.github/skills/testdriver-locating-elements/SKILL.md +0 -71
- package/.github/skills/testdriver-making-assertions/SKILL.md +0 -32
- package/.github/skills/testdriver-mcp-workflow/SKILL.md +0 -410
- package/.github/skills/testdriver-mouse-down/SKILL.md +0 -161
- package/.github/skills/testdriver-mouse-up/SKILL.md +0 -164
- package/.github/skills/testdriver-parse/SKILL.md +0 -236
- package/.github/skills/testdriver-performing-actions/SKILL.md +0 -54
- package/.github/skills/testdriver-press-keys/SKILL.md +0 -348
- package/.github/skills/testdriver-quickstart/SKILL.md +0 -145
- package/.github/skills/testdriver-reusable-code/SKILL.md +0 -249
- package/.github/skills/testdriver-right-click/SKILL.md +0 -123
- package/.github/skills/testdriver-running-tests/SKILL.md +0 -185
- package/.github/skills/testdriver-screenshot/SKILL.md +0 -248
- package/.github/skills/testdriver-scroll/SKILL.md +0 -335
- package/.github/skills/testdriver-secrets/SKILL.md +0 -115
- package/.github/skills/testdriver-self-hosted/SKILL.md +0 -65
- package/.github/skills/testdriver-test-writer/SKILL.md +0 -451
- package/.github/skills/testdriver-testdriver/SKILL.md +0 -631
- package/.github/skills/testdriver-testdriver-mechanic/SKILL.md +0 -165
- package/.github/skills/testdriver-type/SKILL.md +0 -357
- package/.github/skills/testdriver-variables/SKILL.md +0 -111
- package/.github/skills/testdriver-waiting-for-elements/SKILL.md +0 -88
- package/.github/skills/testdriver-what-is-testdriver/SKILL.md +0 -54
- package/.github/workflows/acceptance-linux-scheduled.yaml +0 -45
- package/.github/workflows/acceptance-windows-scheduled.yaml +0 -59
- package/.github/workflows/acceptance.yaml +0 -108
- package/.github/workflows/publish.yaml +0 -75
- package/.github/workflows/test-init.yml +0 -157
- package/.github/workflows/testdriver.yml +0 -170
- package/.github/workflows/update-examples.yaml +0 -53
- package/.github/workflows/windows-self-hosted.yaml +0 -80
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: testdriver:waiting-for-elements
|
|
3
|
-
description: Handle async operations and prevent flaky tests
|
|
4
|
-
---
|
|
5
|
-
<!-- Generated from waiting-for-elements.mdx. DO NOT EDIT. -->
|
|
6
|
-
|
|
7
|
-
## Waiting for Elements
|
|
8
|
-
|
|
9
|
-
By default, `find()` automatically polls for up to 10 seconds, retrying every 5 seconds until the element is found. This means most elements that appear after short async operations will be found without any extra configuration.
|
|
10
|
-
|
|
11
|
-
For longer operations, increase the `timeout`:
|
|
12
|
-
|
|
13
|
-
```javascript
|
|
14
|
-
// Default behavior - polls for up to 10 seconds automatically
|
|
15
|
-
const element = await testdriver.find('Loading complete indicator');
|
|
16
|
-
await element.click();
|
|
17
|
-
|
|
18
|
-
// Wait up to 30 seconds for slower operations
|
|
19
|
-
const element = await testdriver.find('Loading complete indicator', { timeout: 30000 });
|
|
20
|
-
await element.click();
|
|
21
|
-
|
|
22
|
-
// Useful after actions that trigger loading states
|
|
23
|
-
await testdriver.find('submit button').click();
|
|
24
|
-
await testdriver.find('success message', { timeout: 15000 });
|
|
25
|
-
|
|
26
|
-
// Disable polling for instant checks
|
|
27
|
-
const toast = await testdriver.find('notification toast', { timeout: 0 });
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Flake Prevention
|
|
31
|
-
|
|
32
|
-
TestDriver automatically waits for the screen and network to stabilize after each action using **redraw detection**. This prevents flaky tests caused by animations, loading states, or dynamic content updates.
|
|
33
|
-
|
|
34
|
-
<Note>
|
|
35
|
-
Redraw detection adds a small delay after each action but significantly reduces test flakiness.
|
|
36
|
-
</Note>
|
|
37
|
-
|
|
38
|
-
For example, when clicking a submit button that navigates to a new page:
|
|
39
|
-
|
|
40
|
-
```javascript
|
|
41
|
-
// Click submit - TestDriver automatically waits for the new page to load
|
|
42
|
-
await testdriver.find('submit button').click();
|
|
43
|
-
|
|
44
|
-
// By the time this runs, the page has fully loaded and stabilized
|
|
45
|
-
await testdriver.assert('dashboard is displayed');
|
|
46
|
-
await testdriver.find('welcome message');
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Without redraw detection, you'd need manual waits or retries to handle the page transition. TestDriver handles this automatically by detecting when the screen stops changing and network requests complete.
|
|
50
|
-
|
|
51
|
-
You can disable redraw detection or customize its behavior:
|
|
52
|
-
|
|
53
|
-
```javascript
|
|
54
|
-
// Disable redraw detection for faster tests (less reliable)
|
|
55
|
-
const testdriver = TestDriver(context, {
|
|
56
|
-
redraw: false
|
|
57
|
-
});
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Here is an example of customizing redraw detection:
|
|
61
|
-
|
|
62
|
-
```javascript
|
|
63
|
-
// Fine-tune redraw detection
|
|
64
|
-
const testdriver = TestDriver(context, {
|
|
65
|
-
redraw: {
|
|
66
|
-
enabled: true,
|
|
67
|
-
diffThreshold: 0.1, // Pixel difference threshold (0-1)
|
|
68
|
-
screenRedraw: true, // Monitor screen changes
|
|
69
|
-
networkMonitor: true, // Wait for network idle
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## Simple Delays with `wait()`
|
|
75
|
-
|
|
76
|
-
For simple pauses — waiting for animations, transitions, or state changes after an action — use `wait()`:
|
|
77
|
-
|
|
78
|
-
```javascript
|
|
79
|
-
// Wait for an animation to complete
|
|
80
|
-
await testdriver.find('menu toggle').click();
|
|
81
|
-
await testdriver.wait(2000);
|
|
82
|
-
|
|
83
|
-
// Wait for a page transition to settle
|
|
84
|
-
await testdriver.find('next page button').click();
|
|
85
|
-
await testdriver.wait(1000);
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
For waiting for specific **elements** to appear, prefer `find()` with a `timeout` option. Use `wait()` only for simple time-based pauses.
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: testdriver:what-is-testdriver
|
|
3
|
-
description: Reliably test your most difficult user flows
|
|
4
|
-
---
|
|
5
|
-
<!-- Generated from what-is-testdriver.mdx. DO NOT EDIT. -->
|
|
6
|
-
|
|
7
|
-
## The problem with modern testing tools
|
|
8
|
-
|
|
9
|
-
Modern testing tools like Playwright are designed to test a single web application, running in a single browser tab using selectors.
|
|
10
|
-
|
|
11
|
-
However, selectors are often either unreliable or unavailable in complex scenarios, leading to brittle and flaky tests:
|
|
12
|
-
|
|
13
|
-
| Challenge | Problem | Examples |
|
|
14
|
-
|-----------|---------|----------|
|
|
15
|
-
| **Fast moving teams** | Frequently change UI structure, breaking CSS/XPath selectors | Agile teams, startups, vibe-coders |
|
|
16
|
-
| **Dynamic content** | Cannot be targeted with selectors | AI chatbots, PDFs, images, videos |
|
|
17
|
-
| **Software you don't own** | May lack proper accessibility attributes | Other websites, extensions, third-party applications |
|
|
18
|
-
| **Multi-application workflows** | Cannot be tested with web-only tools | Desktop apps, browser extensions, IDEs |
|
|
19
|
-
| **Visual states** | Impossible to verify with code-based selectors | Charts, graphs, videos, images, spelling errors, UI layout |
|
|
20
|
-
|
|
21
|
-
## The TestDriver Solution
|
|
22
|
-
|
|
23
|
-
TestDriver is a complete testing platform built specifically for handling these scenarios. It consists of a Javascript SDK, hosted infrastructure, and debugging tools that make it easy to write, run, and maintain tests for your most difficult user flows.
|
|
24
|
-
|
|
25
|
-
### Javascript SDK
|
|
26
|
-
|
|
27
|
-
Here is an example of a TestDriver test that installs a production Chrome extension from the Chrome Web Store and verifies that it appears in the extensions menu:
|
|
28
|
-
|
|
29
|
-
```javascript Installing Loom from the Chrome Web Store
|
|
30
|
-
import { describe, expect, it } from "vitest";
|
|
31
|
-
import { TestDriver } from "testdriverai/vitest/hooks";
|
|
32
|
-
|
|
33
|
-
describe("Chrome Extension Test", () => {
|
|
34
|
-
const testdriver = TestDriver(context);
|
|
35
|
-
|
|
36
|
-
// Launch Chrome with Loom loaded by its Chrome Web Store ID
|
|
37
|
-
await testdriver.provision.chromeExtension({
|
|
38
|
-
extensionId: 'liecbddmkiiihnedobmlmillhodjkdmb'
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// Click on the extensions button (puzzle piece icon) in Chrome toolbar
|
|
42
|
-
const extensionsButton = await testdriver.find("The puzzle-shaped icon in the Chrome toolbar.");
|
|
43
|
-
await extensionsButton.click();
|
|
44
|
-
|
|
45
|
-
// Look for Loom in the extensions menu
|
|
46
|
-
const loomExtension = await testdriver.find("Loom extension in the extensions dropdown");
|
|
47
|
-
expect(loomExtension.found()).toBeTruthy();
|
|
48
|
-
});
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<Tip>[vitest](https://vitest.dev/) is the preferred test runner for TestDriver.</Tip>
|
|
53
|
-
|
|
54
|
-
,
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
name: Scheduled Acceptance Tests (Linux)
|
|
2
|
-
|
|
3
|
-
permissions:
|
|
4
|
-
id-token: write
|
|
5
|
-
contents: read
|
|
6
|
-
|
|
7
|
-
on:
|
|
8
|
-
schedule:
|
|
9
|
-
# Every 6 hours
|
|
10
|
-
- cron: "0 */6 * * *"
|
|
11
|
-
workflow_dispatch: # Allow manual trigger
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
test-linux:
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
|
|
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: Install Sentry CLI
|
|
30
|
-
run: npm install -g @sentry/cli
|
|
31
|
-
|
|
32
|
-
- name: Run Linux tests with Sentry Cron monitoring
|
|
33
|
-
run: |
|
|
34
|
-
sentry-cli monitors run testdriver-linux-acceptance -- npx vitest run examples/*.test.mjs
|
|
35
|
-
env:
|
|
36
|
-
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
|
37
|
-
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
38
|
-
TD_OS: linux
|
|
39
|
-
TWOCAPTCHA_API_KEY: ${{ secrets.TWOCAPTCHA_API_KEY }}
|
|
40
|
-
|
|
41
|
-
- name: Upload test results to Sentry Prevent
|
|
42
|
-
if: ${{ !cancelled() }}
|
|
43
|
-
uses: getsentry/prevent-action@v0
|
|
44
|
-
with:
|
|
45
|
-
token: ${{ secrets.SENTRY_PREVENT_TOKEN }}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
name: Scheduled Acceptance Tests (Windows)
|
|
2
|
-
|
|
3
|
-
permissions:
|
|
4
|
-
id-token: write
|
|
5
|
-
contents: read
|
|
6
|
-
|
|
7
|
-
on:
|
|
8
|
-
schedule:
|
|
9
|
-
# Every day at midnight UTC
|
|
10
|
-
- cron: "0 0 * * *"
|
|
11
|
-
workflow_dispatch: # Allow manual trigger
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
test-windows:
|
|
15
|
-
uses: ./.github/workflows/windows-self-hosted.yaml
|
|
16
|
-
secrets:
|
|
17
|
-
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
18
|
-
TWOCAPTCHA_API_KEY: ${{ secrets.TWOCAPTCHA_API_KEY }}
|
|
19
|
-
TD_WEBSITE: ${{ secrets.TD_WEBSITE }}
|
|
20
|
-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
21
|
-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
22
|
-
|
|
23
|
-
sentry-and-publish:
|
|
24
|
-
needs: test-windows
|
|
25
|
-
runs-on: ubuntu-latest
|
|
26
|
-
if: always()
|
|
27
|
-
|
|
28
|
-
steps:
|
|
29
|
-
- name: Install Sentry CLI
|
|
30
|
-
run: npm install -g @sentry/cli
|
|
31
|
-
|
|
32
|
-
- name: Report to Sentry Cron
|
|
33
|
-
continue-on-error: true
|
|
34
|
-
run: |
|
|
35
|
-
if [ "${{ needs.test-windows.result }}" == "success" ]; then
|
|
36
|
-
sentry-cli monitors run testdriver-windows-acceptance -- echo "Windows tests passed"
|
|
37
|
-
else
|
|
38
|
-
sentry-cli monitors run testdriver-windows-acceptance -- bash -c "echo 'Windows tests failed' && exit 1"
|
|
39
|
-
fi
|
|
40
|
-
env:
|
|
41
|
-
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
|
42
|
-
|
|
43
|
-
- name: Download test results
|
|
44
|
-
uses: actions/download-artifact@v4
|
|
45
|
-
with:
|
|
46
|
-
name: test-results-windows
|
|
47
|
-
|
|
48
|
-
- name: Upload test results to Sentry Prevent
|
|
49
|
-
if: ${{ !cancelled() }}
|
|
50
|
-
uses: getsentry/prevent-action@v0
|
|
51
|
-
with:
|
|
52
|
-
token: ${{ secrets.SENTRY_PREVENT_TOKEN }}
|
|
53
|
-
|
|
54
|
-
- name: Publish Test Results
|
|
55
|
-
uses: EnricoMi/publish-unit-test-result-action@v2
|
|
56
|
-
if: always()
|
|
57
|
-
with:
|
|
58
|
-
files: test-report.junit.xml
|
|
59
|
-
check_name: Test Results (Windows Scheduled)
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
name: Acceptance Tests
|
|
2
|
-
permissions:
|
|
3
|
-
id-token: write
|
|
4
|
-
contents: write
|
|
5
|
-
pull-requests: write
|
|
6
|
-
checks: write
|
|
7
|
-
on:
|
|
8
|
-
pull_request:
|
|
9
|
-
branches: [main]
|
|
10
|
-
|
|
11
|
-
concurrency:
|
|
12
|
-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
13
|
-
cancel-in-progress: true
|
|
14
|
-
|
|
15
|
-
jobs:
|
|
16
|
-
test-linux:
|
|
17
|
-
runs-on: testdriver-16
|
|
18
|
-
|
|
19
|
-
steps:
|
|
20
|
-
- uses: actions/checkout@v4
|
|
21
|
-
with:
|
|
22
|
-
ref: ${{ github.head_ref }}
|
|
23
|
-
|
|
24
|
-
- name: Setup Node.js
|
|
25
|
-
uses: actions/setup-node@v4
|
|
26
|
-
with:
|
|
27
|
-
node-version: "20"
|
|
28
|
-
cache: "npm"
|
|
29
|
-
|
|
30
|
-
- name: Install dependencies
|
|
31
|
-
run: npm ci
|
|
32
|
-
|
|
33
|
-
- name: Run Linux tests
|
|
34
|
-
run: set -o pipefail && npx vitest run examples/*.test.mjs --maxWorkers 32 2>&1 | tee test-output.log
|
|
35
|
-
env:
|
|
36
|
-
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
37
|
-
TWOCAPTCHA_API_KEY: ${{ secrets.TWOCAPTCHA_API_KEY }}
|
|
38
|
-
TD_OS: linux
|
|
39
|
-
TD_API_ROOT: https://testdriver-api-pr-242.onrender.com
|
|
40
|
-
|
|
41
|
-
- name: Upload test results to Sentry Prevent
|
|
42
|
-
if: ${{ !cancelled() }}
|
|
43
|
-
uses: getsentry/prevent-action@v0
|
|
44
|
-
with:
|
|
45
|
-
token: ${{ secrets.SENTRY_PREVENT_TOKEN }}
|
|
46
|
-
|
|
47
|
-
- name: Publish Test Results
|
|
48
|
-
uses: EnricoMi/publish-unit-test-result-action@v2
|
|
49
|
-
if: always()
|
|
50
|
-
with:
|
|
51
|
-
files: test-report.junit.xml
|
|
52
|
-
comment_mode: always
|
|
53
|
-
check_name: Test Results (Linux)
|
|
54
|
-
|
|
55
|
-
test-windows:
|
|
56
|
-
if: contains(github.event.pull_request.labels.*.name, 'test-windows')
|
|
57
|
-
uses: ./.github/workflows/windows-self-hosted.yaml
|
|
58
|
-
with:
|
|
59
|
-
test_pattern: "examples/*.test.mjs"
|
|
60
|
-
secrets:
|
|
61
|
-
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
62
|
-
TWOCAPTCHA_API_KEY: ${{ secrets.TWOCAPTCHA_API_KEY }}
|
|
63
|
-
TD_WEBSITE: ${{ secrets.TD_WEBSITE }}
|
|
64
|
-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
65
|
-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
66
|
-
|
|
67
|
-
publish-windows-results:
|
|
68
|
-
needs: test-windows
|
|
69
|
-
runs-on: ubuntu-latest
|
|
70
|
-
if: always() && contains(github.event.pull_request.labels.*.name, 'test-windows')
|
|
71
|
-
|
|
72
|
-
steps:
|
|
73
|
-
- uses: actions/checkout@v4
|
|
74
|
-
with:
|
|
75
|
-
ref: ${{ github.head_ref }}
|
|
76
|
-
|
|
77
|
-
- name: Setup Node.js
|
|
78
|
-
uses: actions/setup-node@v4
|
|
79
|
-
with:
|
|
80
|
-
node-version: "20"
|
|
81
|
-
cache: "npm"
|
|
82
|
-
|
|
83
|
-
- name: Install dependencies
|
|
84
|
-
run: npm ci
|
|
85
|
-
|
|
86
|
-
- name: Download test results
|
|
87
|
-
uses: actions/download-artifact@v4
|
|
88
|
-
with:
|
|
89
|
-
name: test-results-windows
|
|
90
|
-
|
|
91
|
-
- name: Download test output
|
|
92
|
-
uses: actions/download-artifact@v4
|
|
93
|
-
with:
|
|
94
|
-
name: test-output-windows
|
|
95
|
-
|
|
96
|
-
- name: Upload test results to Sentry Prevent
|
|
97
|
-
if: ${{ !cancelled() }}
|
|
98
|
-
uses: getsentry/prevent-action@v0
|
|
99
|
-
with:
|
|
100
|
-
token: ${{ secrets.SENTRY_PREVENT_TOKEN }}
|
|
101
|
-
|
|
102
|
-
- name: Publish Test Results
|
|
103
|
-
uses: EnricoMi/publish-unit-test-result-action@v2
|
|
104
|
-
if: always()
|
|
105
|
-
with:
|
|
106
|
-
files: test-report.junit.xml
|
|
107
|
-
comment_mode: always
|
|
108
|
-
check_name: Test Results (Windows)
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
name: Publish
|
|
2
|
-
permissions:
|
|
3
|
-
contents: write
|
|
4
|
-
id-token: write # Required for OIDC
|
|
5
|
-
on:
|
|
6
|
-
push:
|
|
7
|
-
branches: [main]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
publish:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v4
|
|
15
|
-
with:
|
|
16
|
-
fetch-depth: 0
|
|
17
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
|
18
|
-
|
|
19
|
-
- name: Setup Node.js
|
|
20
|
-
uses: actions/setup-node@v4
|
|
21
|
-
with:
|
|
22
|
-
node-version: "20"
|
|
23
|
-
registry-url: "https://registry.npmjs.org/"
|
|
24
|
-
|
|
25
|
-
- name: Configure Git
|
|
26
|
-
run: |
|
|
27
|
-
git config user.name "github-actions[bot]"
|
|
28
|
-
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
29
|
-
|
|
30
|
-
- name: Install dependencies
|
|
31
|
-
run: npm ci
|
|
32
|
-
|
|
33
|
-
- name: Build MCP Server
|
|
34
|
-
run: npm run build:mcp
|
|
35
|
-
|
|
36
|
-
- name: Bump version (patch)
|
|
37
|
-
run: npm version patch --no-git-tag-version
|
|
38
|
-
|
|
39
|
-
- name: Generate Changelog
|
|
40
|
-
run: |
|
|
41
|
-
npx conventional-changelog-cli -p angular -i CHANGELOG.md -s
|
|
42
|
-
git add CHANGELOG.md
|
|
43
|
-
|
|
44
|
-
- name: Commit and push version bump
|
|
45
|
-
run: |
|
|
46
|
-
git add package.json package-lock.json
|
|
47
|
-
VERSION=$(node -p "require('./package.json').version")
|
|
48
|
-
git commit -m "chore(release): ${VERSION}"
|
|
49
|
-
git tag "v${VERSION}"
|
|
50
|
-
|
|
51
|
-
# Pull any changes that happened since checkout
|
|
52
|
-
git pull --rebase origin main
|
|
53
|
-
|
|
54
|
-
git push origin main
|
|
55
|
-
git push origin "v${VERSION}"
|
|
56
|
-
echo "VERSION=${VERSION}" >> $GITHUB_ENV
|
|
57
|
-
|
|
58
|
-
- name: Create GitHub Release
|
|
59
|
-
uses: softprops/action-gh-release@v1
|
|
60
|
-
with:
|
|
61
|
-
tag_name: v${{ env.VERSION }}
|
|
62
|
-
generate_release_notes: true
|
|
63
|
-
prerelease: false
|
|
64
|
-
|
|
65
|
-
- name: Debug NPM Token
|
|
66
|
-
run: |
|
|
67
|
-
echo "NPM_TOKEN is set: ${{ secrets.NPM_TOKEN != '' }}"
|
|
68
|
-
echo "NPM_TOKEN first 4 chars: ${NPM_TOKEN:0:4}..."
|
|
69
|
-
env:
|
|
70
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
71
|
-
|
|
72
|
-
- name: Publish to npm
|
|
73
|
-
run: npm publish
|
|
74
|
-
env:
|
|
75
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
name: Test Init Command
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ main, develop ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ main, develop ]
|
|
8
|
-
workflow_dispatch:
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
test-init:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
|
|
14
|
-
steps:
|
|
15
|
-
- name: Checkout CLI repository
|
|
16
|
-
uses: actions/checkout@v4
|
|
17
|
-
|
|
18
|
-
- name: Setup Node.js
|
|
19
|
-
uses: actions/setup-node@v4
|
|
20
|
-
with:
|
|
21
|
-
node-version: '20'
|
|
22
|
-
cache: 'npm'
|
|
23
|
-
|
|
24
|
-
- name: Install CLI dependencies
|
|
25
|
-
run: npm ci
|
|
26
|
-
|
|
27
|
-
- name: Pack local testdriverai
|
|
28
|
-
run: |
|
|
29
|
-
npm pack
|
|
30
|
-
mv testdriverai-*.tgz /tmp/testdriverai-local.tgz
|
|
31
|
-
|
|
32
|
-
- name: Create test directory
|
|
33
|
-
run: |
|
|
34
|
-
mkdir -p /tmp/test-init-project
|
|
35
|
-
cd /tmp/test-init-project
|
|
36
|
-
|
|
37
|
-
- name: Run init command (skip prompts)
|
|
38
|
-
working-directory: /tmp/test-init-project
|
|
39
|
-
run: |
|
|
40
|
-
# Create .env with API key first to skip the prompt
|
|
41
|
-
echo "TD_API_KEY=${{ secrets.TD_API_KEY }}" > .env
|
|
42
|
-
|
|
43
|
-
# Run init command using the CLI from the repo
|
|
44
|
-
node ${{ github.workspace }}/bin/testdriverai.js init
|
|
45
|
-
env:
|
|
46
|
-
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
47
|
-
|
|
48
|
-
- name: Replace npm testdriverai with local build
|
|
49
|
-
working-directory: /tmp/test-init-project
|
|
50
|
-
run: |
|
|
51
|
-
# Remove npm-installed version and install local tarball
|
|
52
|
-
npm uninstall testdriverai
|
|
53
|
-
npm install /tmp/testdriverai-local.tgz
|
|
54
|
-
|
|
55
|
-
- name: Verify project structure
|
|
56
|
-
working-directory: /tmp/test-init-project
|
|
57
|
-
run: |
|
|
58
|
-
echo "Checking generated files..."
|
|
59
|
-
|
|
60
|
-
# Check for package.json
|
|
61
|
-
if [ ! -f "package.json" ]; then
|
|
62
|
-
echo "❌ package.json not found"
|
|
63
|
-
exit 1
|
|
64
|
-
fi
|
|
65
|
-
echo "✓ package.json exists"
|
|
66
|
-
|
|
67
|
-
# Check for vitest config
|
|
68
|
-
if [ ! -f "vitest.config.js" ]; then
|
|
69
|
-
echo "❌ vitest.config.js not found"
|
|
70
|
-
exit 1
|
|
71
|
-
fi
|
|
72
|
-
echo "✓ vitest.config.js exists"
|
|
73
|
-
|
|
74
|
-
# Check for test file
|
|
75
|
-
if [ ! -f "tests/example.test.js" ]; then
|
|
76
|
-
echo "❌ tests/example.test.js not found"
|
|
77
|
-
exit 1
|
|
78
|
-
fi
|
|
79
|
-
echo "✓ tests/example.test.js exists"
|
|
80
|
-
|
|
81
|
-
# Check for .env file
|
|
82
|
-
if [ ! -f ".env" ]; then
|
|
83
|
-
echo "❌ .env not found"
|
|
84
|
-
exit 1
|
|
85
|
-
fi
|
|
86
|
-
echo "✓ .env exists"
|
|
87
|
-
|
|
88
|
-
# Check for .gitignore
|
|
89
|
-
if [ ! -f ".gitignore" ]; then
|
|
90
|
-
echo "❌ .gitignore not found"
|
|
91
|
-
exit 1
|
|
92
|
-
fi
|
|
93
|
-
echo "✓ .gitignore exists"
|
|
94
|
-
|
|
95
|
-
# Check for GitHub workflow
|
|
96
|
-
if [ ! -f ".github/workflows/testdriver.yml" ]; then
|
|
97
|
-
echo "❌ .github/workflows/testdriver.yml not found"
|
|
98
|
-
exit 1
|
|
99
|
-
fi
|
|
100
|
-
echo "✓ .github/workflows/testdriver.yml exists"
|
|
101
|
-
|
|
102
|
-
- name: Verify vitest config contents
|
|
103
|
-
working-directory: /tmp/test-init-project
|
|
104
|
-
run: |
|
|
105
|
-
echo "Checking vitest.config.js contents..."
|
|
106
|
-
|
|
107
|
-
# Check for TestDriver reporter
|
|
108
|
-
if ! grep -q "TestDriver()" vitest.config.js; then
|
|
109
|
-
echo "❌ TestDriver reporter not found in vitest.config.js"
|
|
110
|
-
cat vitest.config.js
|
|
111
|
-
exit 1
|
|
112
|
-
fi
|
|
113
|
-
echo "✓ TestDriver reporter is configured"
|
|
114
|
-
|
|
115
|
-
# Check for setupFiles
|
|
116
|
-
if ! grep -q "setupFiles.*testdriverai/vitest/setup" vitest.config.js; then
|
|
117
|
-
echo "❌ setupFiles not configured correctly"
|
|
118
|
-
cat vitest.config.js
|
|
119
|
-
exit 1
|
|
120
|
-
fi
|
|
121
|
-
echo "✓ setupFiles is configured"
|
|
122
|
-
|
|
123
|
-
- name: Verify test file contents
|
|
124
|
-
working-directory: /tmp/test-init-project
|
|
125
|
-
run: |
|
|
126
|
-
echo "Checking test file contents..."
|
|
127
|
-
|
|
128
|
-
# Check for .provision usage
|
|
129
|
-
if ! grep -q "\.provision\.chrome" tests/example.test.js; then
|
|
130
|
-
echo "❌ Test does not use .provision.chrome"
|
|
131
|
-
cat tests/example.test.js
|
|
132
|
-
exit 1
|
|
133
|
-
fi
|
|
134
|
-
echo "✓ Test uses .provision.chrome"
|
|
135
|
-
|
|
136
|
-
# Check for TestDriver import
|
|
137
|
-
if ! grep -q "from 'testdriverai/vitest/hooks'" tests/example.test.js; then
|
|
138
|
-
echo "❌ Test does not import from testdriverai/vitest/hooks"
|
|
139
|
-
cat tests/example.test.js
|
|
140
|
-
exit 1
|
|
141
|
-
fi
|
|
142
|
-
echo "✓ Test imports TestDriver from vitest/hooks"
|
|
143
|
-
|
|
144
|
-
- name: Run the generated test
|
|
145
|
-
working-directory: /tmp/test-init-project
|
|
146
|
-
run: npm test
|
|
147
|
-
env:
|
|
148
|
-
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
149
|
-
|
|
150
|
-
- name: Upload test results
|
|
151
|
-
if: always()
|
|
152
|
-
uses: actions/upload-artifact@v4
|
|
153
|
-
with:
|
|
154
|
-
name: test-init-results
|
|
155
|
-
path: /tmp/test-init-project/test-results/
|
|
156
|
-
retention-days: 7
|
|
157
|
-
if-no-files-found: warn
|