@testdriverai/agent 7.9.0 → 7.9.1-canary
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/agent/lib/sandbox.js +55 -6
- package/agent/lib/sdk.js +4 -4
- package/ai/skills/testdriver-enterprise/SKILL.md +2 -109
- package/ai/skills/testdriver-hosted/SKILL.md +156 -0
- package/ai/skills/testdriver-mcp/SKILL.md +2 -2
- package/ai/skills/testdriver-quickstart/SKILL.md +30 -2
- package/ai/skills/testdriver-self-hosted/SKILL.md +125 -43
- package/ai/skills/testdriver-test-results-json/SKILL.md +257 -0
- package/docs/_scripts/generate-examples.js +127 -60
- package/docs/docs.json +27 -28
- package/docs/v7/examples/ai.mdx +4 -3
- package/docs/v7/examples/assert.mdx +19 -4
- package/docs/v7/examples/chrome-extension.mdx +36 -29
- package/docs/v7/examples/element-not-found.mdx +2 -1
- package/docs/v7/examples/exec-output.mdx +3 -4
- package/docs/v7/examples/exec-pwsh.mdx +3 -4
- package/docs/v7/examples/findall-coffee-icons.mdx +88 -0
- package/docs/v7/examples/focus-window.mdx +3 -4
- package/docs/v7/examples/hover-image.mdx +4 -3
- package/docs/v7/examples/hover-text-with-description.mdx +104 -0
- package/docs/v7/examples/hover-text.mdx +4 -3
- package/docs/v7/examples/installer.mdx +5 -4
- package/docs/v7/examples/launch-vscode-linux.mdx +3 -7
- package/docs/v7/examples/match-image.mdx +3 -2
- package/docs/v7/examples/parse.mdx +66 -0
- package/docs/v7/examples/press-keys.mdx +8 -14
- package/docs/v7/examples/scroll-keyboard.mdx +4 -3
- package/docs/v7/examples/scroll-until-image.mdx +3 -2
- package/docs/v7/examples/scroll.mdx +6 -14
- package/docs/v7/examples/type.mdx +1 -5
- package/docs/v7/examples/windows-installer.mdx +10 -4
- package/interfaces/vitest-plugin.mjs +2 -2
- package/lib/core/Dashcam.js +4 -1
- package/lib/sentry.js +5 -1
- package/package.json +1 -1
- package/setup/aws/install-dev-runner.sh +7 -2
- package/setup/aws/spawn-runner.sh +12 -0
- package/vitest.config.mjs +1 -1
|
@@ -297,8 +297,9 @@ function updateExistingMDX(existingContent, filename, testcaseId) {
|
|
|
297
297
|
const replayUrl = generateReplayUrl(testcaseId);
|
|
298
298
|
|
|
299
299
|
// Pattern to match the marker followed by the iframe tag
|
|
300
|
+
const escapedFilename = filename.replace(/\./g, '\\.');
|
|
300
301
|
const pattern = new RegExp(
|
|
301
|
-
`(\\{/\\* ${
|
|
302
|
+
`(\\{/\\* ${escapedFilename} output \\*/\\}\\s*)<iframe[^>]*src="[^"]*"([^]*?)/>`,
|
|
302
303
|
's'
|
|
303
304
|
);
|
|
304
305
|
|
|
@@ -312,6 +313,25 @@ function updateExistingMDX(existingContent, filename, testcaseId) {
|
|
|
312
313
|
return updated;
|
|
313
314
|
}
|
|
314
315
|
|
|
316
|
+
// Update the source code block in an existing MDX file with fresh content from the test file
|
|
317
|
+
function updateSourceCodeBlock(existingContent, testMeta) {
|
|
318
|
+
const escapedFilename = testMeta.filename.replace(/\./g, '\\.');
|
|
319
|
+
const codeBlockPattern = new RegExp(
|
|
320
|
+
'(```javascript\\s+title="' + escapedFilename + '"[^\\n]*\\n)[\\s\\S]*?(\\n```)',
|
|
321
|
+
''
|
|
322
|
+
);
|
|
323
|
+
|
|
324
|
+
const match = existingContent.match(codeBlockPattern);
|
|
325
|
+
if (!match) {
|
|
326
|
+
return null;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return existingContent.replace(
|
|
330
|
+
codeBlockPattern,
|
|
331
|
+
`$1${testMeta.content.trim()}$2`
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
|
|
315
335
|
// Generate MDX content
|
|
316
336
|
function generateMDX(testMeta, manifest, description) {
|
|
317
337
|
const slug = generateSlug(testMeta.filename);
|
|
@@ -399,13 +419,29 @@ function updateDocsNavigation(docsJson, examplePages, options) {
|
|
|
399
419
|
return false;
|
|
400
420
|
}
|
|
401
421
|
|
|
402
|
-
// Find
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
422
|
+
// Find Examples group - it may be nested inside Overview's pages
|
|
423
|
+
const examplesPages = examplePages.map((slug) => `/v7/examples/${slug}`);
|
|
424
|
+
let examplesGroup = null;
|
|
425
|
+
|
|
426
|
+
// Search top-level groups first
|
|
427
|
+
examplesGroup = v7Version.groups.find((g) =>
|
|
428
|
+
typeof g === "object" && g.group === "Examples"
|
|
406
429
|
);
|
|
407
430
|
|
|
408
|
-
|
|
431
|
+
// If not found at top level, search inside each group's pages (nested groups)
|
|
432
|
+
if (!examplesGroup) {
|
|
433
|
+
for (const group of v7Version.groups) {
|
|
434
|
+
if (group.pages) {
|
|
435
|
+
const nested = group.pages.find((p) =>
|
|
436
|
+
typeof p === "object" && p.group === "Examples"
|
|
437
|
+
);
|
|
438
|
+
if (nested) {
|
|
439
|
+
examplesGroup = nested;
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
409
445
|
|
|
410
446
|
if (examplesGroup) {
|
|
411
447
|
// Update existing group
|
|
@@ -414,20 +450,22 @@ function updateDocsNavigation(docsJson, examplePages, options) {
|
|
|
414
450
|
console.log("🔄 Updated existing Examples group in navigation");
|
|
415
451
|
}
|
|
416
452
|
} else {
|
|
417
|
-
// Create new group
|
|
418
|
-
const
|
|
453
|
+
// Create new group nested inside Overview
|
|
454
|
+
const overviewGroup = v7Version.groups.find((g) => g.group === "Overview");
|
|
419
455
|
const newGroup = {
|
|
420
456
|
group: "Examples",
|
|
421
457
|
icon: "code",
|
|
422
458
|
pages: examplesPages,
|
|
423
459
|
};
|
|
424
|
-
|
|
425
|
-
if (
|
|
426
|
-
|
|
460
|
+
|
|
461
|
+
if (overviewGroup && overviewGroup.pages) {
|
|
462
|
+
// Insert after the second page in Overview (after what-is-testdriver)
|
|
463
|
+
const insertIdx = Math.min(2, overviewGroup.pages.length);
|
|
464
|
+
overviewGroup.pages.splice(insertIdx, 0, newGroup);
|
|
427
465
|
} else {
|
|
428
466
|
v7Version.groups.push(newGroup);
|
|
429
467
|
}
|
|
430
|
-
|
|
468
|
+
|
|
431
469
|
if (options.verbose) {
|
|
432
470
|
console.log("➕ Added new Examples group to navigation");
|
|
433
471
|
}
|
|
@@ -439,7 +477,7 @@ function updateDocsNavigation(docsJson, examplePages, options) {
|
|
|
439
477
|
// Show help
|
|
440
478
|
function showHelp() {
|
|
441
479
|
console.log(`
|
|
442
|
-
Update Example Docs
|
|
480
|
+
Update Example Docs from Test Files
|
|
443
481
|
|
|
444
482
|
Usage:
|
|
445
483
|
node generate-examples.js [options]
|
|
@@ -453,12 +491,16 @@ Environment Variables:
|
|
|
453
491
|
TD_API_ROOT API root URL (default: https://api.testdriver.ai)
|
|
454
492
|
|
|
455
493
|
Description:
|
|
456
|
-
Reads
|
|
457
|
-
|
|
494
|
+
Reads example test files and updates/generates MDX documentation pages.
|
|
495
|
+
|
|
496
|
+
For existing MDX files:
|
|
497
|
+
- Updates the source code block from the test file
|
|
498
|
+
- Updates the iframe src URL from examples-manifest.json
|
|
499
|
+
|
|
500
|
+
For new test files without an MDX page:
|
|
501
|
+
- Generates a new MDX documentation page
|
|
458
502
|
|
|
459
|
-
|
|
460
|
-
The iframe following the marker will have its src updated to the
|
|
461
|
-
API replay endpoint.
|
|
503
|
+
Also updates the docs.json navigation with the current example pages.
|
|
462
504
|
`);
|
|
463
505
|
}
|
|
464
506
|
|
|
@@ -471,7 +513,7 @@ async function main() {
|
|
|
471
513
|
process.exit(0);
|
|
472
514
|
}
|
|
473
515
|
|
|
474
|
-
console.log("🚀 Updating example documentation
|
|
516
|
+
console.log("🚀 Updating example documentation...\n");
|
|
475
517
|
|
|
476
518
|
if (options.dryRun) {
|
|
477
519
|
console.log("📋 DRY RUN - no files will be written\n");
|
|
@@ -480,67 +522,92 @@ async function main() {
|
|
|
480
522
|
// Load manifest
|
|
481
523
|
const manifest = loadManifest();
|
|
482
524
|
|
|
483
|
-
// Get
|
|
484
|
-
const
|
|
485
|
-
|
|
486
|
-
: [];
|
|
525
|
+
// Get all test files
|
|
526
|
+
const testFiles = getExampleFiles();
|
|
527
|
+
console.log(`📂 Found ${testFiles.length} example test files\n`);
|
|
487
528
|
|
|
488
|
-
|
|
529
|
+
// Ensure output dir exists
|
|
530
|
+
if (!fs.existsSync(OUTPUT_DIR)) {
|
|
531
|
+
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
|
532
|
+
}
|
|
489
533
|
|
|
490
534
|
let updated = 0;
|
|
535
|
+
let created = 0;
|
|
491
536
|
let skipped = 0;
|
|
492
537
|
let errors = 0;
|
|
538
|
+
const exampleSlugs = [];
|
|
539
|
+
|
|
540
|
+
for (const file of testFiles) {
|
|
541
|
+
const filePath = path.join(EXAMPLES_DIR, file);
|
|
542
|
+
const testMeta = parseTestFile(filePath);
|
|
543
|
+
const slug = generateSlug(testMeta.filename);
|
|
544
|
+
exampleSlugs.push(slug);
|
|
493
545
|
|
|
494
|
-
|
|
495
|
-
const outputPath = path.join(OUTPUT_DIR, mdxFile);
|
|
546
|
+
const outputPath = path.join(OUTPUT_DIR, `${slug}.mdx`);
|
|
496
547
|
|
|
497
548
|
try {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
if (
|
|
506
|
-
|
|
549
|
+
if (fs.existsSync(outputPath)) {
|
|
550
|
+
// Update existing MDX file
|
|
551
|
+
let content = fs.readFileSync(outputPath, 'utf-8');
|
|
552
|
+
let changed = false;
|
|
553
|
+
|
|
554
|
+
// Update source code block from the test file
|
|
555
|
+
const sourceUpdated = updateSourceCodeBlock(content, testMeta);
|
|
556
|
+
if (sourceUpdated && sourceUpdated !== content) {
|
|
557
|
+
content = sourceUpdated;
|
|
558
|
+
changed = true;
|
|
507
559
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
console.log(`⏭️ ${mdxFile} (no URL in manifest for ${testFilename})`);
|
|
560
|
+
|
|
561
|
+
// Update iframe URL if manifest entry exists
|
|
562
|
+
const manifestEntry = manifest.examples[testMeta.filename];
|
|
563
|
+
const testcaseId = manifestEntry?.url ? extractTestcaseId(manifestEntry.url) : null;
|
|
564
|
+
if (testcaseId) {
|
|
565
|
+
const iframeUpdated = updateExistingMDX(content, testMeta.filename, testcaseId);
|
|
566
|
+
if (iframeUpdated && iframeUpdated !== content) {
|
|
567
|
+
content = iframeUpdated;
|
|
568
|
+
changed = true;
|
|
569
|
+
}
|
|
519
570
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
571
|
+
|
|
572
|
+
if (changed) {
|
|
573
|
+
if (!options.dryRun) {
|
|
574
|
+
fs.writeFileSync(outputPath, content, 'utf-8');
|
|
575
|
+
}
|
|
576
|
+
updated++;
|
|
577
|
+
console.log(`🔄 ${slug}.mdx (updated)`);
|
|
578
|
+
} else {
|
|
579
|
+
skipped++;
|
|
580
|
+
if (options.verbose) {
|
|
581
|
+
console.log(`⏭️ ${slug}.mdx (unchanged)`);
|
|
582
|
+
}
|
|
528
583
|
}
|
|
529
|
-
updated++;
|
|
530
|
-
console.log(`🔄 ${mdxFile} (updated iframe)`);
|
|
531
584
|
} else {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
585
|
+
// Generate new MDX file
|
|
586
|
+
const description = generateFallbackDescription(testMeta);
|
|
587
|
+
const mdx = generateMDX(testMeta, manifest, description);
|
|
588
|
+
if (!options.dryRun) {
|
|
589
|
+
fs.writeFileSync(outputPath, mdx, 'utf-8');
|
|
535
590
|
}
|
|
591
|
+
created++;
|
|
592
|
+
console.log(`✨ ${slug}.mdx (created)`);
|
|
536
593
|
}
|
|
537
594
|
} catch (error) {
|
|
538
|
-
console.error(`❌ ${
|
|
595
|
+
console.error(`❌ ${file}: ${error.message}`);
|
|
539
596
|
errors++;
|
|
540
597
|
}
|
|
541
598
|
}
|
|
542
599
|
|
|
600
|
+
// Update docs.json navigation
|
|
601
|
+
if (!options.dryRun) {
|
|
602
|
+
const docsJson = loadDocsJson();
|
|
603
|
+
if (updateDocsNavigation(docsJson, exampleSlugs, options)) {
|
|
604
|
+
saveDocsJson(docsJson);
|
|
605
|
+
console.log("\n📝 Updated docs.json navigation");
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
543
609
|
console.log(`\n✨ Complete!`);
|
|
610
|
+
console.log(` Created: ${created} new docs`);
|
|
544
611
|
console.log(` Updated: ${updated} docs`);
|
|
545
612
|
console.log(` Skipped: ${skipped} unchanged`);
|
|
546
613
|
if (errors > 0) {
|
package/docs/docs.json
CHANGED
|
@@ -27,28 +27,29 @@
|
|
|
27
27
|
"pages": [
|
|
28
28
|
"/v7/examples/ai",
|
|
29
29
|
"/v7/examples/assert",
|
|
30
|
-
"/v7/examples/captcha-api",
|
|
31
30
|
"/v7/examples/chrome-extension",
|
|
32
|
-
"/v7/examples/drag-and-drop",
|
|
33
31
|
"/v7/examples/element-not-found",
|
|
34
32
|
"/v7/examples/exec-output",
|
|
35
33
|
"/v7/examples/exec-pwsh",
|
|
34
|
+
"/v7/examples/findall-coffee-icons",
|
|
36
35
|
"/v7/examples/focus-window",
|
|
36
|
+
"/v7/examples/formatted-logging",
|
|
37
37
|
"/v7/examples/hover-image",
|
|
38
|
+
"/v7/examples/hover-text-with-description",
|
|
38
39
|
"/v7/examples/hover-text",
|
|
39
40
|
"/v7/examples/installer",
|
|
40
41
|
"/v7/examples/launch-vscode-linux",
|
|
41
42
|
"/v7/examples/match-image",
|
|
43
|
+
"/v7/examples/parse",
|
|
42
44
|
"/v7/examples/press-keys",
|
|
45
|
+
"/v7/examples/prompt",
|
|
43
46
|
"/v7/examples/scroll-keyboard",
|
|
44
47
|
"/v7/examples/scroll-until-image",
|
|
45
|
-
"/v7/examples/scroll-until-text",
|
|
46
48
|
"/v7/examples/scroll",
|
|
47
49
|
"/v7/examples/type",
|
|
48
50
|
"/v7/examples/windows-installer"
|
|
49
51
|
]
|
|
50
52
|
},
|
|
51
|
-
|
|
52
53
|
{
|
|
53
54
|
"group": "Deployment",
|
|
54
55
|
"icon": "server",
|
|
@@ -60,7 +61,6 @@
|
|
|
60
61
|
"/changelog"
|
|
61
62
|
]
|
|
62
63
|
},
|
|
63
|
-
|
|
64
64
|
{
|
|
65
65
|
"group": "GitHub Copilot",
|
|
66
66
|
"pages": [
|
|
@@ -106,34 +106,33 @@
|
|
|
106
106
|
}
|
|
107
107
|
]
|
|
108
108
|
},
|
|
109
|
+
{
|
|
110
|
+
"group": "Actions",
|
|
111
|
+
"pages": [
|
|
112
|
+
"/v7/ai",
|
|
113
|
+
"/v7/assert",
|
|
114
|
+
"/v7/captcha",
|
|
115
|
+
"/v7/click",
|
|
116
|
+
"/v7/double-click",
|
|
117
|
+
"/v7/exec",
|
|
118
|
+
"/v7/find",
|
|
119
|
+
"/v7/focus-application",
|
|
120
|
+
"/v7/hover",
|
|
121
|
+
"/v7/mouse-down",
|
|
122
|
+
"/v7/mouse-up",
|
|
123
|
+
"/v7/parse",
|
|
124
|
+
"/v7/press-keys",
|
|
125
|
+
"/v7/right-click",
|
|
126
|
+
"/v7/screenshot",
|
|
127
|
+
"/v7/scroll",
|
|
128
|
+
"/v7/type"
|
|
129
|
+
]
|
|
130
|
+
},
|
|
109
131
|
{
|
|
110
132
|
"group": "SDK Reference",
|
|
111
133
|
"pages": [
|
|
112
134
|
"/v7/client",
|
|
113
135
|
"/v7/elements",
|
|
114
|
-
{
|
|
115
|
-
"group": "Actions",
|
|
116
|
-
"icon": "bolt",
|
|
117
|
-
"pages": [
|
|
118
|
-
"/v7/ai",
|
|
119
|
-
"/v7/assert",
|
|
120
|
-
"/v7/captcha",
|
|
121
|
-
"/v7/click",
|
|
122
|
-
"/v7/double-click",
|
|
123
|
-
"/v7/exec",
|
|
124
|
-
"/v7/find",
|
|
125
|
-
"/v7/focus-application",
|
|
126
|
-
"/v7/hover",
|
|
127
|
-
"/v7/mouse-down",
|
|
128
|
-
"/v7/mouse-up",
|
|
129
|
-
"/v7/parse",
|
|
130
|
-
"/v7/press-keys",
|
|
131
|
-
"/v7/right-click",
|
|
132
|
-
"/v7/screenshot",
|
|
133
|
-
"/v7/scroll",
|
|
134
|
-
"/v7/type"
|
|
135
|
-
]
|
|
136
|
-
},
|
|
137
136
|
"/v7/dashcam"
|
|
138
137
|
]
|
|
139
138
|
}
|
package/docs/v7/examples/ai.mdx
CHANGED
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* ai.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api
|
|
15
|
+
src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d04ac2e6e94933886778/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -23,7 +23,8 @@ Watch this test execute in a real sandbox environment:
|
|
|
23
23
|
|
|
24
24
|
```javascript title="ai.test.mjs" {17}
|
|
25
25
|
/**
|
|
26
|
-
* TestDriver SDK - AI Test
|
|
26
|
+
* TestDriver SDK - AI Test (Vitest)
|
|
27
|
+
* Tests the AI exploratory loop (ai) functionality
|
|
27
28
|
*/
|
|
28
29
|
|
|
29
30
|
import { describe, expect, it } from "vitest";
|
|
@@ -31,7 +32,7 @@ import { TestDriver } from "testdriverai/vitest/hooks";
|
|
|
31
32
|
|
|
32
33
|
describe("AI Test", () => {
|
|
33
34
|
it("should use ai to search for testdriver on Google", async (context) => {
|
|
34
|
-
const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP
|
|
35
|
+
const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP});
|
|
35
36
|
|
|
36
37
|
// provision.chrome() automatically calls ready() and starts dashcam
|
|
37
38
|
await testdriver.provision.chrome({
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* assert.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api
|
|
15
|
+
src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d038058ffe89003c6adc/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -23,7 +23,8 @@ Watch this test execute in a real sandbox environment:
|
|
|
23
23
|
|
|
24
24
|
```javascript title="assert.test.mjs" {22-24}
|
|
25
25
|
/**
|
|
26
|
-
* TestDriver SDK - Assert Test
|
|
26
|
+
* TestDriver SDK - Assert Test (Vitest)
|
|
27
|
+
* Converted from: testdriver/acceptance/assert.yaml
|
|
27
28
|
*/
|
|
28
29
|
|
|
29
30
|
import { describe, expect, it } from "vitest";
|
|
@@ -31,8 +32,7 @@ import { TestDriver } from "testdriverai/vitest/hooks";
|
|
|
31
32
|
|
|
32
33
|
describe("Assert Test", () => {
|
|
33
34
|
it("should assert the testdriver login page shows", async (context) => {
|
|
34
|
-
const testdriver = TestDriver(context, {
|
|
35
|
-
ip: context.ip || process.env.TD_IP,
|
|
35
|
+
const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP,
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
// provision.chrome() automatically calls ready() and starts dashcam
|
|
@@ -50,6 +50,21 @@ describe("Assert Test", () => {
|
|
|
50
50
|
|
|
51
51
|
expect(result).toBeTruthy();
|
|
52
52
|
});
|
|
53
|
+
// it("should assert the testdriver login page shows 2", async (context) => {
|
|
54
|
+
// const testdriver = TestDriver(context);
|
|
55
|
+
|
|
56
|
+
// // provision.chrome() automatically calls ready() and starts dashcam
|
|
57
|
+
// await testdriver.provision.chrome({
|
|
58
|
+
// url: 'http://testdriver-sandbox.vercel.app/login',
|
|
59
|
+
// });
|
|
60
|
+
|
|
61
|
+
// // Assert the TestDriver.ai Sandbox login page is displayed
|
|
62
|
+
// const result = await testdriver.assert(
|
|
63
|
+
// "the TestDriver.ai Sandbox login page is displayed",
|
|
64
|
+
// );
|
|
65
|
+
|
|
66
|
+
// expect(result).toBeTruthy();
|
|
67
|
+
// });
|
|
53
68
|
});
|
|
54
69
|
```
|
|
55
70
|
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* chrome-extension.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api
|
|
15
|
+
src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d024c2e6e94933886763/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -23,7 +23,12 @@ Watch this test execute in a real sandbox environment:
|
|
|
23
23
|
|
|
24
24
|
```javascript title="chrome-extension.test.mjs" {31-33}
|
|
25
25
|
/**
|
|
26
|
-
* TestDriver SDK - Chrome Extension Test
|
|
26
|
+
* TestDriver SDK - Chrome Extension Test (Vitest)
|
|
27
|
+
* Tests loading a Chrome extension using provision.chromeExtension()
|
|
28
|
+
*
|
|
29
|
+
* This test suite covers:
|
|
30
|
+
* 1. Loading extension from local path (extensionPath)
|
|
31
|
+
* 2. Loading extension from Chrome Web Store (extensionId)
|
|
27
32
|
*/
|
|
28
33
|
|
|
29
34
|
import { describe, expect, it } from "vitest";
|
|
@@ -78,38 +83,40 @@ describe("Chrome Extension Test", () => {
|
|
|
78
83
|
const helloExtension = await testdriver.find("Hello Extensions extension in the extensions dropdown");
|
|
79
84
|
await helloExtension.click();
|
|
80
85
|
|
|
86
|
+
await testdriver.wait(2000); // wait for the popup to open
|
|
87
|
+
|
|
81
88
|
// Verify the extension popup shows "Hello Extensions" text
|
|
82
89
|
const popupResult = await testdriver.assert("a popup shows with the text 'Hello Extensions'");
|
|
83
90
|
expect(popupResult).toBeTruthy();
|
|
84
91
|
});
|
|
85
92
|
|
|
86
|
-
it("should load Loom from Chrome Web Store by extensionId", async (context) => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
});
|
|
93
|
+
// it("should load Loom from Chrome Web Store by extensionId", async (context) => {
|
|
94
|
+
// const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP});
|
|
95
|
+
|
|
96
|
+
// // Launch Chrome with Loom loaded by its Chrome Web Store ID
|
|
97
|
+
// // Loom ID: liecbddmkiiihnedobmlmillhodjkdmb
|
|
98
|
+
// await testdriver.provision.chromeExtension({
|
|
99
|
+
// extensionId: 'liecbddmkiiihnedobmlmillhodjkdmb'
|
|
100
|
+
// });
|
|
101
|
+
|
|
102
|
+
// // Navigate to testdriver.ai (extensions don't load on New Tab)
|
|
103
|
+
// const addressBar = await testdriver.find("Chrome address bar");
|
|
104
|
+
// await addressBar.click();
|
|
105
|
+
// await testdriver.type("testdriver.ai");
|
|
106
|
+
// await testdriver.pressKeys(["enter"]);
|
|
107
|
+
|
|
108
|
+
// // Wait for page to load
|
|
109
|
+
// const pageResult = await testdriver.assert("I can see testdriver.ai");
|
|
110
|
+
// expect(pageResult).toBeTruthy();
|
|
111
|
+
|
|
112
|
+
// // Click on the extensions button (puzzle piece icon) in Chrome toolbar
|
|
113
|
+
// const extensionsButton = await testdriver.find("The puzzle-shaped icon in the Chrome toolbar.", {zoom: true});
|
|
114
|
+
// await extensionsButton.click();
|
|
115
|
+
|
|
116
|
+
// // Look for Loom in the extensions menu
|
|
117
|
+
// const loomExtension = await testdriver.find("Loom extension in the extensions dropdown");
|
|
118
|
+
// expect(loomExtension.found()).toBeTruthy();
|
|
119
|
+
// });
|
|
113
120
|
});
|
|
114
121
|
```
|
|
115
122
|
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* element-not-found.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api
|
|
15
|
+
src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d047058ffe89003c6ae4/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -24,6 +24,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
24
24
|
```javascript title="element-not-found.test.mjs" {16-18}
|
|
25
25
|
/**
|
|
26
26
|
* TestDriver SDK - Element Not Found Test
|
|
27
|
+
* Tests that finding a non-existent element returns properly without timing out
|
|
27
28
|
*/
|
|
28
29
|
|
|
29
30
|
import { describe, expect, it } from "vitest";
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* exec-output.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api
|
|
15
|
+
src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d02ee8a04db4b705cbeb/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -28,14 +28,13 @@ Watch this test execute in a real sandbox environment:
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
import { describe, expect, it } from "vitest";
|
|
31
|
-
import { TestDriver } from "
|
|
32
|
-
import { getDefaults } from "./config.mjs";
|
|
31
|
+
import { TestDriver } from "testdriverai/vitest/hooks";
|
|
33
32
|
|
|
34
33
|
describe.skip("Exec Output Test", () => {
|
|
35
34
|
it(
|
|
36
35
|
"should set date using PowerShell and navigate to calendar",
|
|
37
36
|
async (context) => {
|
|
38
|
-
const testdriver = TestDriver(context, {
|
|
37
|
+
const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP, headless: true });
|
|
39
38
|
await testdriver.provision.chrome({ url: 'http://testdriver-sandbox.vercel.app/login' });
|
|
40
39
|
|
|
41
40
|
//
|
|
@@ -12,7 +12,7 @@ Watch this test execute in a real sandbox environment:
|
|
|
12
12
|
|
|
13
13
|
{/* exec-pwsh.test.mjs output */}
|
|
14
14
|
<iframe
|
|
15
|
-
src="https://api
|
|
15
|
+
src="https://api.testdriver.ai/api/v1/testdriver/testcase/69c5d026a0a3ef8239de4746/replay"
|
|
16
16
|
width="100%"
|
|
17
17
|
height="390"
|
|
18
18
|
style={{ border: "1px solid #333", borderRadius: "8px" }}
|
|
@@ -28,14 +28,13 @@ Watch this test execute in a real sandbox environment:
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
import { describe, expect, it } from "vitest";
|
|
31
|
-
import { TestDriver } from "
|
|
32
|
-
import { getDefaults } from "./config.mjs";
|
|
31
|
+
import { TestDriver } from "testdriverai/vitest/hooks";
|
|
33
32
|
|
|
34
33
|
describe.skip("Exec PowerShell Test", () => {
|
|
35
34
|
it(
|
|
36
35
|
"should generate random email using PowerShell and enter it",
|
|
37
36
|
async (context) => {
|
|
38
|
-
const testdriver = TestDriver(context, {
|
|
37
|
+
const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP, headless: true });
|
|
39
38
|
await testdriver.provision.chrome({ url: 'http://testdriver-sandbox.vercel.app/login' });
|
|
40
39
|
|
|
41
40
|
//
|