údržba
This commit is contained in:
commit
f131cc0277
3
AAA/pokus/.idea/.gitignore
generated
vendored
Normal file
3
AAA/pokus/.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
10
AAA/pokus/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
10
AAA/pokus/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="SpellCheckingInspection" enabled="true" level="TYPO" enabled_by_default="true">
|
||||
<option name="processCode" value="false" />
|
||||
<option name="processLiterals" value="false" />
|
||||
<option name="processComments" value="false" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
6
AAA/pokus/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
AAA/pokus/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
4
AAA/pokus/.idea/misc.xml
generated
Normal file
4
AAA/pokus/.idea/misc.xml
generated
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (pokus)" project-jdk-type="Python SDK" />
|
||||
</project>
|
8
AAA/pokus/.idea/modules.xml
generated
Normal file
8
AAA/pokus/.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/pokus.iml" filepath="$PROJECT_DIR$/.idea/pokus.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
10
AAA/pokus/.idea/pokus.iml
generated
Normal file
10
AAA/pokus/.idea/pokus.iml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
BIN
AAA/pokus/aaatest/__pycache__/aaa.cpython-311-pytest-7.4.0.pyc
Normal file
BIN
AAA/pokus/aaatest/__pycache__/aaa.cpython-311-pytest-7.4.0.pyc
Normal file
Binary file not shown.
BIN
AAA/pokus/aaatest/__pycache__/novy.cpython-311-pytest-7.4.0.pyc
Normal file
BIN
AAA/pokus/aaatest/__pycache__/novy.cpython-311-pytest-7.4.0.pyc
Normal file
Binary file not shown.
17
AAA/pokus/aaatest/aaa.py
Normal file
17
AAA/pokus/aaatest/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").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()
|
8
AAA/pokus/aaatest/novy.py
Normal file
8
AAA/pokus/aaatest/novy.py
Normal file
@ -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")
|
2
AAA/pokus/aaatest/pytest.ini
Normal file
2
AAA/pokus/aaatest/pytest.ini
Normal file
@ -0,0 +1,2 @@
|
||||
[pytest]
|
||||
addopts = --browser chromium --headed --slowmo 1000
|
6
PWjohnmediaPY/playvright/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
PWjohnmediaPY/playvright/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
4
PWjohnmediaPY/playvright/.idea/misc.xml
generated
Normal file
4
PWjohnmediaPY/playvright/.idea/misc.xml
generated
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_20" project-jdk-name="Python 3.11" project-jdk-type="Python SDK" />
|
||||
</project>
|
8
PWjohnmediaPY/playvright/.idea/modules.xml
generated
Normal file
8
PWjohnmediaPY/playvright/.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/playvright.iml" filepath="$PROJECT_DIR$/.idea/playvright.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
10
PWjohnmediaPY/playvright/.idea/playvright.iml
generated
Normal file
10
PWjohnmediaPY/playvright/.idea/playvright.iml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
PWjohnmediaPY/playvright/.idea/vcs.xml
generated
Normal file
6
PWjohnmediaPY/playvright/.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
94
PWjohnmediaPY/playvright/.idea/workspace (conflicted copy 2023-08-02 193728).xml
generated
Normal file
94
PWjohnmediaPY/playvright/.idea/workspace (conflicted copy 2023-08-02 193728).xml
generated
Normal file
@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="1c2bf73c-77d3-40d2-a3de-68fd64b27bea" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/codegen_test_tutorial/aa.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/codegen_test_tutorial/aaa.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Python Script" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo"><![CDATA[{
|
||||
"customColor": "",
|
||||
"associatedIndex": -1
|
||||
}]]></component>
|
||||
<component name="ProjectId" id="2TKNMxmWNGar9iFGTYFdGKy4qKd" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"last_opened_file_path": "C:/Users/kankal/Downloads/PWjohnmediaPY/playwright-python-test-framework"
|
||||
}
|
||||
}</component>
|
||||
<component name="RunManager" selected="Python tests.Python tests for aaa.test_example">
|
||||
<configuration name="Python tests for aaa.test_example" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
|
||||
<module name="playvright" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/codegen_test_tutorial" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="_new_additionalArguments" value="""" />
|
||||
<option name="_new_target" value=""aaa.test_example"" />
|
||||
<option name="_new_targetType" value=""PYTHON"" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="Python tests for test_saucedemo.test_inventory_site" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
|
||||
<module name="playvright" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/pytest" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="_new_additionalArguments" value="""" />
|
||||
<option name="_new_target" value=""test_saucedemo.test_inventory_site"" />
|
||||
<option name="_new_targetType" value=""PYTHON"" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Python tests.Python tests for aaa.test_example" />
|
||||
<item itemvalue="Python tests.Python tests for test_saucedemo.test_inventory_site" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="1c2bf73c-77d3-40d2-a3de-68fd64b27bea" name="Changes" comment="" />
|
||||
<created>1690787768083</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1690787768083</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
</project>
|
105
PWjohnmediaPY/playvright/.idea/workspace.xml
generated
Normal file
105
PWjohnmediaPY/playvright/.idea/workspace.xml
generated
Normal file
@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="1c2bf73c-77d3-40d2-a3de-68fd64b27bea" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/codegen_test_tutorial/aa.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/codegen_test_tutorial/aaa.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Python Script" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"associatedIndex": 0
|
||||
}</component>
|
||||
<component name="ProjectId" id="2TKNMxmWNGar9iFGTYFdGKy4qKd" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"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"
|
||||
}
|
||||
}</component>
|
||||
<component name="RunManager" selected="Python tests.Python tests for test_saucedemo.test_inventory_site">
|
||||
<configuration name="Python tests for aaa.test_example" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
|
||||
<module name="playvright" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/codegen_test_tutorial" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="_new_additionalArguments" value="""" />
|
||||
<option name="_new_target" value=""aaa.test_example"" />
|
||||
<option name="_new_targetType" value=""PYTHON"" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="Python tests for test_saucedemo.test_inventory_site" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
|
||||
<module name="playvright" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/pytest" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="_new_additionalArguments" value="""" />
|
||||
<option name="_new_target" value=""test_saucedemo.test_inventory_site"" />
|
||||
<option name="_new_targetType" value=""PYTHON"" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Python tests.Python tests for test_saucedemo.test_inventory_site" />
|
||||
<item itemvalue="Python tests.Python tests for aaa.test_example" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="1c2bf73c-77d3-40d2-a3de-68fd64b27bea" name="Changes" comment="" />
|
||||
<created>1690787768083</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1690787768083</updated>
|
||||
<workItem from="1690990947705" duration="168000" />
|
||||
<workItem from="1690991135379" duration="71000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
</project>
|
21
PWjohnmediaPY/playvright/Readme.md
Normal file
21
PWjohnmediaPY/playvright/Readme.md
Normal file
@ -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
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
12
PWjohnmediaPY/playvright/async.py
Normal file
12
PWjohnmediaPY/playvright/async.py
Normal file
@ -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())
|
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()
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
2
PWjohnmediaPY/playvright/pytest/pytest.ini
Normal file
2
PWjohnmediaPY/playvright/pytest/pytest.ini
Normal file
@ -0,0 +1,2 @@
|
||||
[pytest]
|
||||
addopts = --base-url https://www.saucedemo.com/ --browser chromium --headed --slowmo 1000
|
22
PWjohnmediaPY/playvright/pytest/test_saucedemo.py
Normal file
22
PWjohnmediaPY/playvright/pytest/test_saucedemo.py
Normal file
@ -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
|
BIN
PWjohnmediaPY/playvright/screenshot/lukan.png
Normal file
BIN
PWjohnmediaPY/playvright/screenshot/lukan.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 228 KiB |
7
PWjohnmediaPY/playvright/sync.py
Normal file
7
PWjohnmediaPY/playvright/sync.py
Normal file
@ -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()
|
3
PWlkPY/.idea/.gitignore
generated
vendored
Normal file
3
PWlkPY/.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
10
PWlkPY/.idea/PWlkPY.iml
generated
Normal file
10
PWlkPY/.idea/PWlkPY.iml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
PWlkPY/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
PWlkPY/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
4
PWlkPY/.idea/misc.xml
generated
Normal file
4
PWlkPY/.idea/misc.xml
generated
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (PWlkPY) (2)" project-jdk-type="Python SDK" />
|
||||
</project>
|
8
PWlkPY/.idea/modules.xml
generated
Normal file
8
PWlkPY/.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/PWlkPY.iml" filepath="$PROJECT_DIR$/.idea/PWlkPY.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
PWlkPY/.idea/vcs.xml
generated
Normal file
6
PWlkPY/.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
BIN
PWlkPY/pokus/__pycache__/test_menu.cpython-311-pytest-7.4.0.pyc
Normal file
BIN
PWlkPY/pokus/__pycache__/test_menu.cpython-311-pytest-7.4.0.pyc
Normal file
Binary file not shown.
2
PWlkPY/pokus/pytest.ini
Normal file
2
PWlkPY/pokus/pytest.ini
Normal file
@ -0,0 +1,2 @@
|
||||
[pytest]
|
||||
addopts = --base-url https://lukaskanka.cz/ --browser chromium --headed --slowmo 1000
|
14
PWlkPY/pokus/test_menu.py
Normal file
14
PWlkPY/pokus/test_menu.py
Normal file
@ -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()
|
||||
|
3
PWneemoPY/playwright/.idea/.gitignore
generated
vendored
Normal file
3
PWneemoPY/playwright/.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
10
PWneemoPY/playwright/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
10
PWneemoPY/playwright/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="SpellCheckingInspection" enabled="true" level="TYPO" enabled_by_default="true">
|
||||
<option name="processCode" value="false" />
|
||||
<option name="processLiterals" value="false" />
|
||||
<option name="processComments" value="false" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
6
PWneemoPY/playwright/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
PWneemoPY/playwright/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
4
PWneemoPY/playwright/.idea/misc.xml
generated
Normal file
4
PWneemoPY/playwright/.idea/misc.xml
generated
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_20" />
|
||||
</project>
|
8
PWneemoPY/playwright/.idea/modules.xml
generated
Normal file
8
PWneemoPY/playwright/.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/playwright.iml" filepath="$PROJECT_DIR$/.idea/playwright.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
10
PWneemoPY/playwright/.idea/playwright.iml
generated
Normal file
10
PWneemoPY/playwright/.idea/playwright.iml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.11" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
PWneemoPY/playwright/.idea/vcs.xml
generated
Normal file
6
PWneemoPY/playwright/.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
Binary file not shown.
Binary file not shown.
13
PWneemoPY/playwright/basic/first_testcase.py
Normal file
13
PWneemoPY/playwright/basic/first_testcase.py
Normal file
@ -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()
|
||||
|
||||
|
2
PWneemoPY/playwright/basic/pytest.ini
Normal file
2
PWneemoPY/playwright/basic/pytest.ini
Normal file
@ -0,0 +1,2 @@
|
||||
[pytest]
|
||||
addopts = --browser chromium --headed --slowmo 1000 --tracing on
|
Binary file not shown.
3
PWpokusPY/Pokus1/.idea/.gitignore
generated
vendored
Normal file
3
PWpokusPY/Pokus1/.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
10
PWpokusPY/Pokus1/.idea/Pokus1.iml
generated
Normal file
10
PWpokusPY/Pokus1/.idea/Pokus1.iml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
PWpokusPY/Pokus1/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
PWpokusPY/Pokus1/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
4
PWpokusPY/Pokus1/.idea/misc.xml
generated
Normal file
4
PWpokusPY/Pokus1/.idea/misc.xml
generated
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (Pokus1)" project-jdk-type="Python SDK" />
|
||||
</project>
|
8
PWpokusPY/Pokus1/.idea/modules.xml
generated
Normal file
8
PWpokusPY/Pokus1/.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/Pokus1.iml" filepath="$PROJECT_DIR$/.idea/Pokus1.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
PWpokusPY/Pokus1/.idea/vcs.xml
generated
Normal file
6
PWpokusPY/Pokus1/.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
Binary file not shown.
Binary file not shown.
20
PWpokusPY/Pokus1/accept_cookies.py
Normal file
20
PWpokusPY/Pokus1/accept_cookies.py
Normal file
@ -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()
|
BIN
PWpokusPY/Pokus1/screenshot/lukan.png
Normal file
BIN
PWpokusPY/Pokus1/screenshot/lukan.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 229 KiB |
Loading…
Reference in New Issue
Block a user