Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ jobs:
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
- name: Remove Chrome
run: sudo apt purge google-chrome-stable
- name: Remove default Chromium
run: sudo apt purge chromium-browser
- name: Install a new Chromium
run: sudo apt install -y chromium-browser
- uses: browser-actions/setup-chrome@latest
- run: chrome --version
- name: Integration browser test with Pytest
run: python -m pytest tests/selenium_tests.py
run: python -m pytest tests/selenium_tests.py -s
13 changes: 6 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ black==22.6.0
build

# lib
pytest==6.2.5
Appium-Python-Client==2.6.0
selenium==4.1.0
opencv-python==4.6.0.66
pytest==7.4.3
Appium-Python-Client==3.1.0
selenium==4.16.0
opencv-python==4.8.1.78
geckodriver-autoinstaller==0.1.0
value==0.1.0
pytest-xdist==2.5.0
pytest-testrail==2.9.0
pure-python-adb==0.3.0.dev0
webdriver-manager==3.6.3
numpy==1.22.0
webdriver-manager==4.0.1
numpy==1.26.2
imutils==0.5.4
13 changes: 6 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,16 @@
packages=find_packages(),
python_requires=">=3.6, <4",
install_requires=[
"pytest==6.2.5",
"Appium-Python-Client==2.6.0",
"selenium==4.1.0",
"opencv-python==4.6.0.66",
"pytest==7.4.3",
"Appium-Python-Client==3.1.0",
"selenium==4.16.0",
"opencv-python==4.8.1.78",
"geckodriver-autoinstaller==0.1.0",
"value==0.1.0",
"pytest-xdist==2.5.0",
"pytest-testrail==2.9.0",
"pure-python-adb==0.3.0.dev0",
"webdriver-manager==3.6.3",
"numpy==1.22.0",
"webdriver-manager==4.0.1",
"numpy==1.26.2",
"imutils==0.5.4",
],
)
22 changes: 19 additions & 3 deletions tests/appium_app_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import pytest

from tests.screens.landing import LandingScreen
from selenium.webdriver.common.actions import interaction
from selenium.webdriver.common.actions.pointer_input import PointerInput
from selenium.webdriver.common.actions.action_builder import ActionBuilder
from testui.support import logger
from testui.support.appium_driver import NewDriver
from testui.support.testui_driver import TestUIDriver
Expand All @@ -24,6 +26,20 @@ def appium_driver(self):
@pytest.mark.signup
def test_appium_app(self, appium_driver: TestUIDriver):
logger.log_test_name("T92701: Check appium app")
landing_page = LandingScreen(appium_driver)
landing_page.i_am_in_google_play_landing_screen()
# Deprecated
# appium_driver.touch_actions().press(x=500, y=10)\
# .move_to(x=500, y=1000).release().perform()

appium_driver.actions().w3c_actions = ActionBuilder(
appium_driver.get_driver,
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.perform()

appium_driver.raise_errors()
9 changes: 7 additions & 2 deletions testui/support/appium_driver.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import atexit
import datetime
import os
import subprocess
import threading
Expand All @@ -16,6 +15,9 @@
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from selenium import webdriver
from webdriver_manager import chrome
from appium.options.android import UiAutomator2Options
from appium.options.ios import XCUITestOptions


from testui.support import logger
from testui.support.api_support import get_chrome_version
Expand Down Expand Up @@ -419,14 +421,17 @@ def start_driver(desired_caps, url, debug, port, udid, log_file):
logger.log("starting appium driver...")

process = None
options = None
if "android" in desired_caps["platformName"].lower():
url, desired_caps, process, file = __local_run(
url, desired_caps, port, udid, log_file
)
options = UiAutomator2Options().load_capabilities(desired_caps)
else:
url, desired_caps, file = __local_run_ios(
url, desired_caps, port, udid, log_file
)
options = XCUITestOptions().load_capabilities(desired_caps)
err = None
for _ in range(2):
try:
Expand All @@ -435,7 +440,7 @@ def start_driver(desired_caps, url, debug, port, udid, log_file):
with warnings.catch_warnings():
# To suppress a warning from an issue on selenium side
warnings.filterwarnings("ignore", category=DeprecationWarning)
driver = Remote(url, desired_caps)
driver = Remote(url, options=options)
atexit.register(__quit_driver, driver, debug)
logger.log(f"appium running on {url}. \n")
lock.release()
Expand Down
2 changes: 2 additions & 0 deletions testui/support/testui_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ def remove_log_file(self, when_no_errors=True):

def touch_actions(self) -> TouchAction:
"""
Deprecated function, soon to be removed, use actions instead.

Will return a TouchAction object for the current driver. This is
meant for Appium Drivers only.
:return: TouchAction
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ deps =
pytest
pytest-xdist
selenium
value
geckodriver-autoinstaller
commands =
pytest tests/selenium_tests.py -s
Expand Down