docs: refresh operator runbook and creatives copy after prod cutover
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
55
scripts/smoke_create_creative.py
Normal file
55
scripts/smoke_create_creative.py
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Create a test creative draft while logged in as marketing@."""
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
ROOT = Path("/Users/4ventures/4ventures-client-portal")
|
||||
SHOT = ROOT / "scripts/dokploy-shots"
|
||||
APP = "https://app.4ventures.es"
|
||||
CREDS = ROOT / ".ops" / "marketing-credentials.txt"
|
||||
|
||||
|
||||
def load_creds():
|
||||
email, password = "marketing@4ventures.es", ""
|
||||
for line in CREDS.read_text().splitlines():
|
||||
if line.startswith("email="):
|
||||
email = line.split("=", 1)[1].strip()
|
||||
if line.startswith("password="):
|
||||
password = line.split("=", 1)[1].strip()
|
||||
return email, password
|
||||
|
||||
|
||||
def main() -> int:
|
||||
email, password = load_creds()
|
||||
with sync_playwright() as p:
|
||||
browser = p.chromium.launch(headless=True)
|
||||
page = browser.new_page(viewport={"width": 1400, "height": 1100})
|
||||
page.goto(f"{APP}/login", wait_until="networkidle", timeout=90000)
|
||||
page.locator('input[type="email"], input[name="email"]').first.fill(email)
|
||||
page.locator('input[type="password"]').first.fill(password)
|
||||
page.locator('button[type="submit"]').first.click()
|
||||
page.wait_for_timeout(3500)
|
||||
page.goto(f"{APP}/dashboard/creatives", wait_until="networkidle", timeout=60000)
|
||||
page.wait_for_timeout(1500)
|
||||
page.locator("input").first.fill("Smoke test · borrador operador")
|
||||
page.get_by_role("button", name=re.compile(r"Crear borrador", re.I)).click()
|
||||
page.wait_for_timeout(2500)
|
||||
page.screenshot(path=str(SHOT / "creatives_after_create.png"), full_page=True)
|
||||
body = page.inner_text("body")
|
||||
ok = "Smoke test" in body and "draft" in body.lower()
|
||||
print("created_visible", ok, flush=True)
|
||||
if "error" in body.lower() and "Smoke test" not in body:
|
||||
print("body", body[-400:].replace("\n", " | "), flush=True)
|
||||
browser.close()
|
||||
return 2
|
||||
browser.close()
|
||||
return 0 if ok else 3
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user