Skip to content

Commit

Permalink
QAWTO-214: update appium python client dependency (#404)
Browse files Browse the repository at this point in the history
* update to appium4

* update to appium4

* test set_text

test send_keys ios

test get from value ios

restore set_value

restore send_keys

set_text

test set value

* changed set_text and refactor

* change appium client minimun version

* updated requirements and test

* update Appium client requirement and changelog

* updated readme

---------

Co-authored-by: Rubén González Alonso <[email protected]>
  • Loading branch information
hesteban-tuenti and rgonalo authored Nov 25, 2024
1 parent d9312f2 commit 7137397
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ v3.2.1
- Add `TITLE` replacement, to apply Python's title() function. Example: [TITLE:the title]
- Add `ROUND` replacement, float number to a string with the indicated number of decimals. Example: [ROUND:3.3333::2]
- Remove accents from generated file names to avoid errors in some filesystems
- Update Appium-Python-Client requirement to enable 3 and 4 versions
- Deprecate set_text method in InputText class to make it compatible with Appium-Python-Client 3 and 4

v3.2.0
------
Expand Down
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ The main dependencies are:
in Android or iOS devices/emulators.
- `requests <http://docs.python-requests.org>`_: to test APIs

You might need to adjust the Selenium and Appium-Python-Client versions in your project.
In that case follow the `compatibility matrix <https://github.com/appium/python-client?tab=readme-ov-file#compatibility-matrix>`_

**Using toolium-template**

The easiest way of getting started is to clone `toolium-template <https://github.com/Telefonica/toolium-template>`_
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
requests~=2.27 # api tests
selenium~=4.0 # web tests
Appium-Python-Client~=2.3 # mobile tests
Pillow~=10.1 # visual testing
requests~=2.27 # api tests
selenium~=4.0 # web tests
Appium-Python-Client>=2.3,<5.0 # mobile tests
Pillow~=10.1 # visual testing
screeninfo~=0.8
lxml~=5.1
Faker~=25.9
Expand Down
12 changes: 4 additions & 8 deletions toolium/pageelements/input_text_page_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,18 @@ def text(self):
:returns: element text value
"""
if self.driver_wrapper.is_web_test() or self.webview:
return self.web_element.get_attribute("value")
elif self.driver_wrapper.is_ios_test():
return self.web_element.get_attribute("label")
elif self.driver_wrapper.is_android_test():
if self.driver_wrapper.is_android_test() and not self.webview:
return self.web_element.get_attribute("text")
else:
return self.web_element.get_attribute("value")

@text.setter
def text(self, value):
"""Set value on the element
:param value: value to be set
"""
if self.driver_wrapper.is_ios_test() and not self.driver_wrapper.is_web_test():
self.web_element.set_value(value)
elif self.shadowroot:
if self.shadowroot:
value = value.replace("\"", "\\\"")
self.driver.execute_script('return document.querySelector("%s")'
'.shadowRoot.querySelector("%s")'
Expand Down
2 changes: 2 additions & 0 deletions toolium/test/pageelements/test_derived_page_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ def test_get_text(driver_wrapper):

def test_get_input_text(driver_wrapper):
driver_wrapper.driver.find_element.return_value = mock_element
driver_wrapper.is_android_test = mock.MagicMock(return_value=False)

username_value = LoginPageObject().username.text

mock_element.get_attribute.assert_called_once_with('value')
assert username_value == 'input text value'


Expand Down

0 comments on commit 7137397

Please sign in to comment.