calabash/calabash-ios

cant toggle button in nav bar

UGhari opened this issue · 2 comments

Hi,

I dont know if i found a bug with calabash or I am doing something incorrect. I am using the IOS simulator.

I have a view with a UIImageView button in the nav bar. When I tap the button it hides views within the layout, and also this button when tapped disappears and is replaced by another button, the new button represents unlocking the layout again and showing the views that were just invisible.

Both buttons have their own ids. I can query/ touch them with calabash console as follows:

touch("* id:'padlock_unlocked'")` // hides views
touch("* id:'padlock_locked'")` // shows views

my test goes as follows:

// this works
wait_for_elements_exist("* id:'padlock_unlocked'")
    sleep 1.5
    touch("* id:'padlock_unlocked'")
...
// hide my views
// do checks to see if views are hidden

   // doesnt work 
    wait_for_elements_exist("* id:'padlock_locked'")
    sleep 1.5
    touch("* id:'padlock_locked'")

I get the error:

When I tap the unlock button # features/step_definitions/c-tab_steps.rb:319
Timeout waiting for elements: * id:'padlock_unlocked' (Calabash::Cucumber::WaitHelpers::WaitError)

But it works fine from console. even if i put a long sleep say of 10 seconds it doesnt work. By the way the button toggle and hiding views is all on the same page

But it works fine from console. even if i put a long sleep say of 10 seconds it doesnt work.

Do any queries succeed after the first touch?

    touch("* id:'padlock_unlocked'")

    // Does any query succeed?

No, no query passes after tapping the unlock button. (When running cucumber tests).

All queries work from console (after the test has failed.

Since then I fixed that problem by writing
touch("* id:'padlock_locked'")[0]

Which doesnt really make any sense because normally if you dont specify which index to tap it just taps the first one (0).

I am now having a similar problem again when i want to unlock the views (So the views are visible again) I tap the locked image with the code snippet above I then check to see if the views have appeared again:

if element_exists("* id:'Notes'") puts "found notes" notesHeaderFound = true ... end

Again tests cant seem to find anything, but when I use console everything exists