calabash / calabash-android

Automated Functional testing for Android using cucumber
Other
1.68k stars 617 forks source link

Errors attempting to use UiAutomator2 features #941

Open nimaeskandary opened 3 years ago

nimaeskandary commented 3 years ago

Hey wondering if anyone can help with using ui automator 2, I tried following https://github.com/calabash/calabash-android/wiki/UIautomator2, but when I use any of the commands I get a run time error that the implementation cannot be found. I tried a few of the recent calabash-android versions

> start_test_server_in_background(with_uiautomator: true)
> perform_action('uiautomator_touch_text', 'Accept')
Traceback (most recent call last):
       13: from ~/.rvm/rubies/ruby-2.6.4/bin/irb:23:in `<main>'
       12: from ~/.rvm/rubies/ruby-2.6.4/bin/irb:23:in `load'
       11: from ~/.rvm/rubies/ruby-2.6.4/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
       10: from (irb):4
        9: from (irb):4:in `rescue in irb_binding'
        8: from ~/.rvm/gems/ruby-2.6.4@tvx-mobile-automation/gems/calabash-android-0.9.22/lib/calabash-android/operations.rb:93:in `perform_action'
        7: from ~/.rvm/gems/ruby-2.6.4@tvx-mobile-automation/gems/calabash-android-0.9.22/lib/calabash-android/operations.rb:455:in `perform_action'
        6: from ~/.rvm/rubies/ruby-2.6.4/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
        5: from ~/.rvm/rubies/ruby-2.6.4/lib/ruby/2.6.0/timeout.rb:33:in `catch'
        4: from ~/.rvm/rubies/ruby-2.6.4/lib/ruby/2.6.0/timeout.rb:33:in `catch'
        3: from ~/.rvm/rubies/ruby-2.6.4/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
        2: from ~/.rvm/rubies/ruby-2.6.4/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
        1: from ~/.rvm/gems/ruby-2.6.4@tvx-mobile-automation/gems/calabash-android-0.9.22/lib/calabash-android/operations.rb:466:in `block in perform_action'
RuntimeError (Action 'uiautomator_touch_text' unsuccessful: Could not find implementation for: 'uiautomator_touch_text')
JoeSSS commented 3 years ago

hmm, works for me

perform_action('uiautomator_touch_text', 'Alles')
2021-08-12 17:46:45 - Action: uiautomator_touch_text - Params: Alles
2021-08-12 17:46:45 - Result:'{"bonusInformation":[],"message":"","success":true}'
{
    "bonusInformation" => [],
             "message" => "",
             "success" => true
}