calabash / calabash-ios

Calabash for iOS
Other
1.81k stars 369 forks source link

Retrying.. HTTPClient::ReceiveTimeoutError: (execution expired) #1281

Open liubin-acn opened 7 years ago

liubin-acn commented 7 years ago

Hi,

I met a problem when I tested WKWebView on iOS 10 Simulator.

I entered all of necessary information into registration web page, then I tried to use follow touch function to tap "register button" to redirect to next page.

touch("WKWebView xpath:''//*[@id=\"formSection\"]/form/p[contains(@class,\"buttons\")]/button")

then Console show the error:

Feature: Register

  Background:                                                   # Common/features/test_cases/register.feature:4
      # Given I open the app for the first time and navigate to the Login Screen
    Then I register as a new Rakuten member in the Login Screen # Common/features/step_definitions/screens/login_steps.rb:60
    Then I see the Register screen                              # Common/features/step_definitions/screens/register_steps.rb:1
    Then I change the Register screen language to "jp"          # Common/features/step_definitions/screens/register_steps.rb:5
Retrying.. HTTPClient::ReceiveTimeoutError: (execution expired)
Retrying.. HTTPClient::ReceiveTimeoutError: (execution expired)
...

This test case will wait forever, I already disabled all of NSLog. this issue only on iOS 10 Simulator

Environment information:

run-loop:2.3.0
calabash-cucumber:0.20.4
Xcode 8.2.1
Simulator 10.2
jmoody commented 7 years ago

Apologies, I incorrect answered this question.

What is the error in the simulator log?

# Terminal A
$ run-loop simctl tail

# Terminal B
$ < run your test >

If the page is reloading (after changing languages), you must wait for the page to load.

      options = {:timeout => timeout}
      wait_for(wait_options('Delegate says page is done loading', options)) do
        query('WKWebView', :UIDelegate, :loading).first != 1
      end

https://github.com/calabash/ios-webview-test-app/blob/master/CalWebViewApp/features/pages/wkwebview.rb#L23

liubin-acn commented 7 years ago

Hi @jmoody

Sorry for reply late and I have to hide my application name

The Simulator log as follow

Mar 13 10:36:55 P37926 (My Application Name)[6113]: INFO LPRouter:160 | POST: [LPMapRoute] {
        operation =     {
            arguments =         (
            );
            "method_name" = query;
        };
        query = "WKWebView xpath:'//*[@id=\\\"formSection\\\"]/form/p[contains(@class,\\\"buttons\\\")]/button'";
    }
Mar 13 10:36:55 P37926 (My Application Name)[6113]: DEBUG LPMapRoute:134 | Map POST, /map Parsed UIScript as
    (
        "view:'WKWebView'",
        "with xpath:'//*[@id=\\\"formSection\\\"]/form/p[contains(@class,\\\"buttons\\\")]/button'"
    )
Mar 13 10:36:55 P37926 XCTRunner[6102]: 2017-03-13 10:36:55.792 DEBUG RoutingHTTPServer:218 | POST /1.0/dismiss-springboard-alerts {
    }
Mar 13 10:36:55 P37926 XCTRunner[6102]: 2017-03-13 10:36:55.794 DEBUG RoutingHTTPServer:218 | POST /1.0/gesture {
        gesture = touch;
        options =     {
        };
        specifiers =     {
            coordinate =         {
                x = "187.5";
                y = 590;
            };
        };
    }
Mar 13 10:36:55 P37926 XCTRunner[6102]: 2017-03-13 10:36:55.794 DEBUG Gesture:88 | WARNING: Testing on daemonProtocolVersion 6
Mar 13 10:36:55 P37926 XCTRunner[6102]: 2017-03-13 10:36:55.794 DEBUG Touch:103 | touch event: #<CBXTouchEvent orientation: 1
    gesture: 
    <XCSynthesizedEventRecord:0x608000236340 name:'CBXTouchEvent_XCSynthesizedEventRecord'> paths:
    Path 1:
        <XCPointerEvent:0x60800005daf0 type:1 coordinate:(188,590) offset:0.00s>
        <XCPointerEvent:0x60800024c4b0 type:3 coordinate:(188,590) offset:0.21s>
Mar 13 10:36:56 P37926 com.apple.WebKit.Networking[6121]: [] nw_host_stats_add_src recv too small, received 24, expected 28
Mar 13 10:36:56 P37926 com.apple.WebKit.Networking[6121]: [] __nwlog_err_simulate_crash simulate crash already simulated "nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available"
Mar 13 10:36:56 P37926 com.apple.WebKit.Networking[6121]: [] nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:
            [x86_64] libnetcore-856.30.16
        0   libsystem_network.dylib             0x000000010536d666 __nw_create_backtrace_string + 123
        1   libnetwork.dylib                    0x000000010564b006 nw_socket_add_input_handler + 3164
        2   libnetwork.dylib                    0x0000000105628555 nw_endpoint_flow_attach_protocols + 3768
        3   libnetwork.dylib                    0x0000000105627572 nw_endpoint_flow_setup_socket + 563
        4   libnetwork.dylib                    0x0000000105626298 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2612
        5   libnetwork.dylib                    0x0000000105641ae1 nw_endpoint_handler_path_change + 1261
        6   libnetwork.dylib                    0x0000000105641510 nw_endpoint_handler_start + 570
        7   libnetwork.dylib                    0x00000001056591f9 nw_endpoint_resolver_start_next_child + 2240
        8   libdispatch.dylib                   0x0000
Mar 13 10:36:56 P37926 XCTRunner[6102]: 2017-03-13 10:36:56.102 DEBUG RoutingHTTPServer:218 | POST /1.0/dismiss-springboard-alerts {
    }
Mar 13 10:36:56 P37926 (My Application Name)[6113]: INFO LPRouter:160 | POST: [LPMapRoute] {
        operation =     {
            arguments =         (
            );
            "method_name" = query;
        };
        query = "WKWebView xpath:'//*[@id=\\\"step\\\"]/li[contains(@class,\\\"current\\\")]/span[contains(text(),\\\"2.\U78ba\U8a8d\\\")]'";
    }
Mar 13 10:36:56 P37926 (My Application  @Name)[6113]: DEBUG LPMapRoute:134 | Map POST, /map Parsed UIScript as
    (
        "view:'WKWebView'",
        "with xpath:'//*[@id=\\\"step\\\"]/li[contains(@class,\\\"current\\\")]/span[contains(text(),\\\"2.\U78ba\U8a8d\\\")]'"
    )
Mar 13 10:36:56 P37926 com.apple.WebKit.Networking[6121]: [] nw_host_stats_add_src recv too small, received 24, expected 28
Mar 13 10:36:56 P37926 com.apple.WebKit.Networking[6121]: [] __nwlog_err_simulate_crash simulate crash already simulated "nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available"
Mar 13 10:36:56 P37926 com.apple.WebKit.Networking[6121]: [] nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:
            [x86_64] libnetcore-856.30.16
        0   libsystem_network.dylib             0x000000010536d666 __nw_create_backtrace_string + 123
        1   libnetwork.dylib                    0x000000010564b006 nw_socket_add_input_handler + 3164
        2   libnetwork.dylib                    0x0000000105628555 nw_endpoint_flow_attach_protocols + 3768
        3   libnetwork.dylib                    0x0000000105627572 nw_endpoint_flow_setup_socket + 563
        4   libnetwork.dylib                    0x0000000105626298 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2612
        5   libnetwork.dylib                    0x0000000105641ae1 nw_endpoint_handler_path_change + 1261
        6   libnetwork.dylib                    0x0000000105641510 nw_endpoint_handler_start + 570
        7   libnetwork.dylib                    0x00000001056591f9 nw_endpoint_resolver_start_next_child + 2240
        8   libdispatch.dylib                   0x0000
Mar 13 10:36:56 P37926 com.apple.WebKit.Networking[6121]: [] nw_host_stats_add_src recv too small, received 24, expected 28
Mar 13 10:36:56 P37926 com.apple.WebKit.Networking[6121]: [] __nwlog_err_simulate_crash simulate crash already simulated "nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available"
Mar 13 10:36:56 P37926 com.apple.WebKit.Networking[6121]: [] nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:
            [x86_64] libnetcore-856.30.16
        0   libsystem_network.dylib             0x000000010536d666 __nw_create_backtrace_string + 123
        1   libnetwork.dylib                    0x000000010564b006 nw_socket_add_input_handler + 3164
        2   libnetwork.dylib                    0x0000000105628555 nw_endpoint_flow_attach_protocols + 3768
        3   libnetwork.dylib                    0x0000000105627572 nw_endpoint_flow_setup_socket + 563
        4   libnetwork.dylib                    0x0000000105626298 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2612
        5   libnetwork.dylib                    0x0000000105641ae1 nw_endpoint_handler_path_change + 1261
        6   libnetwork.dylib                    0x0000000105641510 nw_endpoint_handler_start + 570
        7   libnetwork.dylib                    0x00000001056591f9 nw_endpoint_resolver_start_next_child + 2240
        8   libdispatch.dylib                   0x0000
Mar 13 10:36:56 P37926 com.apple.WebKit.Networking[6121]: [] nw_host_stats_add_src recv too small, received 24, expected 28
Mar 13 10:36:56 P37926 com.apple.WebKit.Networking[6121]: [] __nwlog_err_simulate_crash simulate crash already simulated "nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available"
Mar 13 10:36:56 P37926 com.apple.WebKit.Networking[6121]: [] nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:
            [x86_64] libnetcore-856.30.16
        0   libsystem_network.dylib             0x000000010536d666 __nw_create_backtrace_string + 123
        1   libnetwork.dylib                    0x000000010564b006 nw_socket_add_input_handler + 3164
        2   libnetwork.dylib                    0x0000000105628555 nw_endpoint_flow_attach_protocols + 3768
        3   libnetwork.dylib                    0x0000000105627572 nw_endpoint_flow_setup_socket + 563
        4   libnetwork.dylib                    0x0000000105626298 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2612
        5   libnetwork.dylib                    0x0000000105641ae1 nw_endpoint_handler_path_change + 1261
        6   libnetwork.dylib                    0x0000000105641510 nw_endpoint_handler_start + 570
        7   libnetwork.dylib                    0x00000001056591f9 nw_endpoint_resolver_start_next_child + 2240
        8   libdispatch.dylib                   0x0000
Mar 13 10:36:56 P37926 com.apple.WebKit.Networking[6121]: [] nw_host_stats_add_src recv too small, received 24, expected 28
Mar 13 10:36:56 --- last message repeated 10 times ---
Mar 13 10:36:56 P37926 com.apple.WebKit.Networking[6121]: [] __nwlog_err_simulate_crash simulate crash already simulated "nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available"
Mar 13 10:36:56 P37926 com.apple.WebKit.Networking[6121]: [] nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:
            [x86_64] libnetcore-856.30.16
        0   libsystem_network.dylib             0x000000010536d666 __nw_create_backtrace_string + 123
        1   libnetwork.dylib                    0x000000010564b006 nw_socket_add_input_handler + 3164
        2   libnetwork.dylib                    0x0000000105628555 nw_endpoint_flow_attach_protocols + 3768
        3   libnetwork.dylib                    0x0000000105627572 nw_endpoint_flow_setup_socket + 563
        4   libnetwork.dylib                    0x0000000105626298 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2612
        5   libnetwork.dylib                    0x0000000105641ae1 nw_endpoint_handler_path_change + 1261
        6   libnetwork.dylib                    0x0000000105641510 nw_endpoint_handler_start + 570
        7   libnetwork.dylib                    0x00000001056591f9 nw_endpoint_resolver_start_next_child + 2240
        8   libdispatch.dylib                   0x0000
Mar 13 10:37:16 P37926 com.apple.WebKit.Networking[6121]: [] nw_endpoint_handler_add_write_request [7.1 104.78.4.43:443 failed socket-flow (satisfied)] cannot accept write requests
Mar 13 10:37:16 P37926 com.apple.WebKit.Networking[6121]: [] __tcp_connection_write_eof_block_invoke Write close callback received error: [22] Invalid argument
Mar 13 10:40:45 P37926 photoanalysisd[6130]: objc[6130]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x10a35b998) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x106b64880). One of the two will be used. Which one is undefined.
Mar 13 10:40:45 P37926 logd[5986]: metadata shared cached uuid is null (using logd's shared cache info) photoanalysisd (6130)
Mar 13 10:40:45 P37926 logd[5986]: Failed to harvest strings for pathless uuid '00000000-0000-0000-0000-000000000000'
liubin-acn commented 7 years ago

@jmoody By the way I try to use follow function to track webview loading state

options = {:timeout => timeout}
      wait_for(wait_options('Delegate says page is done loading', options)) do
        query('WKWebView', :UIDelegate, :loading).first != 1
        puts "#{query('WKWebView', :UIDelegate, :loading)}"
      end

but I got "["*****"]" in Terminal. It is a loop

["*****"]
["*****"]
["*****"]
["*****"]
... 
jmoody commented 7 years ago
query('WKWebView', :UIDelegate, :loading)

The UIDelegate is an artifact of implementation.

Try:

query('WKWebView', :loading)
liubin-acn commented 7 years ago

@jmoody

Thank you for your reply. I added log in previous comment, Could you please help me to resolve this issue.

liubin-acn commented 7 years ago

Hi, @jmoody

Could you please help me to resolve this issue.

liubin-acn commented 7 years ago

@jmoody

If the page is reloading (after changing languages), you must wait for the page to load. ---> Actually, page is not reloading, I think simulator is crash, because I can not tap any button on the simulator and this page loads forever.

jmoody commented 7 years ago

Can you reproduce in a sample project?