ios_tests/lib/ios/specs/device/device.rb in appium_lib-4.1.0 vs ios_tests/lib/ios/specs/device/device.rb in appium_lib-5.0.0
- old
+ new
@@ -1,21 +1,27 @@
describe 'device/device' do
def before_first
screen.must_equal catalog
end
+ # go back to the main page
+ def go_back
+ back
+ wait { ! exists { id 'ArrowButton' } } # successfully transitioned back
+ end
+
t 'before_first' do
before_first
end
t 'lock' do
lock 5
tag('UIAButton').name.must_equal 'SlideToUnlock'
# It appears that lockForDuration doesn't.
close_app
- launch
+ launch_app
end
t 'background_app' do
background_app 5
screen.must_equal catalog
@@ -30,11 +36,11 @@
shake
end
t 'close and launch' do
close_app
- launch
+ launch_app
tag('UIANavigationBar').name.must_equal 'UICatalog'
end
t 'reset' do
reset
@@ -43,38 +49,38 @@
t 'available_contexts' do
available_contexts.must_equal ["NATIVE_APP"]
end
t 'current_context' do
- current_context.must_equal nil
+ current_context.must_equal 'NATIVE_APP'
end
t 'switch_to_default_context' do
switch_to_default_context
- current_context.must_equal nil
+ current_context.must_equal 'NATIVE_APP'
end
t 'app_strings' do
app_strings.must_include "SearchBarExplain"
app_strings('en').must_include "SearchBarExplain"
end
t 'action_chain' do
- ac = Appium::TouchAction.new
- e = find_element(:name, 'Buttons, Various uses of UIButton')
- ac.press element: e, x: 10, y: 10
- ac.perform
- back
+ Appium::TouchAction.new.press(element: id('ButtonsExplain')).perform
+ wait { id 'ArrowButton' } # successfully transitioned to buttons page
+ go_back
end
t 'swipe' do
swipe start_x: 75, start_y: 500, end_x: 75, end_y: 0, duration: 800
end
t 'pinch & zoom' do
- text('Images, Use of UIImageView').click
+ wait { id('ImagesExplain').click }
+ # both of these appear to do nothing on iOS 8
zoom 200
pinch 75
+ go_back
end
t 'pull_file' do
read_file = pull_file 'Library/AddressBook/AddressBook.sqlitedb'
read_file.start_with?('SQLite format').must_equal true
\ No newline at end of file