údržba
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
28
PWjohnmediaPY/playvright/codegen_test_tutorial/aa.py
Normal file
28
PWjohnmediaPY/playvright/codegen_test_tutorial/aa.py
Normal file
@ -0,0 +1,28 @@
|
||||
from playwright.sync_api import Playwright, sync_playwright, expect
|
||||
|
||||
|
||||
def run(playwright: Playwright) -> None:
|
||||
browser = playwright.chromium.launch(headless=False)
|
||||
context = browser.new_context()
|
||||
page = context.new_page()
|
||||
page.goto("https://www.aaaauto.cz/")
|
||||
page.get_by_role("button", name="Přijmout vše").click()
|
||||
page.get_by_role("button", name="Značka Vyberte značku").click()
|
||||
page.get_by_text("Škoda (2793)").first.click()
|
||||
page.get_by_role("button", name="Model Vyberte model").click()
|
||||
page.get_by_text("Citigo(40)").click()
|
||||
page.get_by_role("button", name="Rok Vyberte stáří vozu").click()
|
||||
page.get_by_text("Do 10 let").click()
|
||||
page.get_by_role("button", name="Cena Vyberte cenu").click()
|
||||
page.get_by_text("Do 200 000 Kč", exact=True).click()
|
||||
page.get_by_role("button", name="Kategorie Vyberte kategorii").click()
|
||||
page.locator("#hpFilterNG").get_by_text("Úsporné vozy").click()
|
||||
page.get_by_role("button", name="Hledat").click()
|
||||
|
||||
# ---------------------
|
||||
context.close()
|
||||
browser.close()
|
||||
|
||||
|
||||
with sync_playwright() as playwright:
|
||||
run(playwright)
|
17
PWjohnmediaPY/playvright/codegen_test_tutorial/aaa.py
Normal file
17
PWjohnmediaPY/playvright/codegen_test_tutorial/aaa.py
Normal file
@ -0,0 +1,17 @@
|
||||
from playwright.sync_api import Page, expect
|
||||
|
||||
|
||||
def test_example(page: Page) -> None:
|
||||
page.goto("https://www.aaaauto.cz/")
|
||||
page.get_by_role("button", name="Přijmout vše").click()
|
||||
page.get_by_role("button", name="Značka Vyberte značku").click()
|
||||
page.get_by_text("Škoda").first.click()
|
||||
page.get_by_role("button", name="Model Vyberte model").click()
|
||||
page.get_by_text("Citigo").click()
|
||||
page.get_by_role("button", name="Rok Vyberte stáří vozu").click()
|
||||
page.get_by_text("Do 10 let").click()
|
||||
page.get_by_role("button", name="Cena Vyberte cenu").click()
|
||||
page.get_by_text("Do 200 000 Kč", exact=True).click()
|
||||
page.get_by_role("button", name="Kategorie Vyberte kategorii").click()
|
||||
page.locator("#hpFilterNG").get_by_text("Úsporné vozy").click()
|
||||
page.get_by_role("button", name="Hledat").click()
|
@ -0,0 +1,2 @@
|
||||
[pytest]
|
||||
addopts = --browser chromium --headed --slowmo 1000
|
@ -0,0 +1,17 @@
|
||||
from playwright.sync_api import Page, expect
|
||||
|
||||
|
||||
def test_example(page: Page) -> None:
|
||||
page.goto("https://www.saucedemo.com/")
|
||||
page.locator("[data-test=\"username\"]").click()
|
||||
page.locator("[data-test=\"username\"]").fill("standard_user")
|
||||
page.locator("[data-test=\"password\"]").click()
|
||||
page.locator("[data-test=\"password\"]").fill("secret_sauce")
|
||||
page.locator("[data-test=\"login-button\"]").click()
|
||||
|
||||
# v codegen vygeneruji v mém případě zatím code v pytest
|
||||
# https://playwright.dev/python/docs/codegen#recording-a-test
|
||||
|
||||
# video jakým vše možným způsobem se dá použít playwright codegen je zde: https://youtu.be/IRTeqUXkPbA
|
||||
# třeba jeémožné ho použít na nacvakání jako na iPhone, nebo daným rozlišení stránky
|
||||
# velikost textu se zobrazí v nastavení parametrů přímo v testu
|
@ -0,0 +1,17 @@
|
||||
import pytest
|
||||
|
||||
from playwright.sync_api import Page, expect
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def browser_context_args(browser_context_args, playwright):
|
||||
return {**playwright.devices["iPhone 13"]}
|
||||
|
||||
|
||||
def test_example(page: Page) -> None:
|
||||
page.goto("https://www.saucedemo.com/")
|
||||
page.locator("[data-test=\"username\"]").click()
|
||||
page.locator("[data-test=\"username\"]").fill("standard_user")
|
||||
page.locator("[data-test=\"password\"]").click()
|
||||
page.locator("[data-test=\"password\"]").fill("secret_sauce")
|
||||
page.locator("[data-test=\"login-button\"]").click()
|
@ -0,0 +1,20 @@
|
||||
from playwright.sync_api import Page, expect
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def browser_context_args(browser_context_args, playwright):
|
||||
return {"viewport": {"width":763,"height":481}}
|
||||
|
||||
|
||||
def test_example(page: Page) -> None:
|
||||
page.goto("https://www.saucedemo.com/")
|
||||
page.locator("[data-test=\"username\"]").click()
|
||||
page.locator("[data-test=\"username\"]").fill("standard_user")
|
||||
page.locator("[data-test=\"password\"]").click()
|
||||
page.locator("[data-test=\"password\"]").fill("secret_user")
|
||||
page.locator("[data-test=\"login-button\"]").click()
|
||||
page.get_by_text("Epic sadface: Username and password do not match any user in this serviceLoginAc").click()
|
||||
page.locator("[data-test=\"password\"]").click()
|
||||
page.locator("[data-test=\"password\"]").click()
|
||||
page.locator("[data-test=\"password\"]").fill("secret_sauce")
|
||||
page.locator("[data-test=\"login-button\"]").click()
|
Reference in New Issue
Block a user