testdriverai 7.11.262-test → 7.11.264-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,46 @@
1
+ /**
2
+ * Loads the Dark Reader extension into Chrome, opens a light website, and
3
+ * checks that switching the extension off and on from its popup changes the page.
4
+ */
5
+ import { describe, expect, it } from "vitest";
6
+ import { TestDriver } from "../lib/vitest/hooks.mjs";
7
+
8
+ describe("Dark Reader (Chrome extension)", () => {
9
+ it("turns a light page dark from the extension popup", async (context) => {
10
+ const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP });
11
+
12
+ // Download Dark Reader from the Chrome Web Store and start Chrome with it loaded.
13
+ await testdriver.provision.chromeExtension({ extensionId: "eimadpbcbfnmbkopoojfekhnkhdbieeh" });
14
+
15
+ // Open a plain, light website.
16
+ await testdriver.pressKeys(["ctrl", "l"]);
17
+ await testdriver.type("https://example.com");
18
+ await testdriver.pressKeys(["enter"]);
19
+ await testdriver.find('the "Example Domain" heading on the page', { timeout: 30000 });
20
+
21
+ // Open the Dark Reader popup from the Extensions menu.
22
+ await testdriver.find("the puzzle-piece Extensions button at the right end of the Chrome toolbar").click();
23
+ await testdriver.find('"Dark Reader" in the Extensions menu').click();
24
+ await testdriver.find("the Dark Reader popup window", { timeout: 15000 });
25
+
26
+ // Switch the extension off. The page should go back to its normal light colors.
27
+ await testdriver.find('the "Off" option of the On/Off switch at the top of the Dark Reader popup').click();
28
+ await testdriver.pressKeys(["escape"]);
29
+ const lightPage = await testdriver.assert(
30
+ 'the "Example Domain" page has a light background with dark text',
31
+ );
32
+ expect(lightPage).toBeTruthy();
33
+
34
+ // Open the popup again and switch the extension on.
35
+ await testdriver.find("the puzzle-piece Extensions button at the right end of the Chrome toolbar").click();
36
+ await testdriver.find('"Dark Reader" in the Extensions menu').click();
37
+ await testdriver.find('the "On" option of the On/Off switch at the top of the Dark Reader popup').click();
38
+ await testdriver.pressKeys(["escape"]);
39
+
40
+ // The same page is now dark.
41
+ const darkPage = await testdriver.assert(
42
+ 'the "Example Domain" page has a dark background with light text',
43
+ );
44
+ expect(darkPage).toBeTruthy();
45
+ });
46
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "7.11.262-test",
3
+ "version": "7.11.264-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",