appium / appium

Cross-platform automation framework for all kinds of apps, built on top of the W3C WebDriver protocol
http://appium.io/
Apache License 2.0
18.92k stars 6.08k forks source link

Support Xcode 12.4 + iOS 14.4 #15044

Closed dpgraham closed 3 years ago

dpgraham commented 3 years ago

The problem

The release candidate is out and it has support for iOS 14.4

Environment

Code To Reproduce Issue [ Good To Have ]

Results:

 256 passing (47m)
  31 pending
  4 failing

  1) XCUITestDriver - basics -
       get geo location -
         should fail because of preference error:

      AssertionError: expected promise to be rejected with an error including 'Location service must be' but got '[getGeoLocation()] Error response status: 9, , UnknownCommand - The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource. Selenium error: Unhandled endpoint: /session/A5056A77-989A-4681-82F0-7F70928714A4/wda/device/location -- http://127.0.0.1:8100/ with parameters {\n    wildcards =     (\n        "session/A5056A77-989A-4681-82F0-7F70928714A4/wda/device/location"\n    );\n}'
      + expected - actual

      -[getGeoLocation()] Error response status: 9, , UnknownCommand - The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource. Selenium error: Unhandled endpoint: /session/A5056A77-989A-4681-82F0-7F70928714A4/wda/device/location -- http://127.0.0.1:8100/ with parameters {
      -    wildcards =     (
      -        "session/A5056A77-989A-4681-82F0-7F70928714A4/wda/device/location"
      -    );
      -}
      +Location service must be

  2) XCUITestDriver - element(s)
       interactions
         text fields
           set value
             should be able to type into two text fields:
     Error: [hideKeyboard()] Error response status: 13, UnknownError - An unknown server-side error occurred while processing the command. Selenium error: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: timeout of 480000ms exceeded
      at exports.newError (node_modules/wd/lib/utils.js:152:13)
      at /Users/danielgraham/appium-xcuitest-driver/node_modules/wd/lib/callbacks.js:36:19
      at /Users/danielgraham/appium-xcuitest-driver/node_modules/wd/lib/webdriver.js:205:5
      at Request._callback (node_modules/wd/lib/http-utils.js:89:7)
      at Request.self.callback (node_modules/wd/node_modules/request/request.js:185:22)
      at Request.<anonymous> (node_modules/wd/node_modules/request/request.js:1161:10)
      at IncomingMessage.<anonymous> (node_modules/wd/node_modules/request/request.js:1083:12)
      at endReadableNT (_stream_readable.js:1308:12)
      at processTicksAndRejections (internal/process/task_queues.js:80:21)

  3) XCUITestDriver - element(s)
       interactions
         text fields
           clear
             should be able to clear two text fields:
     Error: [hideKeyboard()] Error response status: 13, UnknownError - An unknown server-side error occurred while processing the command. Selenium error: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: timeout of 480000ms exceeded
      at exports.newError (node_modules/wd/lib/utils.js:152:13)
      at /Users/danielgraham/appium-xcuitest-driver/node_modules/wd/lib/callbacks.js:36:19
      at /Users/danielgraham/appium-xcuitest-driver/node_modules/wd/lib/webdriver.js:205:5
      at Request._callback (node_modules/wd/lib/http-utils.js:89:7)
      at Request.self.callback (node_modules/wd/node_modules/request/request.js:185:22)
      at Request.<anonymous> (node_modules/wd/node_modules/request/request.js:1161:10)
      at IncomingMessage.<anonymous> (node_modules/wd/node_modules/request/request.js:1083:12)
      at endReadableNT (_stream_readable.js:1308:12)
      at processTicksAndRejections (internal/process/task_queues.js:80:21)

  4) tvOS
       "before all" hook for "should launch com.apple.TVSettings":
     Error: Could not create simulator with name 'xcuitestDriverTest', device type id 'Apple TV', with runtime ids 'com.apple.CoreSimulator.SimRuntime.tvOS-14-4', '14.4'
      at Simctl.createDevice (node_modules/node-simctl/lib/subcommands/create.js:89:11)
      at Context.<anonymous> (test/functional/tv/tvos-e2e-specs.js:23:12)
ezak1253 commented 3 years ago

I have the similar issue with hideKeyboard timeout after successful keyboard hide on java binding with appium v. 1.20.2 + iOS simulator of iPad 8th Gen iOS 14.4. Other devices work just fine, and does not time out

server logs 2021-03-19 18:20:42:564 [W3C (c214a631)] Calling AppiumDriver.hideKeyboard() with args: [null,null,null,null,"c214a631-348a-4247-89fc-4671aa154ac4"] 2021-03-19 18:20:42:564 [XCUITest] Executing command 'hideKeyboard' 2021-03-19 18:20:42:575 [WD Proxy] Proxying [POST /wda/keyboard/dismiss] to [POST http://127.0.0.1:10001/session/67955AC2-28BB-40E9-BADA-7E2F3C8DECE5/wda/keyboard/dismiss] with no body 2021-03-19 18:21:42:581 [WD Proxy] Error: timeout of 240000ms exceeded 2021-03-19 18:21:42:582 [WD Proxy] at createError (/usr/local/lib/node_modules/appium/node_modules/axios/lib/core/createError.js:16:15) 2021-03-19 18:21:42:582 [WD Proxy] at RedirectableRequest.handleRequestTimeout (/usr/local/lib/node_modules/appium/node_modules/axios/lib/adapters/http.js:280:16) 2021-03-19 18:21:42:582 [WD Proxy] at Object.onceWrapper (node:events:485:26) 2021-03-19 18:21:42:582 [WD Proxy] at RedirectableRequest.emit (node:events:378:20) 2021-03-19 18:21:42:582 [WD Proxy] at ClientRequest.eventHandlers.<computed> (/usr/local/lib/node_modules/appium/node_modules/follow-redirects/index.js:13:24) 2021-03-19 18:21:42:582 [WD Proxy] at ClientRequest.emit (node:events:378:20) 2021-03-19 18:21:42:582 [WD Proxy] at Socket.emitRequestTimeout (node:_http_client:780:9) 2021-03-19 18:21:42:582 [WD Proxy] at Object.onceWrapper (node:events:484:28) 2021-03-19 18:21:42:583 [WD Proxy] at Socket.emit (node:events:390:22) 2021-03-19 18:21:42:583 [WD Proxy] at Socket._onTimeout (node:net:480:8) 2021-03-19 18:21:42:583 [WD Proxy] at listOnTimeout (node:internal/timers:557:17) 2021-03-19 18:21:42:583 [WD Proxy] at processTimers (node:internal/timers:500:7) 2021-03-19 18:21:42:583 [XCUITest] Cannot dismiss the keyboard using the native call. Trying to apply a workaround...

KazuCocoa commented 3 years ago

You could try out the lest beta. The keyboad thing depends on exists attribute of https://developer.apple.com/documentation/xctest/xcuielementtypequeryprovider/1500511-keyboards?language=objc (app.keyboard.exists), so if still it happened, only apple can fix it in probably the simulator side.

https://github.com/appium/WebDriverAgent/blob/a1824895274c60798b506f31054e4ce1e0400c71/WebDriverAgentLib/Utilities/FBKeyboard.m#L57

nicodn commented 3 years ago

We're seeing this issue on any simulator when running with xcode 12.4, even on appium 1.22.0-beta.0 Update: Tried it with Appium v1.22.0-beta.0 on Xcode version 12.1 using a simulator iPhone XR / 13.7 and the issue is still happening:

2021-05-19 12:03:30:456 [XCUITest] Executing command 'hideKeyboard'
2021-05-19 12:03:30:464 [WD Proxy] Proxying [POST /wda/keyboard/dismiss] to [POST http://127.0.0.1:53856/session/86D13779-974E-47DE-A8E4-E7EC30980D6B/wda/keyboard/dismiss] with body: {"keyNames":["done"]}
2021-05-19 12:03:34:056 [WD Proxy] Got response with status 400: {"value":{"error":"invalid element state","message":"Error Domain=com.facebook.WebDriverAgent Code=1 \"Did not know how to dismiss the keyboard. Try to dismiss it in the way supported by your application under test.\" UserInfo={NSLocalizedDescription=Did not know how to dismiss the keyboard. Try to dismiss it in the way supported by your application under test.}","traceback":""},"sessionId":"86D13779-974E-47DE-A8E4-E7EC30980D6B"}
2021-05-19 12:03:34:056 [W3C] Matched W3C error code 'invalid element state' to InvalidElementStateError
2021-05-19 12:03:34:075 [W3C (36a8c417)] Encountered internal error running command: InvalidElementStateError: Error Domain=com.facebook.WebDriverAgent Code=1 "Did not know how to dismiss the keyboard. Try to dismiss it in the way supported by your application under test." UserInfo={NSLocalizedDescription=Did not know how to dismiss the keyboard. Try to dismiss it in the way supported by your application under test.}
2021-05-19 12:03:34:075 [W3C (36a8c417)]     at errorFromW3CJsonCode (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:780:25)
2021-05-19 12:03:34:075 [W3C (36a8c417)]     at ProxyRequestError.getActualError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:663:14)
2021-05-19 12:03:34:075 [W3C (36a8c417)]     at JWProxy.command (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:272:19)
2021-05-19 12:03:34:075 [W3C (36a8c417)]     at runMicrotasks (<anonymous>)
2021-05-19 12:03:34:075 [W3C (36a8c417)]     at processTicksAndRejections (internal/process/task_queues.js:93:5)
2021-05-19 12:03:34:075 [W3C (36a8c417)]     at XCUITestDriver.proxyCommand (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/proxy-helper.js:96:12)
2021-05-19 12:03:34:075 [W3C (36a8c417)]     at XCUITestDriver.hideKeyboard (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/general.js:175:3)
2021-05-19 12:03:34:076 [HTTP] <-- POST /wd/hub/session/36a8c417-4b4b-498c-85f1-5075339dbe30/appium/device/hide_keyboard 400 3619 ms - 1506

This used to work for us on xcode 12.1 and appium 1.19.1

Is it possible that something broke in 1.21.0 ?

Improve performance of the keyboard dismissal logic appium-xcuitest-driver#1267, WebDriverAgent#458
KazuCocoa commented 3 years ago

Did the keyboard present on the view? Did the keyboard had 'done' key or another key?

The change was basically move keyboard existence check from xcuitest-driver to WDA native to improve performance. So, they should not be so different... Another possible case is the predicate search keyboard element failed to find it. Then, we potentially can turn around https://github.com/appium/WebDriverAgent/blob/master/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m#L275

nicodn commented 3 years ago

The keyboard shows up and has the 'next' key. Screen Shot 2021-05-19 at 12 54 25 PM

We downgraded again to appium 1.19.1 on xcode 12.1 and hideKeyboard is working again

KazuCocoa commented 3 years ago

Then, will http://appium.io/docs/en/commands/device/keys/hide-keyboard/ with keyName: 'next' parameter work?

nicodn commented 3 years ago

Thanks for the awesomely fast responses @KazuCocoa! I had to update some of our usages but I was able to get it working and unblocked our team for updating to the latest appium. 👍

myllerace commented 3 years ago

@nicodn how did you get it working?

JohnOSu commented 3 years ago

Using KazuCocoa's advice, self.driver.hide_keyboard(key_name='go')worked for me. The target in my case was iOS 13.4 simulator, Xcode Version 12.5.1 (12E507) on MacMini M1 (Big Sur), appium v1.21.0.

`

            <XCUIElementTypeKey type="XCUIElementTypeKey" name="@" label="@" enabled="true" visible="true" accessible="true" x="187" y="620" width="48" height="46" index="31"/>
            <XCUIElementTypeKey type="XCUIElementTypeKey" name="." label="." enabled="true" visible="true" accessible="true" x="234" y="620" width="48" height="46" index="32"/>
            <XCUIElementTypeButton type="XCUIElementTypeButton" name="Go" label="go" enabled="true" visible="true" accessible="true" x="281" y="620" width="94" height="46" index="33"/>
          </XCUIElementTypeOther>
        </XCUIElementTypeOther>
      </XCUIElementTypeKeyboard>

`

nicodn commented 3 years ago

The main thing for us was that now there's a big difference between how android and iOS hide the keyboard, so we had to update our tests to ensure that when we're calling driver.hideKeyboard(keyName) on iOS, on Android we need to add an extra step to hit that keyName separately, since Android doesn't tap the OK button when hiding the keyboard, it uses the back button. Conversely, for some cases, we had to stop using hideKeyboard on iOS tests when we didn't want to submit the input just yet.

ganjarpanji commented 3 years ago

i got error on java-client 6.1.0. im using kotlin image