commit f131cc02773a049bfd02000056a15dc50eca94dc Author: Lukáš Kaňka <124378142+LukasKanka@users.noreply.github.com> Date: Tue Aug 15 18:39:40 2023 +0200 údržba diff --git a/AAA/pokus/.idea/.gitignore b/AAA/pokus/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/AAA/pokus/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/AAA/pokus/.idea/inspectionProfiles/Project_Default.xml b/AAA/pokus/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..68928a7 --- /dev/null +++ b/AAA/pokus/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/AAA/pokus/.idea/inspectionProfiles/profiles_settings.xml b/AAA/pokus/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/AAA/pokus/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/AAA/pokus/.idea/misc.xml b/AAA/pokus/.idea/misc.xml new file mode 100644 index 0000000..b956778 --- /dev/null +++ b/AAA/pokus/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/AAA/pokus/.idea/modules.xml b/AAA/pokus/.idea/modules.xml new file mode 100644 index 0000000..7b1411a --- /dev/null +++ b/AAA/pokus/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/AAA/pokus/.idea/pokus.iml b/AAA/pokus/.idea/pokus.iml new file mode 100644 index 0000000..74d515a --- /dev/null +++ b/AAA/pokus/.idea/pokus.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/AAA/pokus/aaatest/__pycache__/aaa.cpython-311-pytest-7.4.0.pyc b/AAA/pokus/aaatest/__pycache__/aaa.cpython-311-pytest-7.4.0.pyc new file mode 100644 index 0000000..cd8f1f4 Binary files /dev/null and b/AAA/pokus/aaatest/__pycache__/aaa.cpython-311-pytest-7.4.0.pyc differ diff --git a/AAA/pokus/aaatest/__pycache__/novy.cpython-311-pytest-7.4.0.pyc b/AAA/pokus/aaatest/__pycache__/novy.cpython-311-pytest-7.4.0.pyc new file mode 100644 index 0000000..745433d Binary files /dev/null and b/AAA/pokus/aaatest/__pycache__/novy.cpython-311-pytest-7.4.0.pyc differ diff --git a/AAA/pokus/aaatest/aaa.py b/AAA/pokus/aaatest/aaa.py new file mode 100644 index 0000000..85d1a02 --- /dev/null +++ b/AAA/pokus/aaatest/aaa.py @@ -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").first.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() \ No newline at end of file diff --git a/AAA/pokus/aaatest/novy.py b/AAA/pokus/aaatest/novy.py new file mode 100644 index 0000000..3e1a7a5 --- /dev/null +++ b/AAA/pokus/aaatest/novy.py @@ -0,0 +1,8 @@ +from playwright.sync_api import Page, expect + + +def test_example(page: Page) -> None: + page.goto("https://www.google.cz/?gws_rd=ssl") + page.get_by_role("button", name="Přijmout vše").click() + page.get_by_label("Najít").click() + page.get_by_label("Najít").fill("test") \ No newline at end of file diff --git a/AAA/pokus/aaatest/pytest.ini b/AAA/pokus/aaatest/pytest.ini new file mode 100644 index 0000000..d7ac033 --- /dev/null +++ b/AAA/pokus/aaatest/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +addopts = --browser chromium --headed --slowmo 1000 \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/.idea/inspectionProfiles/profiles_settings.xml b/PWjohnmediaPY/playvright/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/PWjohnmediaPY/playvright/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/.idea/misc.xml b/PWjohnmediaPY/playvright/.idea/misc.xml new file mode 100644 index 0000000..64d40c1 --- /dev/null +++ b/PWjohnmediaPY/playvright/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/.idea/modules.xml b/PWjohnmediaPY/playvright/.idea/modules.xml new file mode 100644 index 0000000..98c9071 --- /dev/null +++ b/PWjohnmediaPY/playvright/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/.idea/playvright.iml b/PWjohnmediaPY/playvright/.idea/playvright.iml new file mode 100644 index 0000000..74d515a --- /dev/null +++ b/PWjohnmediaPY/playvright/.idea/playvright.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/.idea/vcs.xml b/PWjohnmediaPY/playvright/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/PWjohnmediaPY/playvright/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/.idea/workspace (conflicted copy 2023-08-02 193728).xml b/PWjohnmediaPY/playvright/.idea/workspace (conflicted copy 2023-08-02 193728).xml new file mode 100644 index 0000000..cc9671d --- /dev/null +++ b/PWjohnmediaPY/playvright/.idea/workspace (conflicted copy 2023-08-02 193728).xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + { + "keyToString": { + "RunOnceActivity.OpenProjectViewOnStart": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "git-widget-placeholder": "main", + "last_opened_file_path": "C:/Users/kankal/Downloads/PWjohnmediaPY/playwright-python-test-framework" + } +} + + + + + + + + + + + + + + + + + + + 1690787768083 + + + + \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/.idea/workspace.xml b/PWjohnmediaPY/playvright/.idea/workspace.xml new file mode 100644 index 0000000..841faac --- /dev/null +++ b/PWjohnmediaPY/playvright/.idea/workspace.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + { + "associatedIndex": 0 +} + + + + { + "keyToString": { + "RunOnceActivity.OpenProjectViewOnStart": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "WebServerToolWindowFactoryState": "false", + "git-widget-placeholder": "main", + "last_opened_file_path": "C:/Users/kankal/Nextcloud/GitHub/Vse Playwright_Python/PWjohnmediaPY/playvright", + "project.structure.last.edited": "Project", + "project.structure.proportion": "0.0", + "project.structure.side.proportion": "0.0", + "settings.editor.selected.configurable": "preferences.pluginManager", + "vue.rearranger.settings.migration": "true" + } +} + + + + + + + + + + + + + + + + + + + 1690787768083 + + + + + + \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/Readme.md b/PWjohnmediaPY/playvright/Readme.md new file mode 100644 index 0000000..3d70585 --- /dev/null +++ b/PWjohnmediaPY/playvright/Readme.md @@ -0,0 +1,21 @@ +Video 2 nastavuji +doporučuji zde se podívat jak stopnout některy browsey https://youtu.be/IDrTacdVNRM?t=838 + @pytest.mark.skip_browser("firefox") + @pytest.mark.only_browser("chrome") + + pytest --tracing on --> tento pžíkaz na spuštění testu vytvoří složky kde je v zip výsledek testu + zip mohu otevřít zde a podívat se na výsledek testu https://trace.playwright.dev/ + další možnosti jak využít trace.zip https://youtu.be/IDrTacdVNRM?t=1148 + + na inportovaném pytest.ini mužu nastavit default URL a další parametry +Video 3 codegen a Inspektor + v codegen vygeneruji v mém případě zatím code v pytest +https://playwright.dev/python/docs/codegen#recording-a-test +https://playwright.dev/python/docs/debug + + 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 mé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 + navíc můžeme importovat tmavé schéma, geolokační data (od kud přistupuji na net), vše je v dokumentaci + + \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/__pycache__/test.cpython-311-pytest-7.4.0.pyc b/PWjohnmediaPY/playvright/__pycache__/test.cpython-311-pytest-7.4.0.pyc new file mode 100644 index 0000000..703c239 Binary files /dev/null and b/PWjohnmediaPY/playvright/__pycache__/test.cpython-311-pytest-7.4.0.pyc differ diff --git a/PWjohnmediaPY/playvright/__pycache__/test_codegen_saucedemo.cpython-311-pytest-7.4.0.pyc b/PWjohnmediaPY/playvright/__pycache__/test_codegen_saucedemo.cpython-311-pytest-7.4.0.pyc new file mode 100644 index 0000000..87771cb Binary files /dev/null and b/PWjohnmediaPY/playvright/__pycache__/test_codegen_saucedemo.cpython-311-pytest-7.4.0.pyc differ diff --git a/PWjohnmediaPY/playvright/async.py b/PWjohnmediaPY/playvright/async.py new file mode 100644 index 0000000..f163289 --- /dev/null +++ b/PWjohnmediaPY/playvright/async.py @@ -0,0 +1,12 @@ +import asyncio +from playwright.async_api import async_playwright +async def main(): + async with async_playwright() as p: + browser = await p.chromium.launch(headless=False) + page = await browser.new_page() + await page.goto("https://lukan.cz") + print(await page.title()) + await browser.close() + + +asyncio.run(main()) \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/codegen_test_tutorial/__pycache__/aa.cpython-311-pytest-7.4.0.pyc b/PWjohnmediaPY/playvright/codegen_test_tutorial/__pycache__/aa.cpython-311-pytest-7.4.0.pyc new file mode 100644 index 0000000..bd5a471 Binary files /dev/null and b/PWjohnmediaPY/playvright/codegen_test_tutorial/__pycache__/aa.cpython-311-pytest-7.4.0.pyc differ diff --git a/PWjohnmediaPY/playvright/codegen_test_tutorial/__pycache__/aaa.cpython-311-pytest-7.4.0.pyc b/PWjohnmediaPY/playvright/codegen_test_tutorial/__pycache__/aaa.cpython-311-pytest-7.4.0.pyc new file mode 100644 index 0000000..89d4323 Binary files /dev/null and b/PWjohnmediaPY/playvright/codegen_test_tutorial/__pycache__/aaa.cpython-311-pytest-7.4.0.pyc differ diff --git a/PWjohnmediaPY/playvright/codegen_test_tutorial/__pycache__/test_codegen_saucedemo.cpython-311-pytest-7.4.0.pyc b/PWjohnmediaPY/playvright/codegen_test_tutorial/__pycache__/test_codegen_saucedemo.cpython-311-pytest-7.4.0.pyc new file mode 100644 index 0000000..224cebc Binary files /dev/null and b/PWjohnmediaPY/playvright/codegen_test_tutorial/__pycache__/test_codegen_saucedemo.cpython-311-pytest-7.4.0.pyc differ diff --git a/PWjohnmediaPY/playvright/codegen_test_tutorial/__pycache__/test_iphone.cpython-311-pytest-7.4.0.pyc b/PWjohnmediaPY/playvright/codegen_test_tutorial/__pycache__/test_iphone.cpython-311-pytest-7.4.0.pyc new file mode 100644 index 0000000..6bfec91 Binary files /dev/null and b/PWjohnmediaPY/playvright/codegen_test_tutorial/__pycache__/test_iphone.cpython-311-pytest-7.4.0.pyc differ diff --git a/PWjohnmediaPY/playvright/codegen_test_tutorial/aa.py b/PWjohnmediaPY/playvright/codegen_test_tutorial/aa.py new file mode 100644 index 0000000..3063632 --- /dev/null +++ b/PWjohnmediaPY/playvright/codegen_test_tutorial/aa.py @@ -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) \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/codegen_test_tutorial/aaa.py b/PWjohnmediaPY/playvright/codegen_test_tutorial/aaa.py new file mode 100644 index 0000000..ccf41a6 --- /dev/null +++ b/PWjohnmediaPY/playvright/codegen_test_tutorial/aaa.py @@ -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() \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/codegen_test_tutorial/pytest.ini b/PWjohnmediaPY/playvright/codegen_test_tutorial/pytest.ini new file mode 100644 index 0000000..d7ac033 --- /dev/null +++ b/PWjohnmediaPY/playvright/codegen_test_tutorial/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +addopts = --browser chromium --headed --slowmo 1000 \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/codegen_test_tutorial/test_codegen_saucedemo.py b/PWjohnmediaPY/playvright/codegen_test_tutorial/test_codegen_saucedemo.py new file mode 100644 index 0000000..1cd0fe1 --- /dev/null +++ b/PWjohnmediaPY/playvright/codegen_test_tutorial/test_codegen_saucedemo.py @@ -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 \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/codegen_test_tutorial/test_iphone.py b/PWjohnmediaPY/playvright/codegen_test_tutorial/test_iphone.py new file mode 100644 index 0000000..3318d9c --- /dev/null +++ b/PWjohnmediaPY/playvright/codegen_test_tutorial/test_iphone.py @@ -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() \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/codegen_test_tutorial/test_rozmery.py b/PWjohnmediaPY/playvright/codegen_test_tutorial/test_rozmery.py new file mode 100644 index 0000000..5fef687 --- /dev/null +++ b/PWjohnmediaPY/playvright/codegen_test_tutorial/test_rozmery.py @@ -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() \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/pytest/__pycache__/test_codegen_saucedemo.cpython-311-pytest-7.4.0.pyc b/PWjohnmediaPY/playvright/pytest/__pycache__/test_codegen_saucedemo.cpython-311-pytest-7.4.0.pyc new file mode 100644 index 0000000..df018e8 Binary files /dev/null and b/PWjohnmediaPY/playvright/pytest/__pycache__/test_codegen_saucedemo.cpython-311-pytest-7.4.0.pyc differ diff --git a/PWjohnmediaPY/playvright/pytest/__pycache__/test_saucedemo.cpython-311-pytest-7.4.0.pyc b/PWjohnmediaPY/playvright/pytest/__pycache__/test_saucedemo.cpython-311-pytest-7.4.0.pyc new file mode 100644 index 0000000..582800c Binary files /dev/null and b/PWjohnmediaPY/playvright/pytest/__pycache__/test_saucedemo.cpython-311-pytest-7.4.0.pyc differ diff --git a/PWjohnmediaPY/playvright/pytest/__pycache__/test_saucedemo.cpython-311.pyc b/PWjohnmediaPY/playvright/pytest/__pycache__/test_saucedemo.cpython-311.pyc new file mode 100644 index 0000000..6cb66c5 Binary files /dev/null and b/PWjohnmediaPY/playvright/pytest/__pycache__/test_saucedemo.cpython-311.pyc differ diff --git a/PWjohnmediaPY/playvright/pytest/pytest.ini b/PWjohnmediaPY/playvright/pytest/pytest.ini new file mode 100644 index 0000000..8d91e93 --- /dev/null +++ b/PWjohnmediaPY/playvright/pytest/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +addopts = --base-url https://www.saucedemo.com/ --browser chromium --headed --slowmo 1000 \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/pytest/test_saucedemo.py b/PWjohnmediaPY/playvright/pytest/test_saucedemo.py new file mode 100644 index 0000000..bd7ca78 --- /dev/null +++ b/PWjohnmediaPY/playvright/pytest/test_saucedemo.py @@ -0,0 +1,22 @@ +from playwright.sync_api import Page +import pytest + +#doporučuji zde se podívat jak stopnout některy browsey https://youtu.be/IDrTacdVNRM?t=838 +# @pytest.mark.skip_browser("firefox") +# @pytest.mark.only_browser("chrome") +def test_title(page: Page): + page.goto("/") + assert page.title() == "Swag Labs" + + + +def test_inventory_site(page: Page): + page.goto("/inventory.html") + assert page.inner_text('h3') == "Epic sadface: You can only access '/inventory.html' when you are logged in." + + + # pytest --tracing on --> tento pžíkaz na spuštění testu vytvoří složky kde je v zip výsledek testu + # zip mohu otevřít zde a podívat se na výsledek testu https://trace.playwright.dev/ + # další možnosti jak využít trace.zip https://youtu.be/IDrTacdVNRM?t=1148 + + # na inportovaném pytest.ini mužu nastavit default URL a další parametry \ No newline at end of file diff --git a/PWjohnmediaPY/playvright/screenshot/lukan.png b/PWjohnmediaPY/playvright/screenshot/lukan.png new file mode 100644 index 0000000..eaf5863 Binary files /dev/null and b/PWjohnmediaPY/playvright/screenshot/lukan.png differ diff --git a/PWjohnmediaPY/playvright/sync.py b/PWjohnmediaPY/playvright/sync.py new file mode 100644 index 0000000..e72f04d --- /dev/null +++ b/PWjohnmediaPY/playvright/sync.py @@ -0,0 +1,7 @@ +from playwright.sync_api import sync_playwright +with sync_playwright() as p: + browser = p.chromium.launch(headless= False) + page = browser.new_page() + page.goto("https://lukan.cz") + page.screenshot(path="screenshot/lukan.png") + browser.close() \ No newline at end of file diff --git a/PWlkPY/.idea/.gitignore b/PWlkPY/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/PWlkPY/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/PWlkPY/.idea/PWlkPY.iml b/PWlkPY/.idea/PWlkPY.iml new file mode 100644 index 0000000..74d515a --- /dev/null +++ b/PWlkPY/.idea/PWlkPY.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/PWlkPY/.idea/inspectionProfiles/profiles_settings.xml b/PWlkPY/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/PWlkPY/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/PWlkPY/.idea/misc.xml b/PWlkPY/.idea/misc.xml new file mode 100644 index 0000000..fcfaa66 --- /dev/null +++ b/PWlkPY/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/PWlkPY/.idea/modules.xml b/PWlkPY/.idea/modules.xml new file mode 100644 index 0000000..bcb0ec1 --- /dev/null +++ b/PWlkPY/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/PWlkPY/.idea/vcs.xml b/PWlkPY/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/PWlkPY/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PWlkPY/pokus/__pycache__/test_menu.cpython-311-pytest-7.4.0.pyc b/PWlkPY/pokus/__pycache__/test_menu.cpython-311-pytest-7.4.0.pyc new file mode 100644 index 0000000..6b7158b Binary files /dev/null and b/PWlkPY/pokus/__pycache__/test_menu.cpython-311-pytest-7.4.0.pyc differ diff --git a/PWlkPY/pokus/pytest.ini b/PWlkPY/pokus/pytest.ini new file mode 100644 index 0000000..770fb12 --- /dev/null +++ b/PWlkPY/pokus/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +addopts = --base-url https://lukaskanka.cz/ --browser chromium --headed --slowmo 1000 \ No newline at end of file diff --git a/PWlkPY/pokus/test_menu.py b/PWlkPY/pokus/test_menu.py new file mode 100644 index 0000000..c68c61e --- /dev/null +++ b/PWlkPY/pokus/test_menu.py @@ -0,0 +1,14 @@ +from playwright.sync_api import Page +import pytest + +def test_tlacitek_menu(page: Page): + page.goto("/") + # tlačítko články + page.locator('//*[@id="menu"]/ul/li[1]/strong/a').click() + # tlačítko Hlavní stránka + page.locator('//*[@id="menu"]/ul/li[1]/strong/a').click() + # tlačítko O mně + page.locator('//*[@id="menu"]/ul/li[2]/strong/a').click() + # tlačítko Hlavní stránka + page.locator('//*[@id="menu"]/ul/li[1]/strong/a').click() + \ No newline at end of file diff --git a/PWneemoPY/playwright/.idea/.gitignore b/PWneemoPY/playwright/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/PWneemoPY/playwright/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/PWneemoPY/playwright/.idea/inspectionProfiles/Project_Default.xml b/PWneemoPY/playwright/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..68928a7 --- /dev/null +++ b/PWneemoPY/playwright/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/PWneemoPY/playwright/.idea/inspectionProfiles/profiles_settings.xml b/PWneemoPY/playwright/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/PWneemoPY/playwright/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/PWneemoPY/playwright/.idea/misc.xml b/PWneemoPY/playwright/.idea/misc.xml new file mode 100644 index 0000000..6f9feab --- /dev/null +++ b/PWneemoPY/playwright/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/PWneemoPY/playwright/.idea/modules.xml b/PWneemoPY/playwright/.idea/modules.xml new file mode 100644 index 0000000..e44d188 --- /dev/null +++ b/PWneemoPY/playwright/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/PWneemoPY/playwright/.idea/playwright.iml b/PWneemoPY/playwright/.idea/playwright.iml new file mode 100644 index 0000000..aee9ef2 --- /dev/null +++ b/PWneemoPY/playwright/.idea/playwright.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/PWneemoPY/playwright/.idea/vcs.xml b/PWneemoPY/playwright/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/PWneemoPY/playwright/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PWneemoPY/playwright/basic/__pycache__/first_testcase.cpython-311-pytest-7.4.0.pyc b/PWneemoPY/playwright/basic/__pycache__/first_testcase.cpython-311-pytest-7.4.0.pyc new file mode 100644 index 0000000..4c95088 Binary files /dev/null and b/PWneemoPY/playwright/basic/__pycache__/first_testcase.cpython-311-pytest-7.4.0.pyc differ diff --git a/PWneemoPY/playwright/basic/__pycache__/first_testcase.cpython-311.pyc b/PWneemoPY/playwright/basic/__pycache__/first_testcase.cpython-311.pyc new file mode 100644 index 0000000..716ec14 Binary files /dev/null and b/PWneemoPY/playwright/basic/__pycache__/first_testcase.cpython-311.pyc differ diff --git a/PWneemoPY/playwright/basic/first_testcase.py b/PWneemoPY/playwright/basic/first_testcase.py new file mode 100644 index 0000000..c4590f4 --- /dev/null +++ b/PWneemoPY/playwright/basic/first_testcase.py @@ -0,0 +1,13 @@ +from playwright.sync_api import Page +import pytest + + +def test_example(page: Page) -> None: + page.goto("https://www.google.com/") + page.get_by_role("button", name="Přijmout vše").click() + page.get_by_label("Najít").click() + page.get_by_label("Najít").fill("playwright") + page.get_by_label("Hledat Googlem").first.click() + page.get_by_role("link", name="Playwright: Fast and reliable end-to-end testing for modern ... playwright.dev https://playwright.dev").click() + + diff --git a/PWneemoPY/playwright/basic/pytest.ini b/PWneemoPY/playwright/basic/pytest.ini new file mode 100644 index 0000000..cc3a184 --- /dev/null +++ b/PWneemoPY/playwright/basic/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +addopts = --browser chromium --headed --slowmo 1000 --tracing on \ No newline at end of file diff --git a/PWneemoPY/playwright/basic/test-results/first-testcase-py-test-example-chromium/trace.zip b/PWneemoPY/playwright/basic/test-results/first-testcase-py-test-example-chromium/trace.zip new file mode 100644 index 0000000..aebc521 Binary files /dev/null and b/PWneemoPY/playwright/basic/test-results/first-testcase-py-test-example-chromium/trace.zip differ diff --git a/PWpokusPY/Pokus1/.idea/.gitignore b/PWpokusPY/Pokus1/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/PWpokusPY/Pokus1/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/PWpokusPY/Pokus1/.idea/Pokus1.iml b/PWpokusPY/Pokus1/.idea/Pokus1.iml new file mode 100644 index 0000000..74d515a --- /dev/null +++ b/PWpokusPY/Pokus1/.idea/Pokus1.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/PWpokusPY/Pokus1/.idea/inspectionProfiles/profiles_settings.xml b/PWpokusPY/Pokus1/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/PWpokusPY/Pokus1/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/PWpokusPY/Pokus1/.idea/misc.xml b/PWpokusPY/Pokus1/.idea/misc.xml new file mode 100644 index 0000000..8511d21 --- /dev/null +++ b/PWpokusPY/Pokus1/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/PWpokusPY/Pokus1/.idea/modules.xml b/PWpokusPY/Pokus1/.idea/modules.xml new file mode 100644 index 0000000..831550b --- /dev/null +++ b/PWpokusPY/Pokus1/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/PWpokusPY/Pokus1/.idea/vcs.xml b/PWpokusPY/Pokus1/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/PWpokusPY/Pokus1/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PWpokusPY/Pokus1/__pycache__/accept_cookies.cpython-311-pytest-7.4.0.pyc b/PWpokusPY/Pokus1/__pycache__/accept_cookies.cpython-311-pytest-7.4.0.pyc new file mode 100644 index 0000000..ca82b8e Binary files /dev/null and b/PWpokusPY/Pokus1/__pycache__/accept_cookies.cpython-311-pytest-7.4.0.pyc differ diff --git a/PWpokusPY/Pokus1/__pycache__/test_my_application.cpython-311-pytest-7.4.0.pyc b/PWpokusPY/Pokus1/__pycache__/test_my_application.cpython-311-pytest-7.4.0.pyc new file mode 100644 index 0000000..d21bf3e Binary files /dev/null and b/PWpokusPY/Pokus1/__pycache__/test_my_application.cpython-311-pytest-7.4.0.pyc differ diff --git a/PWpokusPY/Pokus1/accept_cookies.py b/PWpokusPY/Pokus1/accept_cookies.py new file mode 100644 index 0000000..b4638cf --- /dev/null +++ b/PWpokusPY/Pokus1/accept_cookies.py @@ -0,0 +1,20 @@ +import re +from playwright.sync_api import Page, expect + + +def test_homepage_lukan_cz_accept_cookies(page: Page): + page.goto("https://lukan.cz/") + get_accept = page.get_by_text("Accept") + get_accept.click() + + #vypíše titulek stánky + print( page.title()) + + #Vytvoříme foto stránky + page.screenshot(path="screenshot/lukan.png") + + +def test_homepage_lukan_cz_decline_cookies(page: Page): + page.goto("https://lukan.cz/") + get_decline = page.get_by_text("Decline") + get_decline.click() \ No newline at end of file diff --git a/PWpokusPY/Pokus1/screenshot/lukan.png b/PWpokusPY/Pokus1/screenshot/lukan.png new file mode 100644 index 0000000..cd48ba2 Binary files /dev/null and b/PWpokusPY/Pokus1/screenshot/lukan.png differ