86 lines
3.6 KiB
Python
86 lines
3.6 KiB
Python
#!/usr/bin/env python3
|
|
"""V116 E2E - Test DASHBOARDS tab with 70 tiles + category filtering"""
|
|
import asyncio, json, os
|
|
from playwright.async_api import async_playwright
|
|
|
|
OUT = "/var/www/html/api/blade-tasks/v116-dashboards-tab-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=v116", wait_until='load', timeout=30000)
|
|
await page.wait_for_timeout(2000)
|
|
|
|
# Click DASHBOARDS tab
|
|
await page.click('[data-view="dashboards"]')
|
|
await page.wait_for_timeout(3500) # wait for fetch + render
|
|
|
|
# Verify rendered
|
|
state = await page.evaluate("""() => {
|
|
const tiles = document.querySelectorAll('#dash-grid a');
|
|
const filters = document.querySelectorAll('.dash-filter');
|
|
const stats = document.querySelectorAll('#dash-stats > div');
|
|
return {
|
|
tiles_count: tiles.length,
|
|
filters_count: filters.length,
|
|
stats_count: stats.length,
|
|
view_on: document.getElementById('v-dashboards')?.classList.contains('on'),
|
|
first_tiles: Array.from(tiles).slice(0,5).map(t => ({
|
|
href: t.getAttribute('href'),
|
|
text: t.textContent.trim().substring(0,80)
|
|
})),
|
|
filter_labels: Array.from(filters).map(f => f.textContent.trim())
|
|
};
|
|
}""")
|
|
print("V116 Dashboards tab state:")
|
|
print(json.dumps(state, indent=2))
|
|
|
|
await page.screenshot(path=f"{OUT}/01-all-70-tiles.png", full_page=True)
|
|
|
|
# Test filter: click on "pharma" category
|
|
pharma_btn = await page.query_selector('button[data-cat="pharma"]')
|
|
if pharma_btn:
|
|
await pharma_btn.click()
|
|
await page.wait_for_timeout(1500)
|
|
filtered = await page.evaluate("""() => ({
|
|
count: document.querySelectorAll('#dash-grid a').length,
|
|
tiles: Array.from(document.querySelectorAll('#dash-grid a')).map(t => t.querySelector('div:nth-child(2)').textContent.trim())
|
|
})""")
|
|
print("\nFiltered pharma:", json.dumps(filtered, indent=2))
|
|
await page.screenshot(path=f"{OUT}/02-filter-pharma.png", full_page=True)
|
|
|
|
# Test filter: infra
|
|
infra_btn = await page.query_selector('button[data-cat="infra"]')
|
|
if infra_btn:
|
|
await infra_btn.click()
|
|
await page.wait_for_timeout(1500)
|
|
filtered2 = await page.evaluate("""() => ({
|
|
count: document.querySelectorAll('#dash-grid a').length
|
|
})""")
|
|
print("\nFiltered infra:", json.dumps(filtered2))
|
|
await page.screenshot(path=f"{OUT}/03-filter-infra.png", full_page=True)
|
|
|
|
await context.close()
|
|
await browser.close()
|
|
|
|
report = {
|
|
'v116': 'dashboards-tab-70-tiles',
|
|
'tiles_shown': state['tiles_count'],
|
|
'filters_shown': state['filters_count'],
|
|
'stats_shown': state['stats_count'],
|
|
'view_active': state['view_on'],
|
|
'VERDICT': 'WIRED' if state['tiles_count'] >= 60 else 'PARTIAL'
|
|
}
|
|
with open(f"{OUT}/proof.json",'w') as f:
|
|
json.dump(report, f, indent=2)
|
|
print("\n=== VERDICT:", report['VERDICT'])
|
|
|
|
asyncio.run(main())
|