81 lines
3.8 KiB
Python
81 lines
3.8 KiB
Python
#!/usr/bin/env python3
|
|
"""V119 E2E - Test search + sort on DASHBOARDS tab"""
|
|
import asyncio, json, os
|
|
from playwright.async_api import async_playwright
|
|
|
|
OUT = "/var/www/html/api/blade-tasks/v119-search-proof"
|
|
os.makedirs(OUT, exist_ok=True)
|
|
|
|
async def main():
|
|
async with async_playwright() as p:
|
|
browser = await p.chromium.launch(headless=True, args=['--no-sandbox'])
|
|
context = await browser.new_context(viewport={'width':1920,'height':1080}, record_video_dir=OUT)
|
|
page = await context.new_page()
|
|
|
|
await page.goto("https://weval-consulting.com/all-ia-hub.html?v=v119", wait_until='load', timeout=30000)
|
|
await page.wait_for_timeout(2000)
|
|
await page.click('[data-view="dashboards"]')
|
|
await page.wait_for_timeout(3000)
|
|
|
|
# Initial state
|
|
initial = await page.evaluate("""() => ({
|
|
tiles: document.querySelectorAll('#dash-grid a').length,
|
|
has_search: !!document.getElementById('dash-search'),
|
|
has_sort: !!document.getElementById('dash-sort'),
|
|
count_text: document.getElementById('dash-count')?.textContent
|
|
})""")
|
|
print("Initial:", json.dumps(initial))
|
|
await page.screenshot(path=f"{OUT}/01-initial.png", full_page=True)
|
|
|
|
# Test search "ethica"
|
|
await page.fill('#dash-search', 'ethica')
|
|
await page.wait_for_timeout(500)
|
|
search_eth = await page.evaluate("""() => ({
|
|
tiles: document.querySelectorAll('#dash-grid a').length,
|
|
count_text: document.getElementById('dash-count')?.textContent,
|
|
first_3: Array.from(document.querySelectorAll('#dash-grid a')).slice(0,3).map(a => a.querySelector('div:nth-child(2)')?.textContent.trim())
|
|
})""")
|
|
print("Search 'ethica':", json.dumps(search_eth, indent=2))
|
|
await page.screenshot(path=f"{OUT}/02-search-ethica.png", full_page=True)
|
|
|
|
# Test search "kpi"
|
|
await page.fill('#dash-search', 'kpi')
|
|
await page.wait_for_timeout(500)
|
|
search_kpi = await page.evaluate("""() => ({
|
|
tiles: document.querySelectorAll('#dash-grid a').length,
|
|
count_text: document.getElementById('dash-count')?.textContent
|
|
})""")
|
|
print("Search 'kpi':", json.dumps(search_kpi))
|
|
await page.screenshot(path=f"{OUT}/03-search-kpi.png", full_page=True)
|
|
|
|
# Clear + sort by size
|
|
await page.fill('#dash-search', '')
|
|
await page.wait_for_timeout(300)
|
|
await page.select_option('#dash-sort', 'size')
|
|
await page.wait_for_timeout(500)
|
|
sort_size = await page.evaluate("""() => ({
|
|
tiles: document.querySelectorAll('#dash-grid a').length,
|
|
first_3_names: Array.from(document.querySelectorAll('#dash-grid a')).slice(0,3).map(a => a.querySelector('div:nth-child(3)')?.textContent.trim())
|
|
})""")
|
|
print("Sort by size:", json.dumps(sort_size, indent=2))
|
|
await page.screenshot(path=f"{OUT}/04-sort-size.png", full_page=True)
|
|
|
|
await context.close()
|
|
await browser.close()
|
|
|
|
verdict = 'WIRED' if (initial['has_search'] and initial['has_sort'] and
|
|
search_eth['tiles'] > 0 and search_eth['tiles'] < 20 and
|
|
search_kpi['tiles'] > 0 and search_kpi['tiles'] < 20) else 'PARTIAL'
|
|
report = {
|
|
'v119': 'search-sort-ux',
|
|
'initial_tiles': initial['tiles'],
|
|
'search_ethica_tiles': search_eth['tiles'],
|
|
'search_kpi_tiles': search_kpi['tiles'],
|
|
'sort_size_working': sort_size['tiles'] > 0,
|
|
'VERDICT': verdict
|
|
}
|
|
with open(f"{OUT}/proof.json",'w') as f: json.dump(report, f, indent=2)
|
|
print("=== VERDICT:", verdict)
|
|
|
|
asyncio.run(main())
|