| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import pytest
- from playwright.async_api import async_playwright
- @pytest.mark.asyncio
- async def test_gui_NoPayment():
- async with async_playwright() as playwright:
- browser = await playwright.chromium.launch(headless=True)
- context = await browser.new_context()
- page= await context.new_page()
- await page.goto("http://localhost:5014/")
- await page.get_by_role("link", name="Agorism In The 21st Century -- II ").first.click()
- await page.get_by_role("button", name="add to cart").click()
- await page.wait_for_timeout(1000)
- await page.get_by_role("link", name="The DarkFi eye logo.").click()
- await page.get_by_role("link", name="Tshirt 01").click()
- await page.get_by_role("group").locator("div").filter(has_text="s").nth(1).click()
- await page.get_by_label("s", exact=True).check()
- await page.get_by_role("button", name="add to cart").click()
- await page.wait_for_timeout(1000)
- await page.get_by_role("button", name="add to cart").click()
- await page.wait_for_timeout(1000)
- await page.get_by_label("Go to Checkout").click()
- await page.locator("#price_1PTPnFKMYdpilqPdArvtszSN #button-plus").click()
- await page.locator("#prod_RZBk650b1Tx95N").get_by_role("button").nth(1).click()
- await page.get_by_placeholder("Email address").click()
- await page.get_by_placeholder("Email address").fill("work@andrefincato.info")
- await page.get_by_placeholder("Email address").press("Tab")
- await page.get_by_placeholder("First name (optional)").fill("<script onerror='alert(\\\\'hax\\\\')'>Dark")
- await page.get_by_placeholder("First name (optional)").press("Tab")
- await page.get_by_placeholder("Last name").fill("Fi")
- await page.get_by_placeholder("Last name").press("Tab")
- await page.get_by_placeholder("Address", exact=True).fill("Somewhere 122")
- await page.get_by_placeholder("Address", exact=True).press("Tab")
- await page.get_by_placeholder("Address No.").fill("42")
- await page.get_by_placeholder("Address No.").press("Tab")
- await page.get_by_placeholder("Postal code").fill("1225AK")
- await page.get_by_placeholder("Postal code").press("Tab")
- await page.get_by_placeholder("City").fill("Amsterdam")
- await page.get_by_label("Country").select_option("Netherlands")
- await page.get_by_placeholder("Additional note (optional)").click()
- await page.get_by_placeholder("Additional note (optional)").fill("eef+eifenf\\n\\neineienfeifne+eifenife\\neiufenf\\n\\n...")
- await page.get_by_role("button", name="NOW Payments pay button").click()
- await page.get_by_role("button", name="Next step").click()
- await page.wait_for_timeout(90000)
- assert "Thanks for your order." in await page.content()
- await context.close()
- await browser.close()
|