如何在Frank / Calabash中更改Switch的值

时间:2014-03-14 01:34:45

标签: ios ruby uiswitch calabash frank

我有一个带视图的开关,说' switch_view'。我需要更改它以进行自动化测试。我该怎么做呢?我到现在为止的工作是:

def switch(switch_view)
    # Get the value of the switch
    switch_state = (frankly_map(switch_view, 'isON')).first
    switch_state[0] = !switch_state[0]
    touch(switch_view)
end

正如你所看到的,这只是我迄今为止尝试过的所有东西的合并,那该死的开关仍然没有移动。请帮帮我。

1 个答案:

答案 0 :(得分:1)

我明白了。但是我想我应该把它留在这里因为它可能是造成相当混乱的原因。关键是使用内置的tap_and_hold方法。

def switch(switch_view)
  tap_and_hold(switch_view)
  sleep 1 # For the animation
end

你可以将它与关于状态的先前信息结合起来,并创建明确的测试。