testdriverai 6.2.2 → 7.1.0
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/acceptance-linux.yml +75 -0
- package/.github/workflows/acceptance-sdk-tests.yml +133 -0
- package/.vscode/settings.json +5 -1
- package/AGENTS.md +550 -0
- package/CODEOWNERS +0 -1
- package/README.md +126 -0
- package/{testdriver → _testdriver}/acceptance/drag-and-drop.yaml +2 -2
- package/{testdriver → _testdriver}/acceptance/snippets/login.yaml +1 -1
- package/_testdriver/examples/desktop/lifecycle/prerun.yaml +0 -0
- package/{testdriver → _testdriver}/examples/web/lifecycle/prerun.yaml +6 -1
- package/{testdriver → _testdriver}/lifecycle/postrun.yaml +3 -2
- package/_testdriver/lifecycle/prerun.yaml +15 -0
- package/{testdriver → _testdriver}/lifecycle/provision.yaml +7 -2
- package/agent/index.js +300 -85
- package/agent/interface.js +15 -0
- package/agent/lib/cache.js +142 -0
- package/agent/lib/commander.js +1 -39
- package/agent/lib/commands.js +910 -296
- package/agent/lib/redraw.js +129 -41
- package/agent/lib/sandbox.js +29 -6
- package/agent/lib/sdk.js +22 -0
- package/agent/lib/system.js +0 -3
- package/agent/lib/validation.js +1 -7
- package/debug-locate-response.js +82 -0
- package/debugger/index.html +15 -4
- package/docs/ARCHITECTURE.md +424 -0
- package/docs/AWESOME_LOGS_QUICK_REF.md +100 -0
- package/docs/MIGRATION.md +425 -0
- package/docs/PRESETS.md +210 -0
- package/docs/QUICK_START_TEST_RECORDING.md +215 -0
- package/docs/SDK_AWESOME_LOGS.md +468 -0
- package/docs/TEST_RECORDING.md +388 -0
- package/docs/docs.json +286 -152
- package/docs/guide/best-practices-polling.mdx +154 -0
- package/docs/sdk-browser-rendering.md +167 -0
- package/docs/v6/getting-started/self-hosting.mdx +407 -0
- package/docs/{guide → v6/guide}/dashcam.mdx +1 -1
- package/docs/{guide → v6/guide}/environment-variables.mdx +4 -5
- package/docs/{guide → v6/guide}/lifecycle.mdx +1 -1
- package/docs/v6/overview/comparison.mdx +101 -0
- package/docs/v7/README.md +135 -0
- package/docs/v7/api/ai.mdx +205 -0
- package/docs/v7/api/assert.mdx +285 -0
- package/docs/v7/api/assertions.mdx +403 -0
- package/docs/v7/api/click.mdx +287 -0
- package/docs/v7/api/client.mdx +322 -0
- package/docs/v7/api/dashcam.mdx +497 -0
- package/docs/v7/api/doubleClick.mdx +102 -0
- package/docs/v7/api/elements.mdx +479 -0
- package/docs/v7/api/exec.mdx +346 -0
- package/docs/v7/api/find.mdx +316 -0
- package/docs/v7/api/focusApplication.mdx +294 -0
- package/docs/v7/api/hover.mdx +279 -0
- package/docs/v7/api/mouseDown.mdx +161 -0
- package/docs/v7/api/mouseUp.mdx +164 -0
- package/docs/v7/api/pressKeys.mdx +349 -0
- package/docs/v7/api/rightClick.mdx +123 -0
- package/docs/v7/api/sandbox.mdx +404 -0
- package/docs/v7/api/scroll.mdx +300 -0
- package/docs/v7/api/type.mdx +314 -0
- package/docs/v7/commands/assert.mdx +45 -0
- package/docs/v7/commands/exec.mdx +282 -0
- package/docs/v7/commands/focus-application.mdx +44 -0
- package/docs/v7/commands/hover-image.mdx +69 -0
- package/docs/v7/commands/hover-text.mdx +47 -0
- package/docs/v7/commands/if.mdx +53 -0
- package/docs/v7/commands/match-image.mdx +67 -0
- package/docs/v7/commands/press-keys.mdx +87 -0
- package/docs/v7/commands/remember.mdx +49 -0
- package/docs/v7/commands/run.mdx +44 -0
- package/docs/v7/commands/scroll-until-image.mdx +66 -0
- package/docs/v7/commands/scroll-until-text.mdx +60 -0
- package/docs/v7/commands/scroll.mdx +69 -0
- package/docs/v7/commands/type.mdx +45 -0
- package/docs/v7/commands/wait-for-image.mdx +54 -0
- package/docs/v7/commands/wait-for-text.mdx +48 -0
- package/docs/v7/commands/wait.mdx +45 -0
- package/docs/v7/getting-started/configuration.mdx +380 -0
- package/docs/v7/getting-started/quickstart.mdx +332 -0
- package/docs/v7/guides/best-practices.mdx +486 -0
- package/docs/v7/guides/caching-ai.mdx +215 -0
- package/docs/v7/guides/caching-selectors.mdx +292 -0
- package/docs/v7/guides/caching.mdx +366 -0
- package/docs/v7/guides/ci-cd/azure.mdx +587 -0
- package/docs/v7/guides/ci-cd/circleci.mdx +523 -0
- package/docs/v7/guides/ci-cd/github-actions.mdx +457 -0
- package/docs/v7/guides/ci-cd/gitlab.mdx +498 -0
- package/docs/v7/guides/ci-cd/jenkins.mdx +664 -0
- package/docs/v7/guides/ci-cd/travis.mdx +438 -0
- package/docs/v7/guides/debugging.mdx +349 -0
- package/docs/v7/guides/faq.mdx +393 -0
- package/docs/v7/guides/migration.mdx +562 -0
- package/docs/v7/guides/performance.mdx +517 -0
- package/docs/{getting-started → v7/guides}/self-hosting.mdx +11 -12
- package/docs/v7/guides/troubleshooting.mdx +526 -0
- package/docs/v7/guides/vitest-plugin.mdx +477 -0
- package/docs/v7/guides/vitest.mdx +535 -0
- package/docs/v7/platforms/linux.mdx +308 -0
- package/docs/v7/platforms/macos.mdx +433 -0
- package/docs/v7/platforms/windows.mdx +430 -0
- package/docs/v7/playwright.mdx +342 -0
- package/docs/v7/presets/chrome-extension.mdx +223 -0
- package/docs/v7/presets/chrome.mdx +287 -0
- package/docs/v7/presets/electron.mdx +435 -0
- package/docs/v7/presets/vscode.mdx +398 -0
- package/docs/v7/presets/webapp.mdx +396 -0
- package/docs/v7/progressive-apis/CORE.md +459 -0
- package/docs/v7/progressive-apis/HOOKS.md +360 -0
- package/docs/v7/progressive-apis/PROGRESSIVE_DISCLOSURE.md +230 -0
- package/docs/v7/progressive-apis/PROVISION.md +266 -0
- package/eslint.config.js +19 -1
- package/interfaces/cli/lib/base.js +10 -4
- package/interfaces/logger.js +2 -1
- package/interfaces/shared-test-state.mjs +69 -0
- package/interfaces/vitest-plugin.mjs +830 -0
- package/package.json +29 -5
- package/schema.json +8 -29
- package/scripts/view-test-results.mjs +96 -0
- package/sdk-log-formatter.js +714 -0
- package/sdk.d.ts +1028 -0
- package/sdk.js +2567 -0
- package/{.github/workflows/self-hosted.yml → self-hosted.yml} +13 -4
- package/setup/aws/cloudformation.yaml +9 -2
- package/src/core/Dashcam.js +469 -0
- package/src/core/index.d.ts +150 -0
- package/src/core/index.js +12 -0
- package/src/presets/index.mjs +331 -0
- package/src/vitest/extended.mjs +108 -0
- package/src/vitest/hooks.d.ts +119 -0
- package/src/vitest/hooks.mjs +298 -0
- package/src/vitest/index.mjs +64 -0
- package/src/vitest/lifecycle.mjs +277 -0
- package/src/vitest/utils.mjs +150 -0
- package/test/dashcam.test.js +137 -0
- package/test/mcp-example-test.yaml +27 -0
- package/testdriver/acceptance-sdk/QUICK_REFERENCE.md +61 -0
- package/testdriver/acceptance-sdk/README.md +128 -0
- package/testdriver/acceptance-sdk/TEST_REPORTING.md +245 -0
- package/testdriver/acceptance-sdk/assert.test.mjs +26 -0
- package/testdriver/acceptance-sdk/auto-cache-key-demo.test.mjs +56 -0
- package/testdriver/acceptance-sdk/chrome-extension.test.mjs +89 -0
- package/testdriver/acceptance-sdk/drag-and-drop.test.mjs +58 -0
- package/testdriver/acceptance-sdk/element-not-found.test.mjs +25 -0
- package/testdriver/acceptance-sdk/exec-js.test.mjs +43 -0
- package/testdriver/acceptance-sdk/exec-output.test.mjs +59 -0
- package/testdriver/acceptance-sdk/exec-pwsh.test.mjs +57 -0
- package/testdriver/acceptance-sdk/focus-window.test.mjs +36 -0
- package/testdriver/acceptance-sdk/formatted-logging.test.mjs +26 -0
- package/testdriver/acceptance-sdk/hooks-example.test.mjs +38 -0
- package/testdriver/acceptance-sdk/hover-image.test.mjs +34 -0
- package/testdriver/acceptance-sdk/hover-text-with-description.test.mjs +38 -0
- package/testdriver/acceptance-sdk/hover-text.test.mjs +27 -0
- package/testdriver/acceptance-sdk/match-image.test.mjs +36 -0
- package/testdriver/acceptance-sdk/presets-example.test.mjs +87 -0
- package/testdriver/acceptance-sdk/press-keys.test.mjs +50 -0
- package/testdriver/acceptance-sdk/prompt.test.mjs +33 -0
- package/testdriver/acceptance-sdk/scroll-keyboard.test.mjs +38 -0
- package/testdriver/acceptance-sdk/scroll-until-image.test.mjs +39 -0
- package/testdriver/acceptance-sdk/scroll-until-text.test.mjs +28 -0
- package/testdriver/acceptance-sdk/scroll.test.mjs +41 -0
- package/testdriver/acceptance-sdk/setup/globalTeardown.mjs +11 -0
- package/testdriver/acceptance-sdk/setup/testHelpers.mjs +420 -0
- package/testdriver/acceptance-sdk/setup/vitestSetup.mjs +40 -0
- package/testdriver/acceptance-sdk/sully-ai.test.mjs +234 -0
- package/testdriver/acceptance-sdk/test-console-logs.test.mjs +42 -0
- package/testdriver/acceptance-sdk/type-checking-demo.js +49 -0
- package/testdriver/acceptance-sdk/type.test.mjs +45 -0
- package/verify-element-api.js +89 -0
- package/verify-types.js +0 -0
- package/vitest.config.example.js +19 -0
- package/vitest.config.mjs +66 -0
- package/vitest.config.mjs.bak +44 -0
- package/.github/workflows/acceptance-v6.yml +0 -169
- package/.vscode/mcp.json +0 -9
- package/docs/overview/comparison.mdx +0 -82
- package/testdriver/lifecycle/prerun.yaml +0 -17
- /package/{testdriver/examples/desktop/lifecycle/prerun.yaml → .env.example} +0 -0
- /package/{testdriver → _testdriver}/acceptance/assert.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/dashcam.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/embed.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/exec-js.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/exec-output.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/exec-shell.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/focus-window.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/hover-image.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/hover-text-with-description.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/hover-text.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/if-else.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/match-image.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/press-keys.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/prompt.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/remember.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/screenshots/cart.png +0 -0
- /package/{testdriver → _testdriver}/acceptance/scroll-keyboard.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/scroll-until-image.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/scroll-until-text.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/scroll.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/snippets/match-cart.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/type.yaml +0 -0
- /package/{testdriver → _testdriver}/behavior/failure.yaml +0 -0
- /package/{testdriver → _testdriver}/behavior/hover-text.yaml +0 -0
- /package/{testdriver → _testdriver}/behavior/lifecycle/postrun.yaml +0 -0
- /package/{testdriver → _testdriver}/behavior/lifecycle/prerun.yaml +0 -0
- /package/{testdriver → _testdriver}/behavior/lifecycle/provision.yaml +0 -0
- /package/{testdriver → _testdriver}/behavior/secrets.yaml +0 -0
- /package/{testdriver → _testdriver}/edge-cases/dashcam-chrome.yaml +0 -0
- /package/{testdriver → _testdriver}/edge-cases/exec-pwsh-multiline.yaml +0 -0
- /package/{testdriver → _testdriver}/edge-cases/js-exception.yaml +0 -0
- /package/{testdriver → _testdriver}/edge-cases/js-promise.yaml +0 -0
- /package/{testdriver → _testdriver}/edge-cases/lifecycle/postrun.yaml +0 -0
- /package/{testdriver → _testdriver}/edge-cases/prompt-in-middle.yaml +0 -0
- /package/{testdriver → _testdriver}/edge-cases/prompt-nested.yaml +0 -0
- /package/{testdriver → _testdriver}/edge-cases/success-test.yaml +0 -0
- /package/{testdriver → _testdriver}/examples/android/example.yaml +0 -0
- /package/{testdriver → _testdriver}/examples/android/lifecycle/postrun.yaml +0 -0
- /package/{testdriver → _testdriver}/examples/android/lifecycle/provision.yaml +0 -0
- /package/{testdriver → _testdriver}/examples/android/readme.md +0 -0
- /package/{testdriver → _testdriver}/examples/chrome-extension/lifecycle/provision.yaml +0 -0
- /package/{testdriver → _testdriver}/examples/desktop/lifecycle/provision.yaml +0 -0
- /package/{testdriver → _testdriver}/examples/vscode-extension/lifecycle/provision.yaml +0 -0
- /package/{testdriver → _testdriver}/examples/web/lifecycle/postrun.yaml +0 -0
- /package/docs/{account → v6/account}/dashboard.mdx +0 -0
- /package/docs/{account → v6/account}/enterprise.mdx +0 -0
- /package/docs/{account → v6/account}/pricing.mdx +0 -0
- /package/docs/{account → v6/account}/projects.mdx +0 -0
- /package/docs/{account → v6/account}/team.mdx +0 -0
- /package/docs/{action → v6/action}/ami.mdx +0 -0
- /package/docs/{action → v6/action}/performance.mdx +0 -0
- /package/docs/{action → v6/action}/secrets.mdx +0 -0
- /package/docs/{apps → v6/apps}/chrome-extensions.mdx +0 -0
- /package/docs/{apps → v6/apps}/desktop-apps.mdx +0 -0
- /package/docs/{apps → v6/apps}/mobile-apps.mdx +0 -0
- /package/docs/{apps → v6/apps}/static-websites.mdx +0 -0
- /package/docs/{apps → v6/apps}/tauri-apps.mdx +0 -0
- /package/docs/{bugs → v6/bugs}/jira.mdx +0 -0
- /package/docs/{cli → v6/cli}/overview.mdx +0 -0
- /package/docs/{commands → v6/commands}/assert.mdx +0 -0
- /package/docs/{commands → v6/commands}/exec.mdx +0 -0
- /package/docs/{commands → v6/commands}/focus-application.mdx +0 -0
- /package/docs/{commands → v6/commands}/hover-image.mdx +0 -0
- /package/docs/{commands → v6/commands}/hover-text.mdx +0 -0
- /package/docs/{commands → v6/commands}/if.mdx +0 -0
- /package/docs/{commands → v6/commands}/match-image.mdx +0 -0
- /package/docs/{commands → v6/commands}/press-keys.mdx +0 -0
- /package/docs/{commands → v6/commands}/remember.mdx +0 -0
- /package/docs/{commands → v6/commands}/run.mdx +0 -0
- /package/docs/{commands → v6/commands}/scroll-until-image.mdx +0 -0
- /package/docs/{commands → v6/commands}/scroll-until-text.mdx +0 -0
- /package/docs/{commands → v6/commands}/scroll.mdx +0 -0
- /package/docs/{commands → v6/commands}/type.mdx +0 -0
- /package/docs/{commands → v6/commands}/wait-for-image.mdx +0 -0
- /package/docs/{commands → v6/commands}/wait-for-text.mdx +0 -0
- /package/docs/{commands → v6/commands}/wait.mdx +0 -0
- /package/docs/{exporting → v6/exporting}/junit.mdx +0 -0
- /package/docs/{exporting → v6/exporting}/playwright.mdx +0 -0
- /package/docs/{features → v6/features}/auto-healing.mdx +0 -0
- /package/docs/{features → v6/features}/generation.mdx +0 -0
- /package/docs/{features → v6/features}/parallel-testing.mdx +0 -0
- /package/docs/{features → v6/features}/reusable-snippets.mdx +0 -0
- /package/docs/{features → v6/features}/selectorless.mdx +0 -0
- /package/docs/{features → v6/features}/visual-assertions.mdx +0 -0
- /package/docs/{getting-started → v6/getting-started}/ci.mdx +0 -0
- /package/docs/{getting-started → v6/getting-started}/cli.mdx +0 -0
- /package/docs/{getting-started → v6/getting-started}/editing.mdx +0 -0
- /package/docs/{getting-started → v6/getting-started}/playwright.mdx +0 -0
- /package/docs/{getting-started → v6/getting-started}/running.mdx +0 -0
- /package/docs/{getting-started → v6/getting-started}/vscode.mdx +0 -0
- /package/docs/{guide → v6/guide}/assertions.mdx +0 -0
- /package/docs/{guide → v6/guide}/authentication.mdx +0 -0
- /package/docs/{guide → v6/guide}/code.mdx +0 -0
- /package/docs/{guide → v6/guide}/locating.mdx +0 -0
- /package/docs/{guide → v6/guide}/protips.mdx +0 -0
- /package/docs/{guide → v6/guide}/variables.mdx +0 -0
- /package/docs/{guide → v6/guide}/waiting.mdx +0 -0
- /package/docs/{importing → v6/importing}/csv.mdx +0 -0
- /package/docs/{importing → v6/importing}/gherkin.mdx +0 -0
- /package/docs/{importing → v6/importing}/jira.mdx +0 -0
- /package/docs/{importing → v6/importing}/testrail.mdx +0 -0
- /package/docs/{integrations → v6/integrations}/electron.mdx +0 -0
- /package/docs/{integrations → v6/integrations}/netlify.mdx +0 -0
- /package/docs/{integrations → v6/integrations}/vercel.mdx +0 -0
- /package/docs/{interactive → v6/interactive}/explore.mdx +0 -0
- /package/docs/{interactive → v6/interactive}/run.mdx +0 -0
- /package/docs/{interactive → v6/interactive}/save.mdx +0 -0
- /package/docs/{overview → v6/overview}/faq.mdx +0 -0
- /package/docs/{overview → v6/overview}/performance.mdx +0 -0
- /package/docs/{overview → v6/overview}/quickstart.mdx +0 -0
- /package/docs/{overview → v6/overview}/what-is-testdriver.mdx +0 -0
- /package/docs/{scenarios → v6/scenarios}/ai-chatbot.mdx +0 -0
- /package/docs/{scenarios → v6/scenarios}/cookie-banner.mdx +0 -0
- /package/docs/{scenarios → v6/scenarios}/file-upload.mdx +0 -0
- /package/docs/{scenarios → v6/scenarios}/form-filling.mdx +0 -0
- /package/docs/{scenarios → v6/scenarios}/log-in.mdx +0 -0
- /package/docs/{scenarios → v6/scenarios}/pdf-generation.mdx +0 -0
- /package/docs/{scenarios → v6/scenarios}/spell-check.mdx +0 -0
- /package/docs/{security → v6/security}/action.mdx +0 -0
- /package/docs/{security → v6/security}/agent.mdx +0 -0
- /package/docs/{security → v6/security}/platform.mdx +0 -0
- /package/docs/{tutorials → v6/tutorials}/advanced-test.mdx +0 -0
- /package/docs/{tutorials → v6/tutorials}/basic-test.mdx +0 -0
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "GitLab CI"
|
|
3
|
+
description: "Run TestDriver tests in GitLab CI/CD"
|
|
4
|
+
icon: "gitlab"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Basic Setup
|
|
8
|
+
|
|
9
|
+
Create `.gitlab-ci.yml`:
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
stages:
|
|
13
|
+
- test
|
|
14
|
+
|
|
15
|
+
test:
|
|
16
|
+
stage: test
|
|
17
|
+
image: node:18
|
|
18
|
+
|
|
19
|
+
before_script:
|
|
20
|
+
- npm ci
|
|
21
|
+
|
|
22
|
+
script:
|
|
23
|
+
- npx vitest
|
|
24
|
+
|
|
25
|
+
variables:
|
|
26
|
+
TD_API_KEY: $TD_API_KEY
|
|
27
|
+
|
|
28
|
+
artifacts:
|
|
29
|
+
when: always
|
|
30
|
+
paths:
|
|
31
|
+
- test-results/
|
|
32
|
+
reports:
|
|
33
|
+
junit: test-results/junit.xml
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Add API Key
|
|
37
|
+
|
|
38
|
+
1. Go to **Settings** → **CI/CD** → **Variables**
|
|
39
|
+
2. Click **Add variable**
|
|
40
|
+
3. Key: `TD_API_KEY`
|
|
41
|
+
4. Value: Your API key from [dashboard.testdriver.ai](https://dashboard.testdriver.ai)
|
|
42
|
+
5. Check **Protect variable** (recommended)
|
|
43
|
+
6. Check **Mask variable** (recommended)
|
|
44
|
+
7. Click **Add variable**
|
|
45
|
+
|
|
46
|
+
## Parallel Jobs
|
|
47
|
+
|
|
48
|
+
Run tests in parallel:
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
test:
|
|
52
|
+
stage: test
|
|
53
|
+
image: node:18
|
|
54
|
+
parallel: 4
|
|
55
|
+
|
|
56
|
+
before_script:
|
|
57
|
+
- npm ci
|
|
58
|
+
|
|
59
|
+
script:
|
|
60
|
+
- npx vitest --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL
|
|
61
|
+
|
|
62
|
+
variables:
|
|
63
|
+
TD_API_KEY: $TD_API_KEY
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
GitLab automatically sets `CI_NODE_INDEX` (1-4) and `CI_NODE_TOTAL` (4).
|
|
67
|
+
|
|
68
|
+
## Cache Dependencies
|
|
69
|
+
|
|
70
|
+
Speed up builds with caching:
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
test:
|
|
74
|
+
stage: test
|
|
75
|
+
image: node:18
|
|
76
|
+
|
|
77
|
+
cache:
|
|
78
|
+
paths:
|
|
79
|
+
- node_modules/
|
|
80
|
+
key:
|
|
81
|
+
files:
|
|
82
|
+
- package-lock.json
|
|
83
|
+
|
|
84
|
+
before_script:
|
|
85
|
+
- npm ci
|
|
86
|
+
|
|
87
|
+
script:
|
|
88
|
+
- npx vitest
|
|
89
|
+
|
|
90
|
+
variables:
|
|
91
|
+
TD_API_KEY: $TD_API_KEY
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Save Dashcam URLs
|
|
95
|
+
|
|
96
|
+
Extract replay URLs from test output:
|
|
97
|
+
|
|
98
|
+
```yaml
|
|
99
|
+
test:
|
|
100
|
+
stage: test
|
|
101
|
+
image: node:18
|
|
102
|
+
|
|
103
|
+
script:
|
|
104
|
+
- npx vitest 2>&1 | tee test-output.log
|
|
105
|
+
- grep -o 'https://dashcam.testdriver.ai/[a-zA-Z0-9-]*' test-output.log > dashcam-urls.txt || true
|
|
106
|
+
|
|
107
|
+
variables:
|
|
108
|
+
TD_API_KEY: $TD_API_KEY
|
|
109
|
+
|
|
110
|
+
artifacts:
|
|
111
|
+
when: always
|
|
112
|
+
paths:
|
|
113
|
+
- test-results/
|
|
114
|
+
- test-output.log
|
|
115
|
+
- dashcam-urls.txt
|
|
116
|
+
reports:
|
|
117
|
+
junit: test-results/junit.xml
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Scheduled Pipelines
|
|
121
|
+
|
|
122
|
+
Run tests on schedule:
|
|
123
|
+
|
|
124
|
+
1. Go to **CI/CD** → **Schedules**
|
|
125
|
+
2. Click **New schedule**
|
|
126
|
+
3. Description: "Nightly tests"
|
|
127
|
+
4. Interval pattern: `0 2 * * *` (2 AM daily)
|
|
128
|
+
5. Target branch: `main`
|
|
129
|
+
6. Click **Save pipeline schedule**
|
|
130
|
+
|
|
131
|
+
Or use `only` in `.gitlab-ci.yml`:
|
|
132
|
+
|
|
133
|
+
```yaml
|
|
134
|
+
test:
|
|
135
|
+
script:
|
|
136
|
+
- npx vitest
|
|
137
|
+
|
|
138
|
+
only:
|
|
139
|
+
- schedules
|
|
140
|
+
- merge_requests
|
|
141
|
+
- main
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Retry Failed Tests
|
|
145
|
+
|
|
146
|
+
Automatically retry on failure:
|
|
147
|
+
|
|
148
|
+
```yaml
|
|
149
|
+
test:
|
|
150
|
+
stage: test
|
|
151
|
+
image: node:18
|
|
152
|
+
|
|
153
|
+
retry:
|
|
154
|
+
max: 2
|
|
155
|
+
when:
|
|
156
|
+
- runner_system_failure
|
|
157
|
+
- stuck_or_timeout_failure
|
|
158
|
+
|
|
159
|
+
script:
|
|
160
|
+
- npx vitest
|
|
161
|
+
|
|
162
|
+
variables:
|
|
163
|
+
TD_API_KEY: $TD_API_KEY
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Multiple Node Versions
|
|
167
|
+
|
|
168
|
+
Test across Node.js versions:
|
|
169
|
+
|
|
170
|
+
```yaml
|
|
171
|
+
.test_template:
|
|
172
|
+
stage: test
|
|
173
|
+
|
|
174
|
+
before_script:
|
|
175
|
+
- npm ci
|
|
176
|
+
|
|
177
|
+
script:
|
|
178
|
+
- npx vitest
|
|
179
|
+
|
|
180
|
+
variables:
|
|
181
|
+
TD_API_KEY: $TD_API_KEY
|
|
182
|
+
|
|
183
|
+
test:node16:
|
|
184
|
+
extends: .test_template
|
|
185
|
+
image: node:16
|
|
186
|
+
|
|
187
|
+
test:node18:
|
|
188
|
+
extends: .test_template
|
|
189
|
+
image: node:18
|
|
190
|
+
|
|
191
|
+
test:node20:
|
|
192
|
+
extends: .test_template
|
|
193
|
+
image: node:20
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Environment-Specific Tests
|
|
197
|
+
|
|
198
|
+
Test against different environments:
|
|
199
|
+
|
|
200
|
+
```yaml
|
|
201
|
+
test:staging:
|
|
202
|
+
stage: test
|
|
203
|
+
image: node:18
|
|
204
|
+
|
|
205
|
+
script:
|
|
206
|
+
- npx vitest
|
|
207
|
+
|
|
208
|
+
variables:
|
|
209
|
+
TD_API_KEY: $TD_API_KEY
|
|
210
|
+
TEST_URL: https://staging.example.com
|
|
211
|
+
|
|
212
|
+
only:
|
|
213
|
+
- merge_requests
|
|
214
|
+
|
|
215
|
+
test:production:
|
|
216
|
+
stage: test
|
|
217
|
+
image: node:18
|
|
218
|
+
|
|
219
|
+
script:
|
|
220
|
+
- npx vitest
|
|
221
|
+
|
|
222
|
+
variables:
|
|
223
|
+
TD_API_KEY: $TD_API_KEY
|
|
224
|
+
TEST_URL: https://example.com
|
|
225
|
+
|
|
226
|
+
only:
|
|
227
|
+
- main
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Conditional Execution
|
|
231
|
+
|
|
232
|
+
Skip tests on documentation changes:
|
|
233
|
+
|
|
234
|
+
```yaml
|
|
235
|
+
test:
|
|
236
|
+
stage: test
|
|
237
|
+
image: node:18
|
|
238
|
+
|
|
239
|
+
script:
|
|
240
|
+
- npx vitest
|
|
241
|
+
|
|
242
|
+
variables:
|
|
243
|
+
TD_API_KEY: $TD_API_KEY
|
|
244
|
+
|
|
245
|
+
except:
|
|
246
|
+
changes:
|
|
247
|
+
- "*.md"
|
|
248
|
+
- "docs/**/*"
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Or run only on specific changes:
|
|
252
|
+
|
|
253
|
+
```yaml
|
|
254
|
+
test:
|
|
255
|
+
only:
|
|
256
|
+
changes:
|
|
257
|
+
- "src/**/*"
|
|
258
|
+
- "test/**/*"
|
|
259
|
+
- "package.json"
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Docker-in-Docker
|
|
263
|
+
|
|
264
|
+
If you need Docker for your tests:
|
|
265
|
+
|
|
266
|
+
```yaml
|
|
267
|
+
test:
|
|
268
|
+
stage: test
|
|
269
|
+
image: docker:latest
|
|
270
|
+
|
|
271
|
+
services:
|
|
272
|
+
- docker:dind
|
|
273
|
+
|
|
274
|
+
variables:
|
|
275
|
+
DOCKER_DRIVER: overlay2
|
|
276
|
+
TD_API_KEY: $TD_API_KEY
|
|
277
|
+
|
|
278
|
+
before_script:
|
|
279
|
+
- apk add --no-cache nodejs npm
|
|
280
|
+
- npm ci
|
|
281
|
+
|
|
282
|
+
script:
|
|
283
|
+
- npx vitest
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Matrix Jobs
|
|
287
|
+
|
|
288
|
+
Test multiple configurations:
|
|
289
|
+
|
|
290
|
+
```yaml
|
|
291
|
+
test:
|
|
292
|
+
stage: test
|
|
293
|
+
parallel:
|
|
294
|
+
matrix:
|
|
295
|
+
- NODE_VERSION: ['16', '18', '20']
|
|
296
|
+
OS: ['debian', 'alpine']
|
|
297
|
+
|
|
298
|
+
image: node:${NODE_VERSION}-${OS}
|
|
299
|
+
|
|
300
|
+
script:
|
|
301
|
+
- npm ci
|
|
302
|
+
- npx vitest
|
|
303
|
+
|
|
304
|
+
variables:
|
|
305
|
+
TD_API_KEY: $TD_API_KEY
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## Code Coverage
|
|
309
|
+
|
|
310
|
+
Generate and publish coverage reports:
|
|
311
|
+
|
|
312
|
+
```yaml
|
|
313
|
+
test:
|
|
314
|
+
stage: test
|
|
315
|
+
image: node:18
|
|
316
|
+
|
|
317
|
+
script:
|
|
318
|
+
- npx vitest --coverage
|
|
319
|
+
|
|
320
|
+
coverage: '/All files[^|]*\|[^|]*\s+([\d\.]+)/'
|
|
321
|
+
|
|
322
|
+
artifacts:
|
|
323
|
+
reports:
|
|
324
|
+
coverage_report:
|
|
325
|
+
coverage_format: cobertura
|
|
326
|
+
path: coverage/cobertura-coverage.xml
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
## Fail Fast
|
|
330
|
+
|
|
331
|
+
Stop pipeline on first failure:
|
|
332
|
+
|
|
333
|
+
```yaml
|
|
334
|
+
workflow:
|
|
335
|
+
rules:
|
|
336
|
+
- when: always
|
|
337
|
+
|
|
338
|
+
test:
|
|
339
|
+
stage: test
|
|
340
|
+
parallel: 4
|
|
341
|
+
|
|
342
|
+
script:
|
|
343
|
+
- npx vitest --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL --bail
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## Manual Triggers
|
|
347
|
+
|
|
348
|
+
Add manual approval step:
|
|
349
|
+
|
|
350
|
+
```yaml
|
|
351
|
+
test:
|
|
352
|
+
stage: test
|
|
353
|
+
when: manual
|
|
354
|
+
allow_failure: false
|
|
355
|
+
|
|
356
|
+
script:
|
|
357
|
+
- npx vitest
|
|
358
|
+
|
|
359
|
+
variables:
|
|
360
|
+
TD_API_KEY: $TD_API_KEY
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
## Troubleshooting
|
|
364
|
+
|
|
365
|
+
### Tests timeout
|
|
366
|
+
|
|
367
|
+
Increase timeout:
|
|
368
|
+
|
|
369
|
+
```yaml
|
|
370
|
+
test:
|
|
371
|
+
timeout: 30m # Default is 1 hour
|
|
372
|
+
|
|
373
|
+
script:
|
|
374
|
+
- npx vitest
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### API key not found
|
|
378
|
+
|
|
379
|
+
Debug variables:
|
|
380
|
+
|
|
381
|
+
```yaml
|
|
382
|
+
test:
|
|
383
|
+
script:
|
|
384
|
+
- echo "Has TD_API_KEY ${TD_API_KEY:+yes}"
|
|
385
|
+
- npx vitest
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Cache not working
|
|
389
|
+
|
|
390
|
+
Clear cache and retry:
|
|
391
|
+
|
|
392
|
+
```yaml
|
|
393
|
+
test:
|
|
394
|
+
cache:
|
|
395
|
+
paths:
|
|
396
|
+
- node_modules/
|
|
397
|
+
key:
|
|
398
|
+
files:
|
|
399
|
+
- package-lock.json
|
|
400
|
+
policy: pull-push # Always update cache
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
Or clear manually: **CI/CD** → **Pipelines** → **Clear runner caches**
|
|
404
|
+
|
|
405
|
+
## Complete Example
|
|
406
|
+
|
|
407
|
+
Full-featured pipeline:
|
|
408
|
+
|
|
409
|
+
```yaml
|
|
410
|
+
stages:
|
|
411
|
+
- test
|
|
412
|
+
- report
|
|
413
|
+
|
|
414
|
+
variables:
|
|
415
|
+
NODE_VERSION: '18'
|
|
416
|
+
|
|
417
|
+
.test_template:
|
|
418
|
+
image: node:${NODE_VERSION}
|
|
419
|
+
|
|
420
|
+
cache:
|
|
421
|
+
paths:
|
|
422
|
+
- node_modules/
|
|
423
|
+
key:
|
|
424
|
+
files:
|
|
425
|
+
- package-lock.json
|
|
426
|
+
|
|
427
|
+
before_script:
|
|
428
|
+
- npm ci
|
|
429
|
+
|
|
430
|
+
variables:
|
|
431
|
+
TD_API_KEY: $TD_API_KEY
|
|
432
|
+
|
|
433
|
+
test:
|
|
434
|
+
extends: .test_template
|
|
435
|
+
stage: test
|
|
436
|
+
parallel: 4
|
|
437
|
+
|
|
438
|
+
retry:
|
|
439
|
+
max: 2
|
|
440
|
+
when:
|
|
441
|
+
- runner_system_failure
|
|
442
|
+
|
|
443
|
+
script:
|
|
444
|
+
- npx vitest --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL 2>&1 | tee test-output.log
|
|
445
|
+
- grep -o 'https://dashcam.testdriver.ai/[a-zA-Z0-9-]*' test-output.log > dashcam-urls.txt || true
|
|
446
|
+
|
|
447
|
+
artifacts:
|
|
448
|
+
when: always
|
|
449
|
+
expire_in: 1 week
|
|
450
|
+
paths:
|
|
451
|
+
- test-results/
|
|
452
|
+
- test-output.log
|
|
453
|
+
- dashcam-urls.txt
|
|
454
|
+
reports:
|
|
455
|
+
junit: test-results/junit.xml
|
|
456
|
+
|
|
457
|
+
only:
|
|
458
|
+
- merge_requests
|
|
459
|
+
- main
|
|
460
|
+
- schedules
|
|
461
|
+
|
|
462
|
+
report:
|
|
463
|
+
stage: report
|
|
464
|
+
image: alpine:latest
|
|
465
|
+
|
|
466
|
+
dependencies:
|
|
467
|
+
- test
|
|
468
|
+
|
|
469
|
+
script:
|
|
470
|
+
- echo "Tests completed"
|
|
471
|
+
- cat dashcam-urls.txt || true
|
|
472
|
+
|
|
473
|
+
when: on_failure
|
|
474
|
+
|
|
475
|
+
only:
|
|
476
|
+
- merge_requests
|
|
477
|
+
- main
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
## See Also
|
|
481
|
+
|
|
482
|
+
<CardGroup cols={2}>
|
|
483
|
+
<Card title="CI/CD Overview" icon="arrows-spin" href="/v7/guides/ci-cd/overview">
|
|
484
|
+
CI/CD concepts
|
|
485
|
+
</Card>
|
|
486
|
+
|
|
487
|
+
<Card title="Performance" icon="gauge" href="/v7/guides/performance">
|
|
488
|
+
Optimize tests
|
|
489
|
+
</Card>
|
|
490
|
+
|
|
491
|
+
<Card title="Troubleshooting" icon="circle-question" href="/v7/guides/troubleshooting">
|
|
492
|
+
Common issues
|
|
493
|
+
</Card>
|
|
494
|
+
|
|
495
|
+
<Card title="GitLab CI Docs" icon="book" href="https://docs.gitlab.com/ee/ci/">
|
|
496
|
+
Official docs
|
|
497
|
+
</Card>
|
|
498
|
+
</CardGroup>
|