@openqa/cli 2.1.0 → 2.1.1
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/dist/agent/index-v2.js +33 -55
- package/dist/agent/index-v2.js.map +1 -1
- package/dist/agent/index.js +85 -116
- package/dist/agent/index.js.map +1 -1
- package/dist/cli/daemon.js +86 -71
- package/dist/cli/dashboard.html.js +53 -16
- package/dist/cli/index.js +53 -16
- package/dist/cli/server.js +53 -16
- package/package.json +1 -1
package/dist/agent/index-v2.js
CHANGED
|
@@ -1486,13 +1486,9 @@ var BrowserTools = class {
|
|
|
1486
1486
|
{
|
|
1487
1487
|
name: "navigate_to_page",
|
|
1488
1488
|
description: "Navigate to a specific URL in the application",
|
|
1489
|
-
parameters:
|
|
1490
|
-
type: "
|
|
1491
|
-
|
|
1492
|
-
url: { type: "string", description: "The URL to navigate to" }
|
|
1493
|
-
},
|
|
1494
|
-
required: ["url"]
|
|
1495
|
-
},
|
|
1489
|
+
parameters: [
|
|
1490
|
+
{ name: "url", type: "string", description: "The URL to navigate to", required: true }
|
|
1491
|
+
],
|
|
1496
1492
|
execute: async ({ url }) => {
|
|
1497
1493
|
if (!this.page) await this.initialize();
|
|
1498
1494
|
try {
|
|
@@ -1505,24 +1501,20 @@ var BrowserTools = class {
|
|
|
1505
1501
|
input: url,
|
|
1506
1502
|
output: `Page title: ${title}`
|
|
1507
1503
|
});
|
|
1508
|
-
return `Successfully navigated to ${url}. Page title: "${title}"
|
|
1504
|
+
return { output: `Successfully navigated to ${url}. Page title: "${title}"` };
|
|
1509
1505
|
} catch (error) {
|
|
1510
|
-
return `Failed to navigate: ${error instanceof Error ? error.message : String(error)}
|
|
1506
|
+
return { output: `Failed to navigate: ${error instanceof Error ? error.message : String(error)}`, error: error instanceof Error ? error.message : String(error) };
|
|
1511
1507
|
}
|
|
1512
1508
|
}
|
|
1513
1509
|
},
|
|
1514
1510
|
{
|
|
1515
1511
|
name: "click_element",
|
|
1516
1512
|
description: "Click on an element using a CSS selector",
|
|
1517
|
-
parameters:
|
|
1518
|
-
type: "
|
|
1519
|
-
|
|
1520
|
-
selector: { type: "string", description: "CSS selector of the element to click" }
|
|
1521
|
-
},
|
|
1522
|
-
required: ["selector"]
|
|
1523
|
-
},
|
|
1513
|
+
parameters: [
|
|
1514
|
+
{ name: "selector", type: "string", description: "CSS selector of the element to click", required: true }
|
|
1515
|
+
],
|
|
1524
1516
|
execute: async ({ selector }) => {
|
|
1525
|
-
if (!this.page) return "Browser not initialized. Navigate to a page first.";
|
|
1517
|
+
if (!this.page) return { output: "Browser not initialized. Navigate to a page first.", error: "Browser not initialized" };
|
|
1526
1518
|
try {
|
|
1527
1519
|
await this.page.click(selector, { timeout: 5e3 });
|
|
1528
1520
|
this.db.createAction({
|
|
@@ -1531,25 +1523,21 @@ var BrowserTools = class {
|
|
|
1531
1523
|
description: `Clicked element: ${selector}`,
|
|
1532
1524
|
input: selector
|
|
1533
1525
|
});
|
|
1534
|
-
return `Successfully clicked element: ${selector}
|
|
1526
|
+
return { output: `Successfully clicked element: ${selector}` };
|
|
1535
1527
|
} catch (error) {
|
|
1536
|
-
return `Failed to click element: ${error instanceof Error ? error.message : String(error)}
|
|
1528
|
+
return { output: `Failed to click element: ${error instanceof Error ? error.message : String(error)}`, error: error instanceof Error ? error.message : String(error) };
|
|
1537
1529
|
}
|
|
1538
1530
|
}
|
|
1539
1531
|
},
|
|
1540
1532
|
{
|
|
1541
1533
|
name: "fill_input",
|
|
1542
1534
|
description: "Fill an input field with text",
|
|
1543
|
-
parameters:
|
|
1544
|
-
type: "
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
text: { type: "string", description: "Text to fill in the input" }
|
|
1548
|
-
},
|
|
1549
|
-
required: ["selector", "text"]
|
|
1550
|
-
},
|
|
1535
|
+
parameters: [
|
|
1536
|
+
{ name: "selector", type: "string", description: "CSS selector of the input field", required: true },
|
|
1537
|
+
{ name: "text", type: "string", description: "Text to fill in the input", required: true }
|
|
1538
|
+
],
|
|
1551
1539
|
execute: async ({ selector, text }) => {
|
|
1552
|
-
if (!this.page) return "Browser not initialized. Navigate to a page first.";
|
|
1540
|
+
if (!this.page) return { output: "Browser not initialized. Navigate to a page first.", error: "Browser not initialized" };
|
|
1553
1541
|
try {
|
|
1554
1542
|
await this.page.fill(selector, text);
|
|
1555
1543
|
this.db.createAction({
|
|
@@ -1558,24 +1546,20 @@ var BrowserTools = class {
|
|
|
1558
1546
|
description: `Filled input ${selector}`,
|
|
1559
1547
|
input: `${selector} = ${text}`
|
|
1560
1548
|
});
|
|
1561
|
-
return `Successfully filled input ${selector} with text
|
|
1549
|
+
return { output: `Successfully filled input ${selector} with text` };
|
|
1562
1550
|
} catch (error) {
|
|
1563
|
-
return `Failed to fill input: ${error instanceof Error ? error.message : String(error)}
|
|
1551
|
+
return { output: `Failed to fill input: ${error instanceof Error ? error.message : String(error)}`, error: error instanceof Error ? error.message : String(error) };
|
|
1564
1552
|
}
|
|
1565
1553
|
}
|
|
1566
1554
|
},
|
|
1567
1555
|
{
|
|
1568
1556
|
name: "take_screenshot",
|
|
1569
1557
|
description: "Take a screenshot of the current page for evidence",
|
|
1570
|
-
parameters:
|
|
1571
|
-
type: "
|
|
1572
|
-
|
|
1573
|
-
name: { type: "string", description: "Name for the screenshot file" }
|
|
1574
|
-
},
|
|
1575
|
-
required: ["name"]
|
|
1576
|
-
},
|
|
1558
|
+
parameters: [
|
|
1559
|
+
{ name: "name", type: "string", description: "Name for the screenshot file", required: true }
|
|
1560
|
+
],
|
|
1577
1561
|
execute: async ({ name }) => {
|
|
1578
|
-
if (!this.page) return "Browser not initialized. Navigate to a page first.";
|
|
1562
|
+
if (!this.page) return { output: "Browser not initialized. Navigate to a page first.", error: "Browser not initialized" };
|
|
1579
1563
|
try {
|
|
1580
1564
|
const filename = `${Date.now()}_${name}.png`;
|
|
1581
1565
|
const path2 = join4(this.screenshotDir, filename);
|
|
@@ -1586,38 +1570,32 @@ var BrowserTools = class {
|
|
|
1586
1570
|
description: `Screenshot: ${name}`,
|
|
1587
1571
|
screenshot_path: path2
|
|
1588
1572
|
});
|
|
1589
|
-
return `Screenshot saved: ${path2}
|
|
1573
|
+
return { output: `Screenshot saved: ${path2}` };
|
|
1590
1574
|
} catch (error) {
|
|
1591
|
-
return `Failed to take screenshot: ${error instanceof Error ? error.message : String(error)}
|
|
1575
|
+
return { output: `Failed to take screenshot: ${error instanceof Error ? error.message : String(error)}`, error: error instanceof Error ? error.message : String(error) };
|
|
1592
1576
|
}
|
|
1593
1577
|
}
|
|
1594
1578
|
},
|
|
1595
1579
|
{
|
|
1596
1580
|
name: "get_page_content",
|
|
1597
1581
|
description: "Get the text content of the current page",
|
|
1598
|
-
parameters:
|
|
1599
|
-
type: "object",
|
|
1600
|
-
properties: {}
|
|
1601
|
-
},
|
|
1582
|
+
parameters: [],
|
|
1602
1583
|
execute: async () => {
|
|
1603
|
-
if (!this.page) return "Browser not initialized. Navigate to a page first.";
|
|
1584
|
+
if (!this.page) return { output: "Browser not initialized. Navigate to a page first.", error: "Browser not initialized" };
|
|
1604
1585
|
try {
|
|
1605
1586
|
const content = await this.page.textContent("body");
|
|
1606
|
-
return content?.slice(0, 1e3) || "No content found";
|
|
1587
|
+
return { output: content?.slice(0, 1e3) || "No content found" };
|
|
1607
1588
|
} catch (error) {
|
|
1608
|
-
return `Failed to get content: ${error instanceof Error ? error.message : String(error)}
|
|
1589
|
+
return { output: `Failed to get content: ${error instanceof Error ? error.message : String(error)}`, error: error instanceof Error ? error.message : String(error) };
|
|
1609
1590
|
}
|
|
1610
1591
|
}
|
|
1611
1592
|
},
|
|
1612
1593
|
{
|
|
1613
1594
|
name: "check_console_errors",
|
|
1614
1595
|
description: "Check for JavaScript console errors on the page",
|
|
1615
|
-
parameters:
|
|
1616
|
-
type: "object",
|
|
1617
|
-
properties: {}
|
|
1618
|
-
},
|
|
1596
|
+
parameters: [],
|
|
1619
1597
|
execute: async () => {
|
|
1620
|
-
if (!this.page) return "Browser not initialized. Navigate to a page first.";
|
|
1598
|
+
if (!this.page) return { output: "Browser not initialized. Navigate to a page first.", error: "Browser not initialized" };
|
|
1621
1599
|
const errors = [];
|
|
1622
1600
|
this.page.on("console", (msg) => {
|
|
1623
1601
|
if (msg.type() === "error") {
|
|
@@ -1626,10 +1604,10 @@ var BrowserTools = class {
|
|
|
1626
1604
|
});
|
|
1627
1605
|
await this.page.waitForTimeout(2e3);
|
|
1628
1606
|
if (errors.length > 0) {
|
|
1629
|
-
return `Found ${errors.length} console errors:
|
|
1630
|
-
${errors.join("\n")}
|
|
1607
|
+
return { output: `Found ${errors.length} console errors:
|
|
1608
|
+
${errors.join("\n")}` };
|
|
1631
1609
|
}
|
|
1632
|
-
return "No console errors detected";
|
|
1610
|
+
return { output: "No console errors detected" };
|
|
1633
1611
|
}
|
|
1634
1612
|
}
|
|
1635
1613
|
];
|