calabash / calabash-ios

Calabash for iOS
Other
1.81k stars 369 forks source link

HTTPClient::ReceiveTimeoutError: (execution expired) #1306

Closed SanjayImpinge closed 6 years ago

SanjayImpinge commented 7 years ago

I run calabash tests on xamarin. Test passed on some devices and same test failed on other devices.

If I used device agent with calabash tests then test passed on iphone 6s+ and 7+ but some tests failed on 6s and 7. However, if I used UIAutomation, tests passed on iphone 6s and 7 but failed on 6s+ and 7+.

Test failed Reason is: HTTPClient::ReceiveTimeoutError - execution expired (HTTPClient::ReceiveTimeoutError)

If test run on one device then it should be run on all devices properly.

Also, one test case in one feature passed and same test case on other feature is failed on same device.

I spent lots of time to fix above issues but getting no solution.

SanjayImpinge commented 7 years ago

Scenario Given ... Then I touch the head part from human anatomy

Step: Given(/^I touch the head part from human anatomy$/) do sleep 1 device_agent.touch({marked: 'Head'}) sleep 1 end

Error on xamarin:

RuntimeError - Waited 30 seconds for {:marked=>"Head"} to match a view. ./features/steps/base_steps.rb:185:in /^I touch the head part from human anatomy$/' features/patient_anatomy.feature:16:inThen I touch the head part from human anatomy'

It work on some device and failed on iphone 6s. Whats the issue?

jmoody commented 7 years ago

device_agent.touch

Does touch("* marked:'Head'") work?

In general, you should not have to use the DeviceAgent methods.

If test run on one device then it should be run on all devices properly.

This is not true. Animation speeds, for example, differ across devices. Application layout differs across the various form factors (3.5", 4", 6 and 6+).

Try using this pattern

wait_for_none_animating
wait_for_element_exists("* marked:'Head'")
touch("* marked:'Head'")

# Wait for the next view
# Perform gesture
SanjayImpinge commented 7 years ago

Thanks for your response.

Will try your code.

touch("* marked:'Head'"), works on my local machine but not on xamarin. I got "Keyboard didnt opened" error, so I tried with device_agent. I dont know whats the issue?

SanjayImpinge commented 7 years ago

I tried your code, it worked for some steps and then failed.

Scenario: Enter more than 30 + chars in fn & ln and verify proper error message should be displayed Given I ensure user logged in valid inputs Then I marked text "BottomBarBtn" Then I should see "Create" label When I touch and enter patient name "Test12345678901234567890" into textbox number 1 And I touch and enter patient name "Test12345678901234567890" into textbox number 2 And I touch and enter "01011990" into textbox number 3 Then I touched "Create" Then I should see "Error" label Then I should see the text containing "Ensure this value has at most 30 characters" Then I marked text "OK" Then I touched "Cancel" And I touched "logoutIcon" And I touched "Yes"

Steps: When(/^I touched "(.?)"$/) do |text| wait_for_none_animating wait_for_element_exists(" marked:'#{text}'") touch("* marked:'#{text}'") end

It worked for initial steps but failed on 4th last step ie "I marked text "OK"" Check attached screenshot. screen shot 2017-06-02 at 1 51 20 pm

Error: Calabash::Cucumber::WaitHelpers::WaitError - Timeout waiting for element: marked:'Cancel' (Calabash::Cucumber::WaitHelpers::WaitError) ./features/steps/base_steps.rb:412:in `/^I touched "(.?)"$/' features/patient.feature:15:in `Then I touched "Cancel"'

jmoody commented 7 years ago

When dealing with iOS Alert Views, you must wait a very long time for the alert to animate on and off. I usually use ~10 seconds when running on Test Cloud.

# Do something that generates an alert
wait_for_none_animating
if xamarin_test_cloud?
  sleep(10)
else
  sleep(2)
end
# Do the next thing in the test

# If you are dismissing the alert, sleep after dismissing (like above).
SanjayImpinge commented 7 years ago

I have one test with two scenario...in first scenario step "Then I marked text "BottomBarBtn"" is passed and in second, its failed. check attached screenshot.

Error message: RuntimeError - Waited 30 seconds for {:marked=>"BottomBarBtn"} to match a view. ./features/steps/base_steps.rb:405:in /^I marked text "(.*?)"$/' features/patient.feature:19:inThen I marked text "BottomBarBtn"'

steps defination: When(/^I marked text "(.*?)"$/) do |text| screenshot_embed screen shot 2017-06-02 at 3 47 00 pm

screen shot 2017-06-02 at 3 46 26 pm

wait_for_none_animating puts "#{text}" device_agent.touch({marked: "#{text}"}) screenshot_embed end

SanjayImpinge commented 7 years ago

Also, many times I got below error: HTTPClient::ReceiveTimeoutError - execution expired (HTTPClient::ReceiveTimeoutError) ./features/steps/base_steps.rb:414:in /^I touched "(.*?)"$/' features/patient.feature:13:inThen I touched "Back"'

screen shot 2017-06-02 at 4 59 20 pm

step defination: When(/^I touched "(.?)"$/) do |text| wait_for_none_animating sleep 10 wait_for_element_exists(" marked:'#{text}'") touch("* marked:'#{text}'") end

SanjayImpinge commented 7 years ago

@jmoody

Initially I used device_agent in calabash test, now I write all tests using UIAutomation and then my all tests passed on iphone 6s, 7 and SE on xamarin cloud but failed on 6s+ and 7+.

Error on xamarin cloud:

Calabash::Cucumber::WaitHelpers::WaitError - Keyboard did not appear (Calabash::Cucumber::WaitHelpers::WaitError) ./features/steps/base_steps.rb:51:in /^I enter "(.*?)" into textbox number (\d+)$/' ./features/steps/base_steps.rb:97:in/^I ensure user logged in valid inputs$/' features/gallery.feature:5:in `Given I ensure user logged in valid inputs'

Can you help me to resolve above issue?

jmoody commented 6 years ago

I am afraid I cannot help you debug your tests. Please ask for help on Gitter. I recommend looking at our example projects.