High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
test: add e2e for upload into a file input in an open shadow root
Bosch3556cf5b62ef
diff --git a/tests/e2e/fixtures/upload-shadow.html b/tests/e2e/fixtures/upload-shadow.htmlnew file mode 100644index 00000000..18e5d055--- /dev/null+++ b/tests/e2e/fixtures/upload-shadow.html@@ -0,0 +1,38 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <title>E2E Test - Upload (Open Shadow Root)</title>+</head>+<body>+ <h1>Upload Shadow Root Test</h1>++ <!-- The file input lives inside a custom element's OPEN shadow root, so a plain+ document.querySelector('#shadow-file') returns null. The upload selector+ resolver must walk open shadow roots (deepQueryAll) to find it (#591). -->+ <upload-widget></upload-widget>++ <div id="status">files:0</div>++ <script>+ window.__uploadedNames = "";+ class UploadWidget extends HTMLElement {+ constructor() {+ super();+ const root = this.attachShadow({ mode: "open" });+ const input = document.createElement("input");+ input.type = "file";+ input.id = "shadow-file";+ input.name = "file";+ input.multiple = true;+ root.appendChild(input);+ input.addEventListener("change", () => {+ document.getElementById("status").textContent = "files:" + input.files.length;+ window.__uploadedNames = Array.from(input.files).map((f) => f.name).join(",");+ });+ }+ }+ customElements.define("upload-widget", UploadWidget);+ </script>+</body>+</html>diff --git a/tests/e2e/scenarios/api/files-extended.sh b/tests/e2e/scenarios/api/files-extended.shindex 9c72d8d4..eb2e7058 100644--- a/tests/e2e/scenarios/api/files-extended.sh+++ b/tests/e2e/scenarios/api/files-extended.sh@@ -59,6 +59,24 @@ assert_contains "$RESULT" "too many files" "too many files message returned"end_test+# ─────────────────────────────────────────────────────────────────+start_test "upload: selector inside open shadow root (#591)"++pt_post /navigate "{\"url\":\"${FIXTURES_URL}/upload-shadow.html\"}"+assert_ok "navigate to upload-shadow.html"++# The file input is nested in a custom element's open shadow root, so a plain+# document.querySelector('#shadow-file') returns null — the selector resolver+# must walk open shadow roots (deepQueryAll) to find it.+pt_post /upload '{"selector":"#shadow-file","files":["data:text/plain;base64,SGVsbG8="]}'+assert_ok "upload resolves a selector inside an open shadow root"++# Confirm the file actually landed on the shadow-root input.+pt_post /evaluate '{"expression":"document.querySelector(\"upload-widget\").shadowRoot.getElementById(\"shadow-file\").files.length"}'+assert_json_eq "$RESULT" ".result" "1" "file landed on the shadow-root input"++end_test+# Migrated from: tests/integration/pdf_test.go (PD1-PD12)pt_post /navigate "{\"url\":\"${FIXTURES_URL}/table.html\"}"