Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions android_tests/lib/android/specs/common/device_touchaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ def before_first
t 'action_chain_press_release' do
wait do
e = text('Accessibility')
touch_action = Appium::TouchAction.new.press(element: e, x: 0.5, y: 0.5).release(element: e)
touch_action.perform
touch_action.actions.must_equal []
action.click(e).perform
end
wait { text('Custom View') }
back
Expand All @@ -37,9 +35,7 @@ def before_first
t 'action_chain_tap' do
wait do
e = text('Accessibility')
touch_action = Appium::TouchAction.new.tap(element: e)
touch_action.perform
touch_action.actions.must_equal []
action.click(e).perform
end
wait { text('Custom View') }
back
Expand All @@ -49,7 +45,12 @@ def before_first
t 'swipe' do
wait { text('Animation').click }
wait { text_exact('Bouncing Balls').click }
wait { Appium::TouchAction.new.swipe(start_x: 0.75, start_y: 0.25, end_x: 0.0, end_y: 49.75).perform }

driver.action
.move_to_location(0.75, 0.25).pointer_down(:left)
.move_to_location(0.75, 50)
.release.perform

2.times { back }
wait { text_exact 'NFC' }
end
Expand All @@ -58,8 +59,28 @@ def before_first
wait { text_exact 'NFC' }
wait { text_exact('Graphics').click }
wait { scroll_to('Touch Paint').click }
wait { zoom 200 }
wait { pinch 75 }

# multiple action chains
f1 = driver.action.add_pointer_input(:touch, 'finger1')
f1.create_pointer_move(duration: 0.5, x: 500, y: 800,
origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
f1.create_pointer_down(:left)
f1.create_pause(0.5)
f1.create_pointer_move(duration: 3, x: 500, y: 700,
origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
f1.create_pointer_up(:left)

f2 = driver.action.add_pointer_input(:touch, 'finger2')
f2.create_pointer_move(duration: 0.5, x: 500, y: 800,
origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
f2.create_pointer_down(:left)
f1.create_pause(0.5)
f2.create_pointer_move(duration: 3, x: 500, y: 900,
origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
f2.create_pointer_up(:left)

driver.perform_actions [f1, f2]

wait { text('Graphics/Touch Paint') }
2.times { back }
wait { text_exact 'NFC' }
Expand Down
2 changes: 1 addition & 1 deletion ios_tests/appium.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[caps]
platformName = "ios"
platformVersion = "14.5"
platformVersion = "15.0"
deviceName ="iPhone 11"
automationName = 'XCUITest'
app = "../test_apps/UICatalog.app.zip"
Expand Down
23 changes: 3 additions & 20 deletions ios_tests/lib/ios/specs/device/device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,32 +54,15 @@ def go_back
element = text('Buttons')
one_finger_tap x: 0, y: 0, element: element
else
Appium::TouchAction.new.press(element: text('Buttons')).perform
action.click(text('Buttons')).perform
end

wait { button 'UICatalog' } # successfully transitioned to buttons page
go_back
end

t 'swipe' do
touch_action = Appium::TouchAction.new.swipe(start_x: 75, start_y: 500,
end_x: 75, end_y: 20, duration: 500).perform
touch_action.actions.must_equal []

touch_action = Appium::TouchAction.new.swipe(start_x: 75, start_y: 500, end_x: 75, end_y: 20, duration: 500)

touch_action.actions[0][:action].must_equal :press
touch_action.actions[0][:options].must_equal(x: 75, y: 500)

touch_action.actions[1][:action].must_equal :wait,
touch_action.actions[1][:options].must_equal(ms: 500)

touch_action.actions[2][:action].must_equal :moveTo
touch_action.actions[2][:options].must_equal(x: 75, y: 20)

touch_action.actions[3][:action].must_equal :release

touch_action.perform
touch_action.actions.must_equal []
action.move_to_location(75, 500).pointer_down(:left)
.move_to_location(75, 20).release.perform
end
end
14 changes: 9 additions & 5 deletions ios_tests/lib/ios/specs/device/touch_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,19 @@ def after_last
ele_index(ui_ios.picker_wheel, 1).text.must_equal '65'
picker = ele_index(ui_ios.picker_wheel, 1)
picker_rect = picker.rect
start_x = picker_rect.x + picker_rect.width / 2
start_y = picker_rect.y + picker_rect.height / 2
start_x = picker_rect.x + picker_rect.width / 2 + 50
start_y = picker_rect.y + picker_rect.height / 2 + 60

args = { x: start_x, y: start_y }
args[:element] = element.id if element
args[:element] = picker.id if picker
execute_script 'mobile: tap', args

Appium::TouchAction.new.swipe(start_x: start_x, start_y: start_y, end_x: 0, end_y: - 50).perform
ele_index(ui_ios.static_text, 1).text.must_equal '70'
puts window_rect

action.move_to_location(start_x, start_y).pointer_down(:left)
.move_to_location(start_x, start_y - 10).pointer_up(:left).perform

ele_index(ui_ios.picker_wheel, 1).text.must_equal '70'
end

t 'after_last' do
Expand Down
2 changes: 1 addition & 1 deletion ios_tests/lib/ios/specs/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def before_first
# actual[:caps].to_json send to Appium server
caps_with_json = JSON.parse(actual[:caps].to_json)
caps_with_json['platformName'].must_equal 'ios'
caps_with_json['platformVersion'].must_equal '14.5'
caps_with_json['platformVersion'].must_equal '15.0'
caps_with_json['app'].must_equal expected_app
caps_with_json['automationName'].must_equal 'XCUITest'
caps_with_json['deviceName'].must_equal 'iPhone 11'
Expand Down