-
Notifications
You must be signed in to change notification settings - Fork 369
/
swipe.rb
34 lines (31 loc) · 1.14 KB
/
swipe.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Then(/^I can swipe to go back to the Pan menu$/) do
x_offset = -1 * query("*")[0]["rect"]["width"] / 2.0
# Uses swipe-delta for instruments since their gesture is not strong enough
# to open menu this behavior could probably also be changed in the test app.
swipe(:right, {
:query => "*",
:offset => {:x => x_offset, :y => 0},
:force => :strong,
# This is ignored by DeviceAgent.
:"swipe-delta" => {:horizontal =>
{:dx => -1 * x_offset + 80, :dy => 0}}
})
wait_for_animations
wait_for_view("* marked:'pan page'")
end
And(/^I swipe to delete the '(.*?)' table cell$/) do |cell_title|
cell_query = "UILabel marked:'#{cell_title}'"
wait_for_view(cell_query)
x_offset = query(cell_query)[0]["rect"]["width"] / 2.5
swipe(:left, {:query => cell_query,
:force => :strong,
:offset => {:x => x_offset, :y => 0}})
wait_for_animations
touch("* marked:'Delete'")
end
Then(/^I no longer see the '(.*?)' table cell$/) do |cell_title|
wait_for_animations
if !query("UILabel marked:'#{cell_title}'").empty?
fail "Table cell marked: #{cell_title} still exists"
end
end