diff --git a/requirements.txt b/requirements.txt index 2490526..d82e5a5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ build # lib pytest<=8.0.1 Appium-Python-Client~=4.0.0 -opencv-python~=4.8.1 +opencv-python~=4.10.0.84 geckodriver-autoinstaller==0.1.0 pytest-xdist~=2.5.0 pytest-testrail~=2.9.0 diff --git a/tests/appium_app_test.py b/tests/appium_app_test.py index 1d3c02b..cae3660 100644 --- a/tests/appium_app_test.py +++ b/tests/appium_app_test.py @@ -30,16 +30,16 @@ def test_appium_app(self, appium_driver: TestUIDriver): # appium_driver.touch_actions().press(x=500, y=10)\ # .move_to(x=500, y=1000).release().perform() - appium_driver.actions().w3c_actions = ActionBuilder( + actions = ActionBuilder( appium_driver.get_driver(), - mouse=PointerInput(interaction.POINTER_TOUCH, "touch")) + mouse=PointerInput(interaction.POINTER_TOUCH, "touch") + ) - actions = appium_driver.actions() - actions.w3c_actions.pointer_action.move_to_location(x=500, y=10) - actions.w3c_actions.pointer_action.pointer_down() - actions.w3c_actions.pointer_action.pause(1) - actions.w3c_actions.pointer_action.move_to_location(x=500, y=1000) - actions.w3c_actions.pointer_action.release() + actions.pointer_action.move_to_location(x=500, y=10) + actions.pointer_action.pointer_down() + actions.pointer_action.pause(1) + actions.pointer_action.move_to_location(x=500, y=1000) + actions.pointer_action.release() actions.perform() appium_driver.raise_errors() diff --git a/tests/appium_tests.py b/tests/appium_tests.py index 85b3638..242444e 100644 --- a/tests/appium_tests.py +++ b/tests/appium_tests.py @@ -1,11 +1,12 @@ import time - +import os import pytest from testui.support import logger from testui.support.appium_driver import NewDriver from testui.support.testui_driver import TestUIDriver +test_dir = os.path.dirname(__file__) class TestStringMethods: @pytest.yield_fixture(autouse=True) @@ -17,7 +18,7 @@ def selenium_driver(self): .set_soft_assert(True) .set_appium_driver() ) - driver.configuration.save_full_stacktrace + driver.configuration.save_full_stacktrace = True yield driver driver.quit() @@ -29,17 +30,19 @@ def test_screenshot_methods(self, selenium_driver: TestUIDriver): selenium_driver.navigate_to( "https://github.com/testdevlab/Py-TestUI#image-recognition" ) - selenium_driver.click_by_image("./resources/comp.png", threshold=0.6, ratio=0.5, webview=True) + image_compare = os.path.join(test_dir, "..", "resources", "comp.png") + selenium_driver.click_by_image(image=image_compare, threshold=0.6, ratio=0.5, webview=True) selenium_driver.start_recording_screen() time.sleep(1) + image_result = os.path.join(test_dir, "..", "logs", "v-image.png") selenium_driver.stop_recording_and_compare( - "./resources/comp.png", + comparison=image_compare, fps_reduction=30, - keep_image_as="./logs/v-image.png", + keep_image_as=image_result, threshold=0.6 ) selenium_driver.find_image_match( - "./resources/comp.png", 0.6, True, image_match="./logs/image.png" + comparison=image_compare, threshold=0.6, assertion=True, image_match="./logs/image.png" ) time.sleep(110) diff --git a/tests/selenium_tests.py b/tests/selenium_tests.py index 05e19e1..110339f 100644 --- a/tests/selenium_tests.py +++ b/tests/selenium_tests.py @@ -1,4 +1,5 @@ import pytest +import os from selenium.webdriver.chrome.options import Options from testui.support import logger @@ -6,6 +7,8 @@ from testui.support.testui_driver import TestUIDriver +test_dir = os.path.dirname(__file__) + class TestStringMethods: @pytest.yield_fixture(autouse=True) def selenium_driver(self): @@ -29,8 +32,10 @@ def test_template_matching(self, selenium_driver: TestUIDriver): selenium_driver.navigate_to( "https://github.com/testdevlab/Py-TestUI#image-recognition" ) + image_result = os.path.join(test_dir, "..", "logs", "image.png") + image_compare = os.path.join(test_dir, "..", "resources", "comp.png") selenium_driver.find_image_match( - "resources/comp.png", 0.1, True, image_match="./logs/image.png" + image_compare, 0.1, True, image_match=image_result ) selenium_driver.raise_errors()