@testdriverai/agent 7.11.249-test → 7.11.251-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,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Uploads a file through Chrome's real file picker dialog on a public practice page
|
|
3
|
+
* and checks the page confirms the upload.
|
|
4
|
+
*/
|
|
5
|
+
import { describe, expect, it } from "vitest";
|
|
6
|
+
import { TestDriver } from "../lib/vitest/hooks.mjs";
|
|
7
|
+
|
|
8
|
+
describe("File upload (Playwright alternative)", () => {
|
|
9
|
+
it("uploads a file through the browser's file picker", async (context) => {
|
|
10
|
+
const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP });
|
|
11
|
+
|
|
12
|
+
// Create the file to upload inside the sandbox.
|
|
13
|
+
await testdriver.exec("sh", 'echo "Uploaded by a TestDriver test" > /tmp/testdriver-upload.txt', 30000);
|
|
14
|
+
|
|
15
|
+
// Open the practice upload page in Chrome.
|
|
16
|
+
await testdriver.provision.chrome({ url: "https://the-internet.herokuapp.com/upload" });
|
|
17
|
+
|
|
18
|
+
// Open the file picker the user would see.
|
|
19
|
+
await testdriver.find("the Choose File button in the File Uploader form", { timeout: 30000 }).click();
|
|
20
|
+
|
|
21
|
+
// Wait for the dialog, then type the file's path and confirm.
|
|
22
|
+
await testdriver.find("the Open File dialog title at the top of the file picker window", { timeout: 15000 });
|
|
23
|
+
await testdriver.pressKeys(["ctrl", "l"]);
|
|
24
|
+
await testdriver.type("/tmp/testdriver-upload.txt");
|
|
25
|
+
await testdriver.pressKeys(["enter"]);
|
|
26
|
+
|
|
27
|
+
// Submit the form.
|
|
28
|
+
await testdriver.find("the Upload button below the Choose File button").click();
|
|
29
|
+
|
|
30
|
+
// Wait for the result page, then check the file name.
|
|
31
|
+
await testdriver.find("the File Uploaded! heading", { timeout: 15000 });
|
|
32
|
+
const result = await testdriver.assert(
|
|
33
|
+
"the page shows the File Uploaded! heading with testdriver-upload.txt listed as the uploaded file",
|
|
34
|
+
);
|
|
35
|
+
expect(result).toBeTruthy();
|
|
36
|
+
|
|
37
|
+
// Hold the final screen so the end of the replay shows the result.
|
|
38
|
+
await testdriver.wait(3000);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Installs Apache JMeter (a Java Swing desktop app) on Linux, adds a Thread Group
|
|
3
|
+
* from the right-click menu, sets it to 5 threads and checks the value was kept.
|
|
4
|
+
*/
|
|
5
|
+
import { describe, expect, it } from "vitest";
|
|
6
|
+
import { TestDriver } from "../lib/vitest/hooks.mjs";
|
|
7
|
+
|
|
8
|
+
describe("Apache JMeter (Java Swing)", () => {
|
|
9
|
+
it("adds a Thread Group and sets it to 5 threads", async (context) => {
|
|
10
|
+
const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP });
|
|
11
|
+
|
|
12
|
+
// Install a Java runtime and unpack the JMeter release.
|
|
13
|
+
await testdriver.exec(
|
|
14
|
+
"sh",
|
|
15
|
+
"sudo apt-get update -qq && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq default-jre >/dev/null",
|
|
16
|
+
600000,
|
|
17
|
+
);
|
|
18
|
+
await testdriver.exec(
|
|
19
|
+
"sh",
|
|
20
|
+
"curl -fsSL -o /tmp/jmeter.tgz https://dlcdn.apache.org/jmeter/binaries/apache-jmeter-5.6.3.tgz && tar -xzf /tmp/jmeter.tgz -C /tmp",
|
|
21
|
+
300000,
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
// Start the replay recording, then launch the app.
|
|
25
|
+
await testdriver.provision.dashcam({ title: "Apache JMeter (Java Swing) Thread Group", webLogs: false });
|
|
26
|
+
await testdriver.exec("sh", "cd /tmp && nohup /tmp/apache-jmeter-5.6.3/bin/jmeter >/tmp/jmeter.log 2>&1 &", 10000);
|
|
27
|
+
|
|
28
|
+
// Wait for the main window, then right-click Test Plan.
|
|
29
|
+
const testPlan = await testdriver.find(
|
|
30
|
+
"the Test Plan item at the top of the tree on the left side of the Apache JMeter window",
|
|
31
|
+
{ timeout: 90000 },
|
|
32
|
+
);
|
|
33
|
+
await testPlan.rightClick();
|
|
34
|
+
|
|
35
|
+
// Add > Threads (Users) > Thread Group.
|
|
36
|
+
await testdriver.find("the Add item at the top of the right-click menu").click();
|
|
37
|
+
await testdriver.find("the Threads (Users) item in the Add submenu").click();
|
|
38
|
+
await testdriver.find("the Thread Group item in the Threads (Users) submenu").click();
|
|
39
|
+
|
|
40
|
+
// Change Number of Threads from 1 to 5.
|
|
41
|
+
await testdriver.find("the Number of Threads (users) text field showing 1 in the Thread Properties section").click();
|
|
42
|
+
await testdriver.pressKeys(["ctrl", "a"]);
|
|
43
|
+
await testdriver.type("5");
|
|
44
|
+
|
|
45
|
+
// Click away and back to make sure the value is kept.
|
|
46
|
+
await testdriver.find("the Test Plan item at the top of the tree on the left side of the Apache JMeter window").click();
|
|
47
|
+
await testdriver.find("the Thread Group item under Test Plan in the tree on the left").click();
|
|
48
|
+
|
|
49
|
+
// Wait for the panel, then check the saved value.
|
|
50
|
+
await testdriver.find("the Number of Threads (users) text field showing 5 in the Thread Properties section", {
|
|
51
|
+
timeout: 15000,
|
|
52
|
+
});
|
|
53
|
+
const saved = await testdriver.assert(
|
|
54
|
+
"the JMeter window shows the Thread Group settings panel with the Number of Threads (users) field set to 5",
|
|
55
|
+
);
|
|
56
|
+
expect(saved).toBeTruthy();
|
|
57
|
+
|
|
58
|
+
// Hold the final screen so the end of the replay shows the result.
|
|
59
|
+
await testdriver.wait(3000);
|
|
60
|
+
});
|
|
61
|
+
});
|