2014-03-14 18 views
0

我有一個帶有視圖的開關,比如'switch_view'。我需要將其更改爲自動化測試。我該怎麼做呢?我的工作目前是:如何在Frank/Calabash中更改Switch的值

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

我想通了。但我認爲我應該把它留在這裏,因爲它可能是造成相當混亂的原因。關鍵是使用in-build tap_and_hold方法。

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

您可以將其與先前的狀態信息相結合,並創建明確的測試。