calabash / calabash-ios-server

An embedded HTTP server for performing queries and test automation
Other
87 stars 82 forks source link

Fix logic to switch to the second tab #446

Closed maxim-lobanov closed 5 years ago

maxim-lobanov commented 5 years ago

Issue

2 scenarios fail on CI randomly: 1) Scenario: Entitlement Injector has been loaded 2) Scenario: Touch small buttons Both of them fail about 4-5 times per 10 runs

Debug process

The main issues with both tests is that they can't get some value by query I have added request query(*) to failing tests to determine what elements are showed on device screen. I have found that test app still shows elements from the first tab after step I go to the second tab. So this step doesn't switch tabs sometimes. The main issue is that test app sometimes is not switched to the second tab randomly.

Fix

I have added logic to touch second tab icon until the second tab is shown.

while query("view marked: 'Second View'").empty?
    touch("UITabBarButton index:1")
  end

How it was tested

I have run 11 builds in CI and all of them passed without issue. Both tests were green.

I am not sure that such retry logic is good solution but it works and proofs main idea. The root cause can be related to some instability and hangs of Xcode 11 simulators since Xcode 11 is still beta @jmoody , probably you can advice better solution.

maxim-lobanov commented 5 years ago

I have resolved comments and going to merge the PR. Let's review all changes in the original PR: https://github.com/calabash/calabash-ios-server/pull/442