167 lines
7.3 KiB
Python
167 lines
7.3 KiB
Python
"""
|
|
Script automatizado para capturar pantallas de demostración en alta resolución
|
|
utilizando Playwright con inyección directa de tokens JWT contra el servidor de producción:
|
|
https://eduspace.oemspot.com.ar
|
|
"""
|
|
import os
|
|
import time
|
|
import json
|
|
import ssl
|
|
import urllib.request
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
OUTPUT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "docs", "entregables", "capturas"))
|
|
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
|
|
|
BASE_URL = "https://eduspace.oemspot.com.ar"
|
|
|
|
ctx = ssl.create_default_context()
|
|
ctx.check_hostname = False
|
|
ctx.verify_mode = ssl.CERT_NONE
|
|
|
|
def get_admin_token():
|
|
req = urllib.request.Request(
|
|
f"{BASE_URL}/api/v1/auth/login",
|
|
data=json.dumps({"email": "admin@edu-space.com", "password": "Unicaba2026*"}).encode("utf-8"),
|
|
headers={"Content-Type": "application/json"}
|
|
)
|
|
with urllib.request.urlopen(req, context=ctx) as r:
|
|
return json.loads(r.read().decode("utf-8"))["access_token"]
|
|
|
|
def get_carlos_tello_token():
|
|
req = urllib.request.Request(
|
|
f"{BASE_URL}/api/v1/auth/moodle",
|
|
data=json.dumps({"username": "34247025", "password": "34247025"}).encode("utf-8"),
|
|
headers={"Content-Type": "application/json"}
|
|
)
|
|
with urllib.request.urlopen(req, context=ctx) as r:
|
|
return json.loads(r.read().decode("utf-8"))["access_token"]
|
|
|
|
def main():
|
|
print("[*] Obteniendo tokens de acceso autenticados...")
|
|
admin_token = get_admin_token()
|
|
tello_token = get_carlos_tello_token()
|
|
print("[+] Tokens obtenidos exitosamente.")
|
|
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.launch(headless=True)
|
|
|
|
# -------------------------------------------------------------
|
|
# 1. PANTALLA DE LOGIN INSTITUCIONAL (Sin cookies)
|
|
# -------------------------------------------------------------
|
|
print("[1/12] Capturando Login Institucional...")
|
|
public_ctx = browser.new_context(viewport={"width": 1440, "height": 900}, ignore_https_errors=True)
|
|
page_pub = public_ctx.new_page()
|
|
page_pub.goto(f"{BASE_URL}/auth/login")
|
|
page_pub.wait_for_load_state("networkidle")
|
|
time.sleep(1)
|
|
page_pub.screenshot(path=os.path.join(OUTPUT_DIR, "01_login_institucional.png"))
|
|
public_ctx.close()
|
|
|
|
# -------------------------------------------------------------
|
|
# 2 A 7 Y 10 A 12: SESIÓN ADMINISTRATIVA / BEDELÍA
|
|
# -------------------------------------------------------------
|
|
admin_ctx = browser.new_context(viewport={"width": 1440, "height": 900}, ignore_https_errors=True)
|
|
admin_ctx.add_cookies([{"name": "auth_token", "value": admin_token, "domain": "eduspace.oemspot.com.ar", "path": "/"}])
|
|
page = admin_ctx.new_page()
|
|
|
|
# 2. Dashboard de Bedelía
|
|
print("[2/12] Capturando Dashboard Operativo de Bedelía...")
|
|
page.goto(f"{BASE_URL}/dashboard?role=bedelia")
|
|
page.wait_for_load_state("networkidle")
|
|
time.sleep(1.5)
|
|
page.screenshot(path=os.path.join(OUTPUT_DIR, "02_dashboard_bedelia.png"))
|
|
|
|
# 3. Cartelera Operativa de Clases de Hoy
|
|
print("[3/12] Capturando Cartelera de Clases de Hoy...")
|
|
page.goto(f"{BASE_URL}/schedule/today_schedule")
|
|
page.wait_for_load_state("networkidle")
|
|
time.sleep(1.5)
|
|
page.screenshot(path=os.path.join(OUTPUT_DIR, "03_cartelera_clases_hoy.png"))
|
|
|
|
# 4. Grilla Semanal Interactiva (Drag & Drop)
|
|
print("[4/12] Capturando Grilla Semanal de Calendario...")
|
|
page.goto(f"{BASE_URL}/schedule/calendar")
|
|
page.wait_for_load_state("networkidle")
|
|
time.sleep(2)
|
|
page.screenshot(path=os.path.join(OUTPUT_DIR, "04_grilla_semanal_calendario.png"))
|
|
|
|
# 5. Optimizador Genético de Aulas IA
|
|
print("[5/12] Capturando Optimizador Genético de Aulas IA...")
|
|
page.goto(f"{BASE_URL}/genetic_optimizer")
|
|
page.wait_for_load_state("networkidle")
|
|
time.sleep(2)
|
|
page.screenshot(path=os.path.join(OUTPUT_DIR, "05_optimizador_genetico_ia.png"))
|
|
|
|
# 6. Catálogo de Aulas Físicas y Virtuales
|
|
print("[6/12] Capturando Catálogo de Aulas y Sedes...")
|
|
page.goto(f"{BASE_URL}/classrooms/list_classrooms")
|
|
page.wait_for_load_state("networkidle")
|
|
time.sleep(1.5)
|
|
page.screenshot(path=os.path.join(OUTPUT_DIR, "06_catalogo_aulas_y_sedes.png"))
|
|
|
|
# 7. Módulo de Convenios y Beneficios
|
|
print("[7/12] Capturando Módulo de Beneficios...")
|
|
page.goto(f"{BASE_URL}/benefits")
|
|
page.wait_for_load_state("networkidle")
|
|
time.sleep(1.5)
|
|
page.screenshot(path=os.path.join(OUTPUT_DIR, "07_modulo_convenios_beneficios.png"))
|
|
|
|
# 10. Consola de Recepción y Control de Accesos
|
|
print("[10/12] Capturando Consola de Recepción Inicial...")
|
|
page.goto(f"{BASE_URL}/reception/scanner")
|
|
page.wait_for_load_state("networkidle")
|
|
time.sleep(1.5)
|
|
page.screenshot(path=os.path.join(OUTPUT_DIR, "10_consola_recepcion_scanner.png"))
|
|
|
|
# 11. Consola de Recepción con Escaneo de DNI de Carlos Tello
|
|
print("[11/12] Simulando escaneo de DNI 34247025 y capturando validación...")
|
|
scanner_input = page.query_selector("#scannerInput")
|
|
if scanner_input:
|
|
scanner_input.fill("34247025")
|
|
scanner_input.press("Enter")
|
|
time.sleep(2)
|
|
page.screenshot(path=os.path.join(OUTPUT_DIR, "11_recepcion_escaneo_carlos_tello.png"))
|
|
|
|
# 12. Documentación OpenAPI Swagger UI
|
|
print("[12/12] Capturando Swagger UI (/docs)...")
|
|
page.goto(f"{BASE_URL}/docs")
|
|
page.wait_for_load_state("networkidle")
|
|
time.sleep(2)
|
|
page.screenshot(path=os.path.join(OUTPUT_DIR, "12_swagger_openapi_docs.png"))
|
|
|
|
# Asistente virtual UdeCi
|
|
print("[9/12] Capturando Asistente Virtual UdeCi...")
|
|
page.goto(f"{BASE_URL}/dashboard?role=admin")
|
|
page.wait_for_load_state("networkidle")
|
|
time.sleep(1)
|
|
chat_btn = page.query_selector("#udeciChatTrigger, #chatToggleBtn, .chat-launcher, #openChatBtn")
|
|
if chat_btn:
|
|
try:
|
|
chat_btn.click()
|
|
time.sleep(1.5)
|
|
except Exception as e:
|
|
print(f"[!] Info chat toggle: {e}")
|
|
page.screenshot(path=os.path.join(OUTPUT_DIR, "09_asistente_virtual_udeci.png"))
|
|
|
|
admin_ctx.close()
|
|
|
|
# -------------------------------------------------------------
|
|
# 8. CREDENCIAL DIGITAL UNIVERSITARIA DE CARLOS TELLO (Alumno)
|
|
# -------------------------------------------------------------
|
|
print("[8/12] Capturando Carnet Universitario Digital con QR de Carlos Tello...")
|
|
tello_ctx = browser.new_context(viewport={"width": 1440, "height": 900}, ignore_https_errors=True)
|
|
tello_ctx.add_cookies([{"name": "auth_token", "value": tello_token, "domain": "eduspace.oemspot.com.ar", "path": "/"}])
|
|
page_tello = tello_ctx.new_page()
|
|
page_tello.goto(f"{BASE_URL}/credential/my-card")
|
|
page_tello.wait_for_load_state("networkidle")
|
|
time.sleep(2)
|
|
page_tello.screenshot(path=os.path.join(OUTPUT_DIR, "08_credencial_digital_carlos_tello.png"))
|
|
tello_ctx.close()
|
|
|
|
browser.close()
|
|
print("[+] ¡Todas las capturas se han generado exitosamente en docs/entregables/capturas!")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|