From 365246052018d9ba91dcb4e3e6a68a2a280d702e Mon Sep 17 00:00:00 2001 From: Kazuaki MATSUO Date: Tue, 2 May 2017 23:33:13 +0900 Subject: [PATCH] fix tests for uiautomator2 --- android_tests/lib/android/specs/android/helper.rb | 10 +++++++++- android_tests/lib/android/specs/common/patch.rb | 13 ++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/android_tests/lib/android/specs/android/helper.rb b/android_tests/lib/android/specs/android/helper.rb index 40890da9..0a680cbe 100644 --- a/android_tests/lib/android/specs/android/helper.rb +++ b/android_tests/lib/android/specs/android/helper.rb @@ -63,7 +63,15 @@ def id_value t 'find by id' do wait { find('accessibility').click } wait { find('accessibility node provider').click } - wait { id 'accessibility_node_provider' } # Accessibility/Accessibility Node Provider + + if !automation_name_is_uiautomator2? + wait { text 'Accessibility/Accessibility Node Provider' } + else + # With string.xml + # Only for uiautomator1 + wait { id 'accessibility_node_provider' } + end + 2.times { back } end diff --git a/android_tests/lib/android/specs/common/patch.rb b/android_tests/lib/android/specs/common/patch.rb index beb42178..19824cac 100644 --- a/android_tests/lib/android/specs/common/patch.rb +++ b/android_tests/lib/android/specs/common/patch.rb @@ -48,9 +48,16 @@ end t 'id success' do - wait do - el = id 'autocomplete_3_button_7' # Text - el.name.must_equal 'Text' + if !automation_name_is_uiautomator2? + wait do + el = id 'autocomplete_3_button_7' # Text + el.name.must_equal 'Text' + end + else + wait do + el = text 'text' # Text + el.name.must_equal 'Text' + end end end