testdriverai 7.11.257-test → 7.11.259-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,48 @@
1
+ /**
2
+ * Tests a login form end-to-end: a wrong password shows an error, the right one
3
+ * reaches the welcome screen, and logging out returns to an empty form.
4
+ */
5
+ import { describe, expect, it } from "vitest";
6
+ import { TestDriver } from "../lib/vitest/hooks.mjs";
7
+
8
+ describe("Login form (TestDriver Playground)", () => {
9
+ it("rejects a wrong password, logs in and logs out", async (context) => {
10
+ const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP });
11
+
12
+ await testdriver.provision.chrome({ url: "https://testdriver.ai/playground/login/" });
13
+
14
+ // Try the demo username with a wrong password.
15
+ await testdriver.find("the Username input field below the demo credentials box", { timeout: 30000 }).click();
16
+ await testdriver.type("demo");
17
+ await testdriver.find("the Password input field below the Username field").click();
18
+ await testdriver.type("wrong-password");
19
+ await testdriver.pressKeys(["enter"]);
20
+
21
+ // The form should refuse it and clear the password.
22
+ await testdriver.find("the red error message saying Incorrect username or password", { timeout: 10000 });
23
+ const rejected = await testdriver.assert(
24
+ 'the login form shows the error message "Incorrect username or password." and the password field is empty',
25
+ );
26
+ expect(rejected).toBeTruthy();
27
+
28
+ // Enter the right password and submit.
29
+ await testdriver.find("the empty Password input field above the red error message").click();
30
+ await testdriver.type("testdriver");
31
+ await testdriver.pressKeys(["enter"]);
32
+
33
+ // The welcome screen replaces the form.
34
+ await testdriver.find("the Welcome, demo! heading", { timeout: 10000 });
35
+ const loggedIn = await testdriver.assert(
36
+ 'the page shows "Welcome, demo!" with the text "You are logged in." and a Log out button, and the sign-in form is gone',
37
+ );
38
+ expect(loggedIn).toBeTruthy();
39
+
40
+ // Log out and check the form comes back empty.
41
+ await testdriver.find("the Log out button below You are logged in").click();
42
+ await testdriver.find("the Sign in heading above the demo credentials box", { timeout: 10000 });
43
+ const loggedOut = await testdriver.assert(
44
+ "the Sign in form is shown again with empty Username and Password fields and no error message",
45
+ );
46
+ expect(loggedOut).toBeTruthy();
47
+ });
48
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "7.11.257-test",
3
+ "version": "7.11.259-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",