750b7abcd5
- .claude/CLAUDE.md - .claude/agents/fn-recopilador/SKILL.md - .claude/rules/INDEX.md - .claude/rules/cpp_apps.md - bash/functions/infra/build_cpp_windows.sh - cpp/CMakeLists.txt - cpp/PATTERNS.md - cpp/framework/app_base.cpp - cpp/framework/app_base.h - dev/issues/README.md - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
28 lines
901 B
Go
28 lines
901 B
Go
package browser
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// TestCdpFindByText_buildsSelectorScript verifica que el script JS que se
|
|
// envia a Chrome contiene los campos esperados de FindByTextOpts. No requiere
|
|
// Chrome — solo inspecciona la estructura del JS via el comportamiento de
|
|
// nil-conexion. Tests reales contra Chrome viven gateados por env var.
|
|
func TestCdpFindByText_buildsSelectorScript(t *testing.T) {
|
|
// Conexion nula → error claro.
|
|
if _, err := CdpFindByText(nil, "x", FindByTextOpts{}); err == nil {
|
|
t.Fatal("expected error on nil conn")
|
|
}
|
|
}
|
|
|
|
func TestCdpFindByText_emptyText(t *testing.T) {
|
|
// Conexion no nil pero texto vacio → error.
|
|
c := &CDPConn{}
|
|
if _, err := CdpFindByText(c, "", FindByTextOpts{}); err == nil {
|
|
t.Fatal("expected error on empty text")
|
|
} else if !strings.Contains(err.Error(), "vacio") {
|
|
t.Fatalf("error message no menciona vacio: %v", err)
|
|
}
|
|
}
|