init
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import asyncio
|
||||
from playwright.async_api import async_playwright
|
||||
from browser import login, BASE, OUT
|
||||
|
||||
STEPS = [
|
||||
("contact drawer", "ChatActions_ajaxGetContact('bob@localhost')"),
|
||||
("search drawer", "Search_ajaxRequest()"),
|
||||
("notifications drawer", "Notifications_ajaxRequest()"),
|
||||
("presence menu", "Presence_ajaxHttpMenu()"),
|
||||
("emoji picker", "Stickers_ajaxReaction(null)"),
|
||||
("chat search", "ChatActions_ajaxShowSearchDialog('bob@localhost', false)"),
|
||||
("add contact dialog", "Notifications_ajaxAddAsk('carol@localhost')"),
|
||||
("room discover", "RoomsUtils_ajaxHttpRoomDiscover()"),
|
||||
("create room", "RoomsUtils_ajaxAdd(null, null, true)"),
|
||||
("clear history dialog", "Chat_ajaxClearHistory('bob@localhost')"),
|
||||
("logout dialog", "Presence_ajaxAskLogout()"),
|
||||
("upload dialog", "Upload_ajaxGetPanel()"),
|
||||
]
|
||||
|
||||
async def main():
|
||||
async with async_playwright() as p:
|
||||
browser = await p.chromium.launch()
|
||||
ctx, page, errors = await login(browser, "alice@localhost", "alicepass", "smoke")
|
||||
await page.goto(BASE + "/chat/bob@localhost")
|
||||
await page.wait_for_selector("#chat_textarea", timeout=15000)
|
||||
await page.wait_for_timeout(2000)
|
||||
# message dialog on the last message
|
||||
mid = await page.evaluate("document.querySelector('#chat_widget .message[data-mid]:last-of-type')?.dataset.mid")
|
||||
steps = STEPS + ([("message dialog", f"ChatActions_ajaxShowMessageDialog({mid})")] if mid else [])
|
||||
for i, (name, js) in enumerate(steps):
|
||||
before = len(errors)
|
||||
await page.evaluate(js)
|
||||
await page.wait_for_timeout(1200)
|
||||
await page.screenshot(path=f"{OUT}/smoke_{i:02d}.png")
|
||||
print(f"{name}: {'ERR ' + errors[-1][:150] if len(errors) > before else 'ok'}")
|
||||
await page.evaluate("Dialog_ajaxClear(); Drawer_ajaxClear(); document.querySelector('#drawer')?.classList.add('empty')")
|
||||
await page.wait_for_timeout(300)
|
||||
# configuration tabs
|
||||
await page.goto(BASE + "/configuration")
|
||||
await page.wait_for_timeout(2500)
|
||||
for tab in await page.locator("#navtabs li").all():
|
||||
await tab.click()
|
||||
await page.wait_for_timeout(700)
|
||||
await page.screenshot(path=f"{OUT}/smoke_config_last.png")
|
||||
print("errors total:", len(errors))
|
||||
for e in errors[:10]:
|
||||
print(e[:300])
|
||||
await browser.close()
|
||||
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user