PWA + test: manifest, icon, live-search test (were left uncommitted)
This commit is contained in:
1 parent
67274aed7d
commit
3f715434f0
3 files changed
+37
No files matched your search
@@ -239,6 +239,32 @@ async def _recent_searches():
|
||||
await browser.close()
|
||||
|
||||
|
||||
def test_live_search():
|
||||
asyncio.run(_live_search())
|
||||
|
||||
|
||||
async def _live_search():
|
||||
# typing (no Enter) renders results in place; Enter still commits to ?q=
|
||||
# so results stay shareable/reloadable.
|
||||
async with async_playwright() as p:
|
||||
browser = await p.chromium.launch(args=LAUNCH_ARGS)
|
||||
page = await (await browser.new_context()).new_page()
|
||||
errors = []
|
||||
page.on("pageerror", lambda e: errors.append(str(e)))
|
||||
|
||||
await _login(page, "admin", "adminpw12345")
|
||||
await page.fill("#q", "chainsaw")
|
||||
# debounced live results must appear WITHOUT pressing Enter
|
||||
await page.wait_for_selector("main a.card", timeout=30000)
|
||||
assert "q=chainsaw" not in page.url, page.url
|
||||
# Enter commits the query to the URL
|
||||
await page.keyboard.press("Enter")
|
||||
await page.wait_for_function(
|
||||
"location.search.includes('q=chainsaw')", timeout=15000, polling=POLL)
|
||||
assert not errors, errors
|
||||
await browser.close()
|
||||
|
||||
|
||||
def test_auto_next_countdown():
|
||||
asyncio.run(_auto_next_countdown())
|
||||
|
||||
|
||||
Reference in new issue
Block a user