diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7a3cb9bd..224ec459 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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 ------ diff --git a/README.rst b/README.rst index 9318db1c..8cec2337 100644 --- a/README.rst +++ b/README.rst @@ -30,6 +30,9 @@ The main dependencies are: in Android or iOS devices/emulators. - `requests `_: 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 `_ + **Using toolium-template** The easiest way of getting started is to clone `toolium-template `_ diff --git a/requirements.txt b/requirements.txt index 7edfa80b..1fafe642 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/toolium/pageelements/input_text_page_element.py b/toolium/pageelements/input_text_page_element.py index 90f56e01..4b3fffe3 100644 --- a/toolium/pageelements/input_text_page_element.py +++ b/toolium/pageelements/input_text_page_element.py @@ -26,12 +26,10 @@ 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): @@ -39,9 +37,7 @@ def text(self, value): :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")' diff --git a/toolium/test/pageelements/test_derived_page_element.py b/toolium/test/pageelements/test_derived_page_element.py index d11724dd..3b3d665c 100644 --- a/toolium/test/pageelements/test_derived_page_element.py +++ b/toolium/test/pageelements/test_derived_page_element.py @@ -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'