Skip to content

Commit

Permalink
test: cleanup duplicated tests more
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa committed Sep 25, 2024
1 parent 9cdfe5c commit cdcba81
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 116 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/functional-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ jobs:
name: func_test_android4
- target: test/functional/android/remote_fs_tests.py
name: func_test_android5
- target: test/functional/android/common_tests.py test/functional/android/webelement_tests.py
name: func_test_android6
- target: test/functional/android/network_connection_tests.py test/functional/android/log_event_tests.py test/functional/android/hw_actions_tests.py
name: func_test_android8

Expand Down Expand Up @@ -234,7 +232,7 @@ jobs:
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
Expand All @@ -247,7 +245,7 @@ jobs:

- name: Install Appium
run: npm install --location=global appium

- name: Install Android drivers and Run Appium
if: matrix.e2e-tests == 'flutter-android'
run: |
Expand Down
58 changes: 0 additions & 58 deletions test/functional/android/common_tests.py

This file was deleted.

52 changes: 0 additions & 52 deletions test/functional/android/webelement_tests.py

This file was deleted.

6 changes: 4 additions & 2 deletions test/unit/webdriver/device/common_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@
import httpretty

from appium.webdriver.webdriver import WebDriver
from test.unit.helper.test_helper import android_w3c_driver, appium_command
from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body


class TestWebDriverCommon(object):
@httpretty.activate
def test_open_notifications(self):
driver = android_w3c_driver()
httpretty.register_uri(httpretty.POST, appium_command('/session/1234567890/appium/device/open_notifications'))
httpretty.register_uri(httpretty.POST, appium_command('/session/1234567890/execute/sync'))
assert isinstance(driver.open_notifications(), WebDriver)
assert {'args': [], 'script': 'mobile: openNotifications'} == get_httpretty_request_body(
httpretty.last_request()
)

@httpretty.activate
def test_current_package(self):
Expand Down
25 changes: 25 additions & 0 deletions test/unit/webdriver/webelement_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ def test_send_key_with_file(self):
d = get_httpretty_request_body(httpretty.last_request())
assert d['text'] == ''.join(d['value'])

@httpretty.activate
def test_clear(self):
driver = android_w3c_driver()
httpretty.register_uri(httpretty.POST, appium_command('/session/1234567890/element/element_id/clear'))

element = MobileWebElement(driver, 'element_id')
element.clear()

@httpretty.activate
def test_get_attribute_with_dict(self):
driver = android_w3c_driver()
Expand All @@ -79,3 +87,20 @@ def test_get_attribute_with_dict(self):

assert isinstance(ef, dict)
assert ef == rect_dict

@httpretty.activate
def test_element_location_in_view(self):
driver = android_w3c_driver()
location_in_view = {'y': 200, 'x': 100}
httpretty.register_uri(
httpretty.GET,
appium_command('/session/1234567890/element/element_id/location_in_view'),
body=json.dumps({"value": location_in_view}),
)

element = MobileWebElement(driver, 'element_id')
loc = element.location_in_view

httpretty.last_request()

assert loc == location_in_view

0 comments on commit cdcba81

Please sign in to comment.