Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: cleanup test more #1032

Merged
merged 2 commits into from
Sep 25, 2024
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
14 changes: 5 additions & 9 deletions .github/workflows/functional-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,12 @@ jobs:
name: func_test_android1
- target: test/functional/android/keyboard_tests.py test/functional/android/location_tests.py
name: func_test_android2
- target: test/functional/android/appium_service_tests.py
- target: test/functional/android/appium_service_tests.py test/functional/android/chrome_tests.py
name: func_test_android3
- target: test/functional/android/finger_print_tests.py test/functional/android/screen_record_tests.py test/functional/android/settings_tests.py test/functional/android/chrome_tests.py
- target: test/functional/android/finger_print_tests.py test/functional/android/screen_record_tests.py test/functional/android/settings_tests.py
name: func_test_android4
- target: test/functional/android/remote_fs_tests.py
- target: test/functional/android/remote_fs_tests.py test/functional/android/log_event_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

runs-on: ubuntu-latest

Expand Down Expand Up @@ -234,7 +230,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 +243,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.

29 changes: 0 additions & 29 deletions test/functional/android/hw_actions_tests.py

This file was deleted.

34 changes: 0 additions & 34 deletions test/functional/android/network_connection_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
Loading