47 lines
1.8 KiB
Python
Raw Normal View History

# retoor <retoor@molodetz.nl>
from tests.conftest import BASE_URL
from devplacepy.database import get_table, refresh_snapshot
def _clear_isslop_data():
refresh_snapshot()
jobs = get_table("jobs")
for row in list(jobs.find(kind="isslop")):
jobs.delete(uid=row["uid"])
analyses = get_table("isslop_analyses")
for row in list(analyses.find()):
analyses.delete(uid=row["uid"])
def test_isslop_page_loads(page, app_server):
page.goto(f"{BASE_URL}/tools/isslop", wait_until="domcontentloaded")
page.locator("[data-isslop-tool]").wait_for(state="visible")
page.locator("[data-isslop-form] input[name='url']").wait_for(state="visible")
page.locator("[data-isslop-run]").wait_for(state="visible")
page.locator(".isslop-history-title").wait_for(state="visible")
def test_isslop_tools_menu_links_to_page(page, app_server):
page.goto(f"{BASE_URL}/tools", wait_until="domcontentloaded")
Report every test failure in one pass and fix the whole suite The suite ran with -x, so a run stopped at the first failure and finding N failures cost N full runs. Move -rf into the pytest addopts so every run lists each failure, and add the triage targets test-fast (unit + api, no browser), test-failed (--last-failed), test-first-failure (the old -x), test-slowest and test-cache-clean. A stale .pytest_cache holding node ids from deleted files made --last-failed select everything; make clean and test-cache-clean drop it. Fix the fifteen failures this surfaced. DeepSearch crawling raised AttributeError in its finally block on every run: async_playwright().__aenter__() returns a Playwright, which has no __aexit__. Use start()/stop() at both call sites. Update the tests left behind by changed signatures: VectorStore is async now, fetch_page takes a browser, _summary_payload takes dom_evidence, and the messages/notifications page compounds take a user_uid. Close four real flakes that fail-fast had been hiding, all of them late in the run. Harvest assertions pinned crop.reward_coins while is_golden pays five times on about five percent of harvests, so they now assert through realizable_harvest_coins with the observed golden flag. Market saturation fixtures assumed a single active farm and landed two tiers milder once the api and e2e tiers had created farms, so they scale by active_farms(). The primary-administrator container test raced the one second cross-worker cache version window and now waits for the server to agree. The isslop tools test matched the collapsed nav dropdown link instead of the tools grid card. Stop burning ninety seconds waiting out server-side display caches: DEVPLACE_RANKING_TTL and DEVPLACE_MARKET_SATURATION_TTL follow the existing sitemap and home cache precedent and are zero for the suite, taking the leaderboard test from 60.6s to 4.4s and the saturation test from 30.1s to under a second. 2881 passed, 1 skipped in 15:13.
2026-07-26 16:02:36 +02:00
card = page.locator(".tools-grid a.tool-card[href='/tools/isslop']")
card.wait_for(state="visible")
Report every test failure in one pass and fix the whole suite The suite ran with -x, so a run stopped at the first failure and finding N failures cost N full runs. Move -rf into the pytest addopts so every run lists each failure, and add the triage targets test-fast (unit + api, no browser), test-failed (--last-failed), test-first-failure (the old -x), test-slowest and test-cache-clean. A stale .pytest_cache holding node ids from deleted files made --last-failed select everything; make clean and test-cache-clean drop it. Fix the fifteen failures this surfaced. DeepSearch crawling raised AttributeError in its finally block on every run: async_playwright().__aenter__() returns a Playwright, which has no __aexit__. Use start()/stop() at both call sites. Update the tests left behind by changed signatures: VectorStore is async now, fetch_page takes a browser, _summary_payload takes dom_evidence, and the messages/notifications page compounds take a user_uid. Close four real flakes that fail-fast had been hiding, all of them late in the run. Harvest assertions pinned crop.reward_coins while is_golden pays five times on about five percent of harvests, so they now assert through realizable_harvest_coins with the observed golden flag. Market saturation fixtures assumed a single active farm and landed two tiers milder once the api and e2e tiers had created farms, so they scale by active_farms(). The primary-administrator container test raced the one second cross-worker cache version window and now waits for the server to agree. The isslop tools test matched the collapsed nav dropdown link instead of the tools grid card. Stop burning ninety seconds waiting out server-side display caches: DEVPLACE_RANKING_TTL and DEVPLACE_MARKET_SATURATION_TTL follow the existing sitemap and home cache precedent and are zero for the suite, taking the leaderboard test from 60.6s to 4.4s and the saturation test from 30.1s to under a second. 2881 passed, 1 skipped in 15:13.
2026-07-26 16:02:36 +02:00
assert "AI Usage Analyzer" in card.inner_text()
def test_isslop_submit_opens_live_report(alice):
page, _user = alice
try:
page.goto(f"{BASE_URL}/tools/isslop", wait_until="domcontentloaded")
page.locator("[data-isslop-form] input[name='url']").fill(
"https://github.com/owner/repository"
)
page.locator("[data-isslop-run]").click()
page.wait_for_url("**/tools/isslop/*/report", wait_until="domcontentloaded")
page.locator("dp-isslop-run").wait_for(state="attached")
page.locator("[data-isslop-report] .sidebar-card").wait_for(state="visible")
page.locator(".breadcrumb").wait_for(state="visible")
page.locator(".isslop-feed-loader").wait_for(state="visible")
finally:
_clear_isslop_data()