Skip to content

Commit cdcba81

Browse files
committed
test: cleanup duplicated tests more
1 parent 9cdfe5c commit cdcba81

File tree

5 files changed

+31
-116
lines changed

5 files changed

+31
-116
lines changed

.github/workflows/functional-test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ jobs:
101101
name: func_test_android4
102102
- target: test/functional/android/remote_fs_tests.py
103103
name: func_test_android5
104-
- target: test/functional/android/common_tests.py test/functional/android/webelement_tests.py
105-
name: func_test_android6
106104
- target: test/functional/android/network_connection_tests.py test/functional/android/log_event_tests.py test/functional/android/hw_actions_tests.py
107105
name: func_test_android8
108106

@@ -234,7 +232,7 @@ jobs:
234232
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
235233
sudo udevadm control --reload-rules
236234
sudo udevadm trigger --name-match=kvm
237-
235+
238236
- name: Set up Python 3.12
239237
uses: actions/setup-python@v3
240238
with:
@@ -247,7 +245,7 @@ jobs:
247245

248246
- name: Install Appium
249247
run: npm install --location=global appium
250-
248+
251249
- name: Install Android drivers and Run Appium
252250
if: matrix.e2e-tests == 'flutter-android'
253251
run: |

test/functional/android/common_tests.py

Lines changed: 0 additions & 58 deletions
This file was deleted.

test/functional/android/webelement_tests.py

Lines changed: 0 additions & 52 deletions
This file was deleted.

test/unit/webdriver/device/common_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@
1515
import httpretty
1616

1717
from appium.webdriver.webdriver import WebDriver
18-
from test.unit.helper.test_helper import android_w3c_driver, appium_command
18+
from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body
1919

2020

2121
class TestWebDriverCommon(object):
2222
@httpretty.activate
2323
def test_open_notifications(self):
2424
driver = android_w3c_driver()
25-
httpretty.register_uri(httpretty.POST, appium_command('/session/1234567890/appium/device/open_notifications'))
2625
httpretty.register_uri(httpretty.POST, appium_command('/session/1234567890/execute/sync'))
2726
assert isinstance(driver.open_notifications(), WebDriver)
27+
assert {'args': [], 'script': 'mobile: openNotifications'} == get_httpretty_request_body(
28+
httpretty.last_request()
29+
)
2830

2931
@httpretty.activate
3032
def test_current_package(self):

test/unit/webdriver/webelement_test.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ def test_send_key_with_file(self):
6262
d = get_httpretty_request_body(httpretty.last_request())
6363
assert d['text'] == ''.join(d['value'])
6464

65+
@httpretty.activate
66+
def test_clear(self):
67+
driver = android_w3c_driver()
68+
httpretty.register_uri(httpretty.POST, appium_command('/session/1234567890/element/element_id/clear'))
69+
70+
element = MobileWebElement(driver, 'element_id')
71+
element.clear()
72+
6573
@httpretty.activate
6674
def test_get_attribute_with_dict(self):
6775
driver = android_w3c_driver()
@@ -79,3 +87,20 @@ def test_get_attribute_with_dict(self):
7987

8088
assert isinstance(ef, dict)
8189
assert ef == rect_dict
90+
91+
@httpretty.activate
92+
def test_element_location_in_view(self):
93+
driver = android_w3c_driver()
94+
location_in_view = {'y': 200, 'x': 100}
95+
httpretty.register_uri(
96+
httpretty.GET,
97+
appium_command('/session/1234567890/element/element_id/location_in_view'),
98+
body=json.dumps({"value": location_in_view}),
99+
)
100+
101+
element = MobileWebElement(driver, 'element_id')
102+
loc = element.location_in_view
103+
104+
httpretty.last_request()
105+
106+
assert loc == location_in_view

0 commit comments

Comments
 (0)