chore: auto-commit (57 archivos)

- frontend/functions/core/format_datetime_short.md
- frontend/functions/core/format_datetime_short.test.ts
- frontend/functions/core/format_datetime_short.ts
- frontend/functions/core/format_duration.md
- frontend/functions/core/format_duration.test.ts
- frontend/functions/core/format_duration.ts
- frontend/functions/core/month_grid.md
- frontend/functions/core/month_grid.test.ts
- frontend/functions/core/month_grid.ts
- frontend/functions/core/string_hash_palette.md
- ...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-09 03:41:58 +02:00
parent 4d5a5bd3ea
commit 8618aa1be3
58 changed files with 2923 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
package browser
// CdpSetCookie establece una cookie en el browser via Network.setCookie.
// Util para autenticar tests e2e contra apps con sesion HttpOnly: hacer login
// HTTP en el test, capturar el Set-Cookie, y propagar al browser antes de navegar.
//
// name/value/domain son obligatorios. path por defecto "/". httpOnly true por
// defecto (replica HttpOnly de la app). secure y sameSite opcionales.
func CdpSetCookie(c *CDPConn, name, value, domain, path string, httpOnly bool) error {
if path == "" {
path = "/"
}
params := map[string]any{
"name": name,
"value": value,
"domain": domain,
"path": path,
"httpOnly": httpOnly,
}
_, err := c.sendCDP("Network.setCookie", params)
return err
}
+49
View File
@@ -0,0 +1,49 @@
---
id: cdp_set_cookie_go_browser
name: cdp_set_cookie
kind: function
lang: go
domain: browser
purity: impure
version: 1.0.0
tested: false
description: "Establece una cookie en el browser via Network.setCookie del protocolo CDP. Soporta cookies HttpOnly. Util para tests e2e que necesitan autenticar el browser sin pasar por la UI de login."
tags: [cdp, browser, cookie, e2e, auth]
signature: "func CdpSetCookie(c *CDPConn, name, value, domain, path string, httpOnly bool) error"
uses_functions: []
uses_types:
- cdp_conn_go_browser
returns: ""
returns_optional: false
error_type: error_go_core
imports: []
file_path: "functions/browser/cdp_set_cookie.go"
example: |
conn, _ := browser.CdpConnect(9222)
defer browser.CdpClose(conn, 0)
// Tras hacer login HTTP en el test:
if err := browser.CdpSetCookie(conn, "session", token, "localhost", "/", true); err != nil {
log.Fatal(err)
}
browser.CdpNavigate(conn, "http://localhost:8080/dashboard")
params:
- name: c
desc: Conexion CDP abierta (de CdpConnect)
- name: name
desc: Nombre de la cookie
- name: value
desc: Valor de la cookie (token de sesion, etc.)
- name: domain
desc: Dominio sin protocolo (ej. "localhost", "example.com")
- name: path
desc: Path scope. Vacio se trata como "/"
- name: httpOnly
desc: Si true, cookie HttpOnly (no accesible desde JS)
output: "error si Network.setCookie falla; nil en exito"
---
## Notas
- Network.setCookie es un comando CDP nativo, no requiere JS evaluate.
- Permite cookies HttpOnly que `document.cookie` no puede setear desde JS.
- Necesita que el dominio coincida con la URL a la que se navegara despues.