testdriverai 7.2.3 → 7.2.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/.github/workflows/publish.yaml +15 -7
- package/.github/workflows/testdriver.yml +163 -0
- package/.testdriver/last-sandbox +7 -0
- package/agent/events.js +1 -0
- package/agent/index.js +99 -163
- package/agent/lib/sandbox.js +11 -1
- package/agents.md +393 -0
- package/bin/testdriverai.js +8 -0
- package/debug/01-table-initial.png +0 -0
- package/debug/02-after-ai-explore.png +0 -0
- package/debug/02-after-scroll.png +0 -0
- package/debugger/index.html +37 -0
- package/docs/docs.json +93 -125
- package/docs/v7/_drafts/architecture.mdx +1 -26
- package/docs/v7/_drafts/caching.mdx +2 -2
- package/docs/v7/{getting-started → _drafts}/installation.mdx +0 -66
- package/docs/v7/{features/coverage.mdx → _drafts/powerful.mdx} +1 -90
- package/docs/v7/_drafts/quick-start-test-recording.mdx +0 -1
- package/docs/v7/{features → _drafts}/scalable.mdx +126 -4
- package/docs/v7/_drafts/screenshot.mdx +155 -0
- package/docs/v7/_drafts/test-recording.mdx +0 -6
- package/docs/v7/_drafts/writing-tests.mdx +25 -0
- package/docs/v7/{api/act.mdx → ai.mdx} +28 -27
- package/docs/v7/{api/assert.mdx → assert.mdx} +3 -3
- package/docs/v7/aws-setup.mdx +338 -0
- package/docs/v7/caching.mdx +128 -0
- package/docs/v7/ci-cd.mdx +605 -0
- package/docs/v7/{api/click.mdx → click.mdx} +4 -4
- package/docs/v7/cloud.mdx +120 -0
- package/docs/v7/customizing-devices.mdx +129 -0
- package/docs/v7/{api/doubleClick.mdx → double-click.mdx} +5 -5
- package/docs/v7/enterprise.mdx +135 -0
- package/docs/v7/examples.mdx +5 -0
- package/docs/v7/{api/exec.mdx → exec.mdx} +3 -3
- package/docs/v7/{api/find.mdx → find.mdx} +17 -21
- package/docs/v7/{api/focusApplication.mdx → focus-application.mdx} +3 -3
- package/docs/v7/generating-tests.mdx +32 -0
- package/docs/v7/{api/hover.mdx → hover.mdx} +3 -3
- package/docs/v7/locating-elements.mdx +71 -0
- package/docs/v7/making-assertions.mdx +32 -0
- package/docs/v7/{api/mouseDown.mdx → mouse-down.mdx} +7 -7
- package/docs/v7/{api/mouseUp.mdx → mouse-up.mdx} +8 -8
- package/docs/v7/performing-actions.mdx +51 -0
- package/docs/v7/{api/pressKeys.mdx → press-keys.mdx} +3 -3
- package/docs/v7/quickstart.mdx +162 -0
- package/docs/v7/reusable-code.mdx +240 -0
- package/docs/v7/{api/rightClick.mdx → right-click.mdx} +5 -5
- package/docs/v7/running-tests.mdx +181 -0
- package/docs/v7/{api/scroll.mdx → scroll.mdx} +3 -3
- package/docs/v7/secrets.mdx +115 -0
- package/docs/v7/self-hosted.mdx +66 -0
- package/docs/v7/{api/type.mdx → type.mdx} +3 -3
- package/docs/v7/variables.mdx +111 -0
- package/docs/v7/waiting-for-elements.mdx +66 -0
- package/docs/v7/what-is-testdriver.mdx +54 -0
- package/interfaces/cli/commands/init.js +33 -19
- package/interfaces/cli/lib/base.js +24 -0
- package/interfaces/cli.js +8 -1
- package/interfaces/logger.js +8 -3
- package/interfaces/vitest-plugin.mjs +16 -71
- package/lib/sentry.js +343 -0
- package/lib/vitest/hooks.mjs +81 -81
- package/package.json +4 -3
- package/sdk-log-formatter.js +41 -0
- package/sdk.d.ts +22 -9
- package/sdk.js +344 -100
- package/test/manual/reconnect-provision.test.mjs +49 -0
- package/test/manual/reconnect-signin.test.mjs +41 -0
- package/test/testdriver/act.test.mjs +30 -0
- package/test/testdriver/ai.test.mjs +30 -0
- package/test/testdriver/assert.test.mjs +1 -1
- package/test/testdriver/hover-text.test.mjs +1 -1
- package/test/testdriver/setup/testHelpers.mjs +8 -119
- package/test/testdriver/windows-installer.test.mjs +61 -0
- package/tests/example.test.js +33 -0
- package/tests/login.js +28 -0
- package/tests/table-sort-enrollments.test.mjs +72 -0
- package/tests/table-sort-experiment.test.mjs +42 -0
- package/tests/table-sort-setup.test.mjs +59 -0
- package/vitest.config.mjs +3 -1
- package/agent/lib/cache.js +0 -142
- package/docs/v7/api/assertions.mdx +0 -403
- package/docs/v7/features/ai-native.mdx +0 -413
- package/docs/v7/features/application-logs.mdx +0 -353
- package/docs/v7/features/browser-logs.mdx +0 -414
- package/docs/v7/features/cache-management.mdx +0 -402
- package/docs/v7/features/continuous-testing.mdx +0 -346
- package/docs/v7/features/data-driven-testing.mdx +0 -441
- package/docs/v7/features/easy-to-write.mdx +0 -280
- package/docs/v7/features/enterprise.mdx +0 -656
- package/docs/v7/features/fast.mdx +0 -406
- package/docs/v7/features/managed-sandboxes.mdx +0 -384
- package/docs/v7/features/network-monitoring.mdx +0 -568
- package/docs/v7/features/parallel-execution.mdx +0 -381
- package/docs/v7/features/powerful.mdx +0 -531
- package/docs/v7/features/sandbox-customization.mdx +0 -229
- package/docs/v7/features/stable.mdx +0 -473
- package/docs/v7/features/system-performance.mdx +0 -616
- package/docs/v7/features/test-analytics.mdx +0 -373
- package/docs/v7/features/test-cases.mdx +0 -393
- package/docs/v7/features/test-replays.mdx +0 -408
- package/docs/v7/features/test-reports.mdx +0 -308
- package/docs/v7/getting-started/debugging-tests.mdx +0 -382
- package/docs/v7/getting-started/quickstart.mdx +0 -90
- package/docs/v7/getting-started/running-tests.mdx +0 -173
- package/docs/v7/getting-started/setting-up-in-ci.mdx +0 -612
- package/docs/v7/getting-started/writing-tests.mdx +0 -534
- package/docs/v7/overview/what-is-testdriver.mdx +0 -386
- package/docs/v7/presets/chrome-extension.mdx +0 -248
- package/docs/v7/presets/chrome.mdx +0 -300
- package/docs/v7/presets/electron.mdx +0 -460
- package/docs/v7/presets/vscode.mdx +0 -417
- package/docs/v7/presets/webapp.mdx +0 -393
- /package/docs/v7/{commands → _drafts/commands}/assert.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/exec.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/focus-application.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/hover-image.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/hover-text.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/if.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/match-image.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/press-keys.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/remember.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/run.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/scroll-until-image.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/scroll-until-text.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/scroll.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/type.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/wait-for-image.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/wait-for-text.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/wait.mdx +0 -0
- /package/docs/v7/{getting-started → _drafts}/configuration.mdx +0 -0
- /package/docs/v7/{features → _drafts}/observable.mdx +0 -0
- /package/docs/v7/{platforms → _drafts/platforms}/linux.mdx +0 -0
- /package/docs/v7/{platforms → _drafts/platforms}/macos.mdx +0 -0
- /package/docs/v7/{platforms → _drafts/platforms}/windows.mdx +0 -0
- /package/docs/v7/{playwright.mdx → _drafts/playwright.mdx} +0 -0
- /package/docs/v7/{overview → _drafts}/readme.mdx +0 -0
- /package/docs/v7/{features → _drafts}/reports.mdx +0 -0
- /package/docs/v7/{api/client.mdx → client.mdx} +0 -0
- /package/docs/v7/{api/dashcam.mdx → dashcam.mdx} +0 -0
- /package/docs/v7/{api/elements.mdx → elements.mdx} +0 -0
- /package/docs/v7/{api/sandbox.mdx → sandbox.mdx} +0 -0
|
@@ -1,393 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Web App Preset"
|
|
3
|
-
sidebarTitle: "Web App"
|
|
4
|
-
description: "Generic preset for testing web applications"
|
|
5
|
-
icon: "globe"
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
The `webApp()` preset provides a generic interface for testing web applications. It currently uses Chrome under the hood but provides a more semantic API for web app testing.
|
|
11
|
-
|
|
12
|
-
## Quick Start
|
|
13
|
-
|
|
14
|
-
```javascript
|
|
15
|
-
import { test } from 'vitest';
|
|
16
|
-
import { TestDriver } from 'testdriverai/vitest/hooks';
|
|
17
|
-
|
|
18
|
-
test('web app test', async (context) => {
|
|
19
|
-
const testdriver = TestDriver(context, { headless: true });
|
|
20
|
-
|
|
21
|
-
await testdriver.provision.chrome({ url: 'https://myapp.com' });
|
|
22
|
-
|
|
23
|
-
await testdriver.find('Login button').click();
|
|
24
|
-
});
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Signature
|
|
28
|
-
|
|
29
|
-
```typescript
|
|
30
|
-
webApp(context, options): Promise<WebAppResult>
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Parameters
|
|
34
|
-
|
|
35
|
-
<ParamField path="context" type="object" required>
|
|
36
|
-
Vitest test context - automatically passed to your test function
|
|
37
|
-
</ParamField>
|
|
38
|
-
|
|
39
|
-
<ParamField path="options" type="object">
|
|
40
|
-
Configuration options for web app testing
|
|
41
|
-
|
|
42
|
-
<Expandable title="properties">
|
|
43
|
-
<ParamField path="url" type="string" default="http://testdriver-sandbox.vercel.app/">
|
|
44
|
-
URL to navigate to when browser launches
|
|
45
|
-
</ParamField>
|
|
46
|
-
|
|
47
|
-
<ParamField path="browser" type="'chrome'" default="chrome">
|
|
48
|
-
Browser to use (currently only Chrome is supported)
|
|
49
|
-
</ParamField>
|
|
50
|
-
|
|
51
|
-
<ParamField path="maximized" type="boolean" default={true}>
|
|
52
|
-
Start browser in maximized window mode
|
|
53
|
-
</ParamField>
|
|
54
|
-
|
|
55
|
-
<ParamField path="guest" type="boolean" default={true}>
|
|
56
|
-
Use browser guest/incognito mode (no profile data)
|
|
57
|
-
</ParamField>
|
|
58
|
-
|
|
59
|
-
<ParamField path="dashcam" type="boolean" default={true}>
|
|
60
|
-
Enable Dashcam test recording
|
|
61
|
-
</ParamField>
|
|
62
|
-
|
|
63
|
-
<ParamField path="os" type="'linux' | 'mac' | 'windows'" default="linux">
|
|
64
|
-
Target operating system for the test
|
|
65
|
-
</ParamField>
|
|
66
|
-
</Expandable>
|
|
67
|
-
</ParamField>
|
|
68
|
-
|
|
69
|
-
### Returns
|
|
70
|
-
|
|
71
|
-
<ResponseField name="testdriver" type="TestDriver" required>
|
|
72
|
-
TestDriver instance ready to use
|
|
73
|
-
</ResponseField>
|
|
74
|
-
|
|
75
|
-
<ResponseField name="dashcam" type="Dashcam">
|
|
76
|
-
Dashcam instance for test recording (if enabled)
|
|
77
|
-
</ResponseField>
|
|
78
|
-
|
|
79
|
-
## Examples
|
|
80
|
-
|
|
81
|
-
### Basic Web App Testing
|
|
82
|
-
|
|
83
|
-
```javascript
|
|
84
|
-
import { test } from 'vitest';
|
|
85
|
-
import { TestDriver } from 'testdriverai/vitest/hooks';
|
|
86
|
-
|
|
87
|
-
test('user login flow', async (context) => {
|
|
88
|
-
const testdriver = TestDriver(context, { headless: true });
|
|
89
|
-
|
|
90
|
-
await testdriver.provision.chrome({ url: 'https://myapp.com/login' });
|
|
91
|
-
|
|
92
|
-
await testdriver.find('email input').type('user@example.com');
|
|
93
|
-
await testdriver.find('password input').type('password123');
|
|
94
|
-
await testdriver.find('Login button').click();
|
|
95
|
-
|
|
96
|
-
await testdriver.assert('Dashboard is visible');
|
|
97
|
-
});
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### E-commerce Testing
|
|
101
|
-
|
|
102
|
-
```javascript
|
|
103
|
-
import { test } from 'vitest';
|
|
104
|
-
import { TestDriver } from 'testdriverai/vitest/hooks';
|
|
105
|
-
|
|
106
|
-
test('product purchase', async (context) => {
|
|
107
|
-
const testdriver = TestDriver(context, { headless: true });
|
|
108
|
-
|
|
109
|
-
await testdriver.provision.chrome({ url: 'https://shop.example.com' });
|
|
110
|
-
|
|
111
|
-
// Search for product
|
|
112
|
-
await testdriver.find('search input').type('laptop');
|
|
113
|
-
await testdriver.find('search button').click();
|
|
114
|
-
|
|
115
|
-
// Select product
|
|
116
|
-
await testdriver.find('first product result').click();
|
|
117
|
-
|
|
118
|
-
// Add to cart
|
|
119
|
-
await testdriver.find('Add to Cart').click();
|
|
120
|
-
|
|
121
|
-
// Proceed to checkout
|
|
122
|
-
await testdriver.find('Cart icon').click();
|
|
123
|
-
await testdriver.find('Checkout').click();
|
|
124
|
-
|
|
125
|
-
await testdriver.assert('Checkout page loaded');
|
|
126
|
-
});
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### SPA Navigation
|
|
130
|
-
|
|
131
|
-
```javascript
|
|
132
|
-
import { test } from 'vitest';
|
|
133
|
-
import { TestDriver } from 'testdriverai/vitest/hooks';
|
|
134
|
-
|
|
135
|
-
test('single page app routing', async (context) => {
|
|
136
|
-
const testdriver = TestDriver(context, { headless: true });
|
|
137
|
-
|
|
138
|
-
await testdriver.provision.chrome({ url: 'https://spa.example.com' });
|
|
139
|
-
|
|
140
|
-
// Navigate through SPA routes
|
|
141
|
-
await testdriver.find('About link').click();
|
|
142
|
-
await testdriver.assert('About page content is visible');
|
|
143
|
-
|
|
144
|
-
await testdriver.find('Products link').click();
|
|
145
|
-
await testdriver.assert('Products page content is visible');
|
|
146
|
-
|
|
147
|
-
await testdriver.find('Contact link').click();
|
|
148
|
-
await testdriver.assert('Contact form is visible');
|
|
149
|
-
});
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### Form Validation
|
|
153
|
-
|
|
154
|
-
```javascript
|
|
155
|
-
import { test } from 'vitest';
|
|
156
|
-
import { TestDriver } from 'testdriverai/vitest/hooks';
|
|
157
|
-
|
|
158
|
-
test('form validation errors', async (context) => {
|
|
159
|
-
const testdriver = TestDriver(context, { headless: true });
|
|
160
|
-
|
|
161
|
-
await testdriver.provision.chrome({ url: 'https://myapp.com/register' });
|
|
162
|
-
|
|
163
|
-
// Submit empty form
|
|
164
|
-
await testdriver.find('Submit button').click();
|
|
165
|
-
|
|
166
|
-
// Verify validation errors
|
|
167
|
-
await testdriver.assert('Email is required error is shown');
|
|
168
|
-
await testdriver.assert('Password is required error is shown');
|
|
169
|
-
|
|
170
|
-
// Fill valid data
|
|
171
|
-
await testdriver.find('email input').type('test@example.com');
|
|
172
|
-
await testdriver.find('password input').type('SecurePass123!');
|
|
173
|
-
|
|
174
|
-
// Submit again
|
|
175
|
-
await testdriver.find('Submit button').click();
|
|
176
|
-
|
|
177
|
-
await testdriver.assert('Registration successful');
|
|
178
|
-
});
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### API Integration Testing
|
|
182
|
-
|
|
183
|
-
```javascript
|
|
184
|
-
import { test } from 'vitest';
|
|
185
|
-
import { TestDriver } from 'testdriverai/vitest/hooks';
|
|
186
|
-
|
|
187
|
-
test('data fetching and display', async (context) => {
|
|
188
|
-
const testdriver = TestDriver(context, { headless: true });
|
|
189
|
-
|
|
190
|
-
await testdriver.provision.chrome({ url: 'https://api-demo.example.com' });
|
|
191
|
-
|
|
192
|
-
// Trigger data fetch
|
|
193
|
-
await testdriver.find('Load Data button').click();
|
|
194
|
-
|
|
195
|
-
// Wait for loading state
|
|
196
|
-
await testdriver.assert('Loading spinner is visible');
|
|
197
|
-
|
|
198
|
-
// Wait for data to load
|
|
199
|
-
await testdriver.assert('Data table is populated');
|
|
200
|
-
|
|
201
|
-
// Verify specific data
|
|
202
|
-
await testdriver.assert('First row contains expected data');
|
|
203
|
-
});
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### Responsive Design Testing
|
|
207
|
-
|
|
208
|
-
```javascript
|
|
209
|
-
import { test } from 'vitest';
|
|
210
|
-
import { TestDriver } from 'testdriverai/vitest/hooks';
|
|
211
|
-
|
|
212
|
-
test('mobile menu', async (context) => {
|
|
213
|
-
const testdriver = TestDriver(context, { headless: true });
|
|
214
|
-
|
|
215
|
-
await testdriver.provision.chrome({ url: 'https://responsive.example.com' });
|
|
216
|
-
|
|
217
|
-
// Resize to mobile
|
|
218
|
-
await testdriver.exec('sh', 'xdotool getactivewindow windowsize 375 667', 5000);
|
|
219
|
-
|
|
220
|
-
// Open mobile menu
|
|
221
|
-
await testdriver.find('hamburger menu icon').click();
|
|
222
|
-
|
|
223
|
-
// Navigate in mobile menu
|
|
224
|
-
await testdriver.find('Products in mobile menu').click();
|
|
225
|
-
|
|
226
|
-
await testdriver.assert('Products page is displayed');
|
|
227
|
-
});
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
## Browser Support
|
|
231
|
-
|
|
232
|
-
Currently supports Chrome:
|
|
233
|
-
|
|
234
|
-
```javascript
|
|
235
|
-
// ✅ Supported
|
|
236
|
-
const testdriver = TestDriver(context, { headless: true });
|
|
237
|
-
await testdriver.provision.chrome({ url: 'https://myapp.com' });
|
|
238
|
-
|
|
239
|
-
// ❌ Not yet supported
|
|
240
|
-
const { testdriver } = await webApp(context, {
|
|
241
|
-
browser: 'firefox' // Throws error
|
|
242
|
-
});
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
Future releases will add support for Firefox, Edge, and Safari.
|
|
246
|
-
|
|
247
|
-
## What It Does
|
|
248
|
-
|
|
249
|
-
When you call `webApp()`, it automatically:
|
|
250
|
-
|
|
251
|
-
1. **Validates Browser** - Checks that requested browser is supported
|
|
252
|
-
2. **Delegates to Browser Preset** - Currently uses the Chrome preset
|
|
253
|
-
3. **Returns Standard Interface** - Provides consistent API regardless of browser
|
|
254
|
-
|
|
255
|
-
All the heavy lifting is done by the underlying browser preset (currently `chrome()`).
|
|
256
|
-
|
|
257
|
-
## When to Use
|
|
258
|
-
|
|
259
|
-
Use `webApp()` when:
|
|
260
|
-
|
|
261
|
-
- You want browser-agnostic code (for future multi-browser support)
|
|
262
|
-
- You're testing a generic web application
|
|
263
|
-
- You prefer semantic naming over specific browser names
|
|
264
|
-
|
|
265
|
-
Use `chrome()` directly when:
|
|
266
|
-
|
|
267
|
-
- You need Chrome-specific features
|
|
268
|
-
- You want explicit browser control
|
|
269
|
-
- You're testing Chrome extensions or Chrome-specific behavior
|
|
270
|
-
|
|
271
|
-
## Using with provision()
|
|
272
|
-
|
|
273
|
-
The `webApp()` preset can also be called via the unified `provision()` function:
|
|
274
|
-
|
|
275
|
-
```javascript
|
|
276
|
-
import { provision } from 'testdriverai/presets';
|
|
277
|
-
|
|
278
|
-
test('using provision', async (context) => {
|
|
279
|
-
const { testdriver } = await provision('webapp', {
|
|
280
|
-
url: 'https://example.com',
|
|
281
|
-
browser: 'chrome'
|
|
282
|
-
}, context);
|
|
283
|
-
|
|
284
|
-
// Same functionality as webApp() directly
|
|
285
|
-
});
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
## Migration Path
|
|
289
|
-
|
|
290
|
-
If you're currently using `chrome()` for web app testing, you can easily switch to `webApp()`:
|
|
291
|
-
|
|
292
|
-
```javascript
|
|
293
|
-
// Before
|
|
294
|
-
import { chrome } from 'testdriverai/presets';
|
|
295
|
-
const { testdriver } = await chrome(context, { url });
|
|
296
|
-
|
|
297
|
-
// After
|
|
298
|
-
import { webApp } from 'testdriverai/presets';
|
|
299
|
-
const { testdriver } = await webApp(context, { url, browser: 'chrome' });
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
The behavior is identical, but `webApp()` provides a more generic interface for future browser additions.
|
|
303
|
-
|
|
304
|
-
## Common Patterns
|
|
305
|
-
|
|
306
|
-
### Authentication Flow
|
|
307
|
-
|
|
308
|
-
```javascript
|
|
309
|
-
test('login and navigate', async (context) => {
|
|
310
|
-
const testdriver = TestDriver(context, { headless: true });
|
|
311
|
-
|
|
312
|
-
await testdriver.provision.chrome({ url: 'https://myapp.com' });
|
|
313
|
-
|
|
314
|
-
// Login
|
|
315
|
-
await testdriver.find('email').type('user@example.com');
|
|
316
|
-
await testdriver.find('password').type('password');
|
|
317
|
-
await testdriver.find('Login').click();
|
|
318
|
-
|
|
319
|
-
// Wait for redirect
|
|
320
|
-
await testdriver.assert('Dashboard is loaded');
|
|
321
|
-
|
|
322
|
-
// Navigate authenticated area
|
|
323
|
-
await testdriver.find('Settings').click();
|
|
324
|
-
await testdriver.assert('Settings page is loaded');
|
|
325
|
-
});
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
### File Upload
|
|
329
|
-
|
|
330
|
-
```javascript
|
|
331
|
-
test('upload file', async (context) => {
|
|
332
|
-
const testdriver = TestDriver(context, { headless: true });
|
|
333
|
-
|
|
334
|
-
await testdriver.provision.chrome({ url: 'https://upload.example.com' });
|
|
335
|
-
|
|
336
|
-
// Click upload button
|
|
337
|
-
await testdriver.find('Upload file button').click();
|
|
338
|
-
|
|
339
|
-
// Type file path in file dialog
|
|
340
|
-
await testdriver.type('/tmp/test-file.pdf');
|
|
341
|
-
await testdriver.pressKeys(['enter']);
|
|
342
|
-
|
|
343
|
-
// Verify upload
|
|
344
|
-
await testdriver.assert('File uploaded successfully');
|
|
345
|
-
});
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
### Search and Filter
|
|
349
|
-
|
|
350
|
-
```javascript
|
|
351
|
-
test('search with filters', async (context) => {
|
|
352
|
-
const testdriver = TestDriver(context, { headless: true });
|
|
353
|
-
|
|
354
|
-
await testdriver.provision.chrome({ url: 'https://catalog.example.com' });
|
|
355
|
-
|
|
356
|
-
// Enter search query
|
|
357
|
-
await testdriver.find('search input').type('laptop');
|
|
358
|
-
|
|
359
|
-
// Apply filters
|
|
360
|
-
await testdriver.find('Price filter').click();
|
|
361
|
-
await testdriver.find('$500 - $1000').click();
|
|
362
|
-
|
|
363
|
-
await testdriver.find('Brand filter').click();
|
|
364
|
-
await testdriver.find('Dell').click();
|
|
365
|
-
|
|
366
|
-
// Submit search
|
|
367
|
-
await testdriver.find('Search button').click();
|
|
368
|
-
|
|
369
|
-
await testdriver.assert('Filtered results are displayed');
|
|
370
|
-
});
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
## Error Handling
|
|
374
|
-
|
|
375
|
-
```javascript
|
|
376
|
-
test('handles unsupported browser', async (context) => {
|
|
377
|
-
try {
|
|
378
|
-
const { testdriver } = await webApp(context, {
|
|
379
|
-
browser: 'firefox' // Not yet supported
|
|
380
|
-
});
|
|
381
|
-
} catch (error) {
|
|
382
|
-
expect(error.message).toContain('not yet implemented');
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
## See Also
|
|
388
|
-
|
|
389
|
-
- [Provision API](/v7/progressive-apis/PROVISION) - Overview of all presets
|
|
390
|
-
- [Chrome Preset](/v7/presets/chrome) - Direct Chrome testing
|
|
391
|
-
- [VS Code Preset](/v7/presets/vscode) - Testing VS Code extensions
|
|
392
|
-
- [Electron Preset](/v7/presets/electron) - Testing Electron apps
|
|
393
|
-
- [Vitest Integration](/v7/guides/vitest) - Complete Vitest setup guide
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|