High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
test(e2e): add JS submit handler fixture and tests for #411
Mariodd8f94eb2af6
diff --git a/tests/e2e/fixtures/js-submit.html b/tests/e2e/fixtures/js-submit.htmlnew file mode 100644index 00000000..5d1d7d86--- /dev/null+++ b/tests/e2e/fixtures/js-submit.html@@ -0,0 +1,45 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <title>E2E Test - JS Submit Handler</title>+</head>+<body>+ <h1>JS Submit Handler Test</h1>+ <!--+ This fixture simulates frameworks like Odoo where form submission+ is handled exclusively by a JS 'submit' event listener.+ Calling form.submit() directly bypasses the listener and produces+ no visible result — the submit event MUST be dispatched.+ -->+ <form id="login-form">+ <label for="username">Username</label>+ <input type="text" id="username" name="username">++ <label for="password">Password</label>+ <input type="password" id="password" name="password">++ <button type="submit" id="submit-btn">Sign In</button>+ </form>++ <div id="result"></div>++ <script>+ // Intercept the submit event — this is the ONLY way this form produces output.+ // A raw form.submit() call (without the event) will not set #result.+ document.getElementById('login-form').addEventListener('submit', function(e) {+ e.preventDefault();+ var user = document.getElementById('username').value;+ var pass = document.getElementById('password').value;+ var el = document.getElementById('result');+ if (user === 'admin' && pass === 'secret') {+ el.id = 'result-success';+ el.textContent = 'LOGIN_SUCCESS';+ } else {+ el.id = 'result-failure';+ el.textContent = 'LOGIN_FAILURE';+ }+ });+ </script>+</body>+</html>diff --git a/tests/e2e/scenarios-cli/actions-full.sh b/tests/e2e/scenarios-cli/actions-full.shindex 4797cea9..5d88a530 100644--- a/tests/e2e/scenarios-cli/actions-full.sh+++ b/tests/e2e/scenarios-cli/actions-full.sh@@ -158,6 +158,38 @@ assert_json_field ".result" "192.168.1.100" "multiple dots preserved"end_test+# ─────────────────────────────────────────────────────────────────+start_test "pinchtab click submit button fires JS submit handler (#411)"++# Issue #411: clicking a submit button must dispatch the full event chain+# (mousedown, mouseup, click, submit) so JS-only form handlers run.+# Regression: bare CDP click skipped the 'submit' event, causing a timeout+# on frameworks like Odoo that rely on addEventListener('submit').++pt_ok nav "${FIXTURES_URL}/js-submit.html"+pt_ok fill "#username" "admin"+pt_ok fill "#password" "secret"+pt_ok click "--css" "#submit-btn"++# The JS submit handler must have fired and written LOGIN_SUCCESS to #result.+pt_ok eval "document.getElementById('result-success')?.textContent"+assert_json_field ".result" "LOGIN_SUCCESS" "JS submit handler fired on button click"++end_test++# ─────────────────────────────────────────────────────────────────+start_test "pinchtab click submit button with wrong creds shows failure (#411)"++pt_ok nav "${FIXTURES_URL}/js-submit.html"+pt_ok fill "#username" "wrong"+pt_ok fill "#password" "wrong"+pt_ok click "--css" "#submit-btn"++pt_ok eval "document.getElementById('result-failure')?.textContent"+assert_json_field ".result" "LOGIN_FAILURE" "JS submit handler fired and returned failure"++end_test+# ─────────────────────────────────────────────────────────────────start_test "pinchtab keyboard type handles long strings (#413)"