testdriverai 7.11.272-canary → 7.11.273-test

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.
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Clicks a link that opens a new browser tab, checks the new tab's content,
3
+ * then switches back to the first tab the way a user would.
4
+ */
5
+ import { describe, expect, it } from "vitest";
6
+ import { TestDriver } from "../lib/vitest/hooks.mjs";
7
+
8
+ describe("New tab (Cypress alternative)", () => {
9
+ it("follows a link into a new tab and comes back", async (context) => {
10
+ const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP });
11
+
12
+ // Open the practice page in Chrome.
13
+ await testdriver.provision.chrome({ url: "https://the-internet.herokuapp.com/windows" });
14
+
15
+ // Click the link that opens a new tab.
16
+ await testdriver.find("the Click Here link below the Opening a new window heading", { timeout: 30000 }).click();
17
+
18
+ // Wait for the new tab, then check what it shows.
19
+ await testdriver.find("the New Window heading", { timeout: 15000 });
20
+ const newTab = await testdriver.assert(
21
+ "the browser shows a second tab and the page says New Window",
22
+ );
23
+ expect(newTab).toBeTruthy();
24
+
25
+ // Go back to the first tab.
26
+ await testdriver.find("the first browser tab, titled The Internet, in the tab strip").click();
27
+
28
+ // Check the original page is showing again.
29
+ await testdriver.find("the Opening a new window heading", { timeout: 15000 });
30
+ const firstTab = await testdriver.assert(
31
+ "the page shows the Opening a new window heading with the Click Here link",
32
+ );
33
+ expect(firstTab).toBeTruthy();
34
+
35
+ // Hold the final screen so the end of the replay shows the result.
36
+ await testdriver.wait(3000);
37
+ });
38
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "7.11.272-canary",
3
+ "version": "7.11.273-test",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "sdk.js",
6
6
  "types": "sdk.d.ts",