Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

test: add e2e for keyboard-type humanize into the focused element (#633)

Luigi Agosti8cb65bdefab1
diff --git a/tests/e2e/scenarios/api/keyboard-focus-basic.sh b/tests/e2e/scenarios/api/keyboard-focus-basic.sh
new file mode 100644
index 00000000..ec2f8e33
--- /dev/null
+++ b/tests/e2e/scenarios/api/keyboard-focus-basic.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+GROUP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+source "${GROUP_DIR}/../../helpers/api.sh"
+
+start_test "keyboard-type humanize types into the focused element (#633)"
+
+pt_post /navigate -d "{\"url\":\"${FIXTURES_URL}/form.html\"}"
+assert_ok "navigate to form fixture"
+
+pt_post /action -d '{"kind":"click","selector":"#username"}'
+assert_ok "focus the username input"
+
+pt_post /action -d '{"kind":"keyboard-type","text":"hello633","humanize":true}'
+assert_ok "humanized keyboard-type into the focused element (no selector)"
+
+pt_post /evaluate -d "{\"expression\":\"document.querySelector('#username').value\"}"
+assert_ok "read the focused input value"
+assert_result_eq '.result' 'hello633' 'humanized keyboard-type value persisted in the focused input'
+
+end_test
diff --git a/tests/e2e/scenarios/manifest.json b/tests/e2e/scenarios/manifest.json
index be7173c0..56574025 100644
--- a/tests/e2e/scenarios/manifest.json
+++ b/tests/e2e/scenarios/manifest.json
@@ -1,5 +1,12 @@
{
"scenarios": {
+ "api/keyboard-focus-basic.sh": {
+ "tags": [
+ "keyboard",
+ "kbfocus",
+ "pr"
+ ]
+ },
"api/tab-budget-basic.sh": {
"tags": [
"tabs",