Skip to content

Conversation

@ki4070ma
Copy link
Collaborator

@ki4070ma ki4070ma commented May 7, 2019

Changes

  • Enable running tests on low performance device(e.g. emulator)
    • test_screen_record
    • test_set_text
    • test_send_keys
  • Enable running tests on Android P(9.0)
    • test_update_settings
      • "cyberdelia" doesn't exist in AndroidP at least.
    • test_start_activity_other_app
      • Changed app to be launched to avoid security exception

Results

Verified with Python2/3 and emulator(AndroidP)

  • Python2
Fix functional tests failed (android, appium_tests)

➜  android git:(fix-func-test-failed) ✗ python2 appium_tests.py
test_app_management (__main__.AppiumTests) ... ok
test_app_strings (__main__.AppiumTests) ... ok
test_app_strings_with_language (__main__.AppiumTests) ... ok
test_app_strings_with_language_and_file (__main__.AppiumTests) ... ok
test_background_app (__main__.AppiumTests) ... ok
test_close__and_launch_app (__main__.AppiumTests) ... ok
test_current_activity (__main__.AppiumTests) ... ok
test_current_package (__main__.AppiumTests) ... ok
test_device_time (__main__.AppiumTests) ... ok
test_element_location_in_view (__main__.AppiumTests) ... ok
test_end_test_coverage (__main__.AppiumTests) ... skipped 'Not sure how to set this up to run'
test_get_settings (__main__.AppiumTests) ... ok
test_install_app (__main__.AppiumTests) ... skipped 'This causes the server to crash. no idea why'
test_is_app_installed (__main__.AppiumTests) ... ok
test_lock (__main__.AppiumTests) ... ok
test_long_press_keycode (__main__.AppiumTests) ... ok
test_open_notifications (__main__.AppiumTests) ... ok
test_press_keycode (__main__.AppiumTests) ... ok
test_pull_folder (__main__.AppiumTests) ... ok
test_push_pull_file (__main__.AppiumTests) ... ok
test_remove_app (__main__.AppiumTests) ... ok
test_reset (__main__.AppiumTests) ... ok
test_screen_record (__main__.AppiumTests) ... ok
test_send_keys (__main__.AppiumTests) ... ok
test_set_text (__main__.AppiumTests) ... ok
test_start_activity_other_app (__main__.AppiumTests) ... ok
test_start_activity_this_app (__main__.AppiumTests) ... ok
test_toggle_location_services (__main__.AppiumTests) ... ok
test_update_settings (__main__.AppiumTests) ... ok

----------------------------------------------------------------------
Ran 29 tests in 756.681s

OK (skipped=2)
  • Python3
➜  android git:(fix-func-test-failed) ✗ python3 appium_tests.py
test_app_management (__main__.AppiumTests) ... ok
test_app_strings (__main__.AppiumTests) ... ok
test_app_strings_with_language (__main__.AppiumTests) ... ok
test_app_strings_with_language_and_file (__main__.AppiumTests) ... ok
test_background_app (__main__.AppiumTests) ... ok
test_close__and_launch_app (__main__.AppiumTests) ... ok
test_current_activity (__main__.AppiumTests) ... ok
test_current_package (__main__.AppiumTests) ... ok
test_device_time (__main__.AppiumTests) ... ok
test_element_location_in_view (__main__.AppiumTests) ... ok
test_end_test_coverage (__main__.AppiumTests) ... skipped 'Not sure how to set this up to run'
test_get_settings (__main__.AppiumTests) ... ok
test_install_app (__main__.AppiumTests) ... skipped 'This causes the server to crash. no idea why'
test_is_app_installed (__main__.AppiumTests) ... ok
test_lock (__main__.AppiumTests) ... ok
test_long_press_keycode (__main__.AppiumTests) ... ok
test_open_notifications (__main__.AppiumTests) ... ok
test_press_keycode (__main__.AppiumTests) ... ok
test_pull_folder (__main__.AppiumTests) ... ok
test_push_pull_file (__main__.AppiumTests) ... ok
test_remove_app (__main__.AppiumTests) ... ok
test_reset (__main__.AppiumTests) ... ok
test_screen_record (__main__.AppiumTests) ... ok
test_send_keys (__main__.AppiumTests) ... ok
test_set_text (__main__.AppiumTests) ... ok
test_start_activity_other_app (__main__.AppiumTests) ... ok
test_start_activity_this_app (__main__.AppiumTests) ... ok
test_toggle_location_services (__main__.AppiumTests) ... ok
test_update_settings (__main__.AppiumTests) ... ok

----------------------------------------------------------------------
Ran 29 tests in 784.829s

OK (skipped=2)

self.driver.find_element_by_xpath(xpath).click()

el = self.driver.find_element(By.ID, 'com.example.android.apis:id/left_text_edit')
el = self.driver.find_element(MobileBy.ID, 'com.example.android.apis:id/left_text_edit')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nits]
Python client has find_element_by_id, too.

SLEEPY_TIME = 3


def wait_element(driver, locator, value, timeout=SLEEPY_TIME):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait_for_element?

self.driver.find_element_by_xpath("//android.widget.TextView[@text='App']").click()
self.driver.find_element_by_xpath("//android.widget.TextView[@text='Activity']").click()
self.driver.find_element_by_xpath("//android.widget.TextView[@text='Custom Title']").click()
xpath = "//android.widget.TextView[@text='App']"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be done in a loop

:param timeout: Maximum time to wait the element. If time is over, TimeoutException is thrown
:return: None
'''
WebDriverWait(driver, timeout).until(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does presence_of_element_located returns an element?
If so, what about returning the result of WebDriverWait as this method's returns value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good, will do.

@ki4070ma ki4070ma merged commit 6cc1e14 into appium:master May 9, 2019
@ki4070ma ki4070ma deleted the fix-func-test-failed branch May 9, 2019 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants