Skip to content

Commit 8e600af

Browse files
authored
fix tests for uiautomator2 (#565)
1 parent ab8ecf8 commit 8e600af

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

android_tests/lib/android/specs/android/helper.rb

+9-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,15 @@ def id_value
6363
t 'find by id' do
6464
wait { find('accessibility').click }
6565
wait { find('accessibility node provider').click }
66-
wait { id 'accessibility_node_provider' } # Accessibility/Accessibility Node Provider
66+
67+
if !automation_name_is_uiautomator2?
68+
wait { text 'Accessibility/Accessibility Node Provider' }
69+
else
70+
# With string.xml
71+
# Only for uiautomator1
72+
wait { id 'accessibility_node_provider' }
73+
end
74+
6775
2.times { back }
6876
end
6977

android_tests/lib/android/specs/common/patch.rb

+10-3
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,16 @@
4848
end
4949

5050
t 'id success' do
51-
wait do
52-
el = id 'autocomplete_3_button_7' # <string name="autocomplete_3_button_7">Text</string>
53-
el.name.must_equal 'Text'
51+
if !automation_name_is_uiautomator2?
52+
wait do
53+
el = id 'autocomplete_3_button_7' # <string name="autocomplete_3_button_7">Text</string>
54+
el.name.must_equal 'Text'
55+
end
56+
else
57+
wait do
58+
el = text 'text' # <string name="autocomplete_3_button_7">Text</string>
59+
el.name.must_equal 'Text'
60+
end
5461
end
5562
end
5663

0 commit comments

Comments
 (0)