init
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import asyncio, time
|
||||
from playwright.async_api import async_playwright
|
||||
from browser import login, BASE, OUT
|
||||
|
||||
async def main():
|
||||
async with async_playwright() as p:
|
||||
browser = await p.chromium.launch()
|
||||
# Account creation
|
||||
ctx = await browser.new_context(viewport={"width": 1200, "height": 900})
|
||||
page = await ctx.new_page()
|
||||
errors = []
|
||||
page.on("pageerror", lambda e: errors.append(f"pageerror: {e}"))
|
||||
await page.goto(BASE + "/account")
|
||||
await page.wait_for_timeout(1000)
|
||||
await page.screenshot(path=f"{OUT}/reg_1_account.png")
|
||||
await page.click("#subscribe li.block")
|
||||
await page.wait_for_selector("form[name=data] input[name=username]", timeout=15000)
|
||||
await page.screenshot(path=f"{OUT}/reg_2_form.png")
|
||||
user = f"carol{int(time.time())}"
|
||||
await page.fill("form[name=data] input[name=username]", user)
|
||||
await page.fill("form[name=data] input[name=password]", "carolpass")
|
||||
await page.click("form[name=data] button")
|
||||
await page.wait_for_timeout(2500)
|
||||
await page.screenshot(path=f"{OUT}/reg_3_done.png")
|
||||
print("registered", user, "->", await page.locator("#subscribe .placeholder h4").all_inner_texts())
|
||||
|
||||
# Configuration page
|
||||
ctx2, page2, errors2 = await login(browser, f"{user}@localhost", "carolpass", "carol")
|
||||
await page2.goto(BASE + "/configuration")
|
||||
await page2.wait_for_timeout(3000)
|
||||
await page2.screenshot(path=f"{OUT}/config_1.png")
|
||||
for e in errors + errors2:
|
||||
print(e)
|
||||
await browser.close()
|
||||
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user