webdriverio / appium-boilerplate

Boilerplate project to run WebdriverIO tests with Appium to test native applications on iOS and Android
MIT License
453 stars 261 forks source link

Question - GitHub Actions iOS simulator issues - can't connect - Appiu, EPIPE exception #455

Closed unickq closed 1 month ago

unickq commented 1 month ago

Hi there, I cloned this repo and tried to launch it with iOS and Android simulators. Android works fine, but struggling with iOS

iOS Caps

  capabilities: [
    {
      browserName: "safari",
      platformName: "iOS",
      "wdio:maxInstances": 1,
      // "appium:deviceName": "iPhone 14",
      // "appium:platformVersion": "17.5",
      "appium:orientation": "PORTRAIT",
      "appium:automationName": "XCUITest",
      "appium:newCommandTimeout": 240,
      "appium:wdaLaunchTimeout": 300000,
    },
  ],

GitHub actions logs for iPhone 14 iOS 17.5 macos-14 - NO DEVICE SET

[0-0] 2024-09-19T16:37:16.397Z INFO webdriver: DATA {
[0-0]   capabilities: {
[0-0]     alwaysMatch: {
[0-0]       browserName: 'safari',
[0-0]       platformName: 'iOS',
[0-0]       'wdio:maxInstances': 1,
[0-0]       'appium:orientation': 'PORTRAIT',
[0-0]       'appium:automationName': 'XCUITest',
[0-0]       'appium:newCommandTimeout': [24](https://github.com/xxx/ui-mobile-tests/actions/runs/10945165531/job/30388754175#step:6:25)0,
[0-0]       'appium:wdaLaunchTimeout': 300000
[0-0]     },
[0-0]     firstMatch: [ {} ]
[0-0]   },
[0-0]   desiredCapabilities: {
[0-0]     browserName: 'safari',
[0-0]     platformName: 'iOS',
[0-0]     'wdio:maxInstances': 1,
[0-0]     'appium:orientation': 'PORTRAIT',
[0-0]     'appium:automationName': 'XCUITest',
[0-0]     'appium:newCommandTimeout': 240,
[0-0]     'appium:wdaLaunchTimeout': 300000
[0-0]   }
[0-0] }
[0-0] 2024-09-19T16:39:19.0[29](https://github.com/xxx/ui-mobile-tests/actions/runs/10945165531/job/30388754175#step:6:30)Z ERROR webdriver: AbortError: This operation was aborted
[0-0]     at node:internal/deps/undici/undici:1[31](https://github.com/xxx/ui-mobile-tests/actions/runs/10945165531/job/30388754175#step:6:32)78:13

Appium logs

```bash 2024-09-19 16:37:05:240 [Appium] Welcome to Appium v2.11.4 (REV 1c0752b5ec0fd38c95bf031c09b18e4850f183d4) 2024-09-19 16:37:05:244 [Appium] Non-default server args: 2024-09-19 16:37:05:245 [Appium] { basePath: '/', relaxedSecurityEnabled: true } 2024-09-19 16:37:05:246 [Appium] The autodetected Appium home path: /Users/runner/work/ui-mobile-tests/ui-mobile-tests 2024-09-19 16:37:05:246 [Appium] Attempting to load driver xcuitest... 2024-09-19 16:37:05:247 [Appium] Attempting to load driver uiautomator2... 2024-09-19 16:37:05:254 [Appium] Requiring driver at /Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/appium-xcuitest-driver/build/index.js 2024-09-19 16:37:05:255 [Appium] Requiring driver at /Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/appium-uiautomator2-driver/build/index.js 2024-09-19 16:37:11:708 [Appium] XCUITestDriver has been successfully loaded in 6.457s 2024-09-19 16:37:11:709 [Appium] AndroidUiautomator2Driver has been successfully loaded in 6.458s 2024-09-19 16:37:11:754 [Appium] Appium REST http interface listener started on http://0.0.0.0:4723 2024-09-19 16:37:11:755 [Appium] You can provide the following URLs in your client code to connect to this server: http://127.0.0.1:4723/ (only accessible from the same host) http://192.168.64.4:4723/ 2024-09-19 16:37:11:755 [Appium] Available drivers: 2024-09-19 16:37:11:757 [Appium] - xcuitest@7.26.4 (automationName 'XCUITest') 2024-09-19 16:37:11:757 [Appium] - uiautomator2@3.8.0 (automationName 'UiAutomator2') 2024-09-19 16:37:11:757 [Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use. 2024-09-19 16:37:16:485 [HTTP] --> POST /session {"capabilities":{"alwaysMatch":{"browserName":"safari","platformName":"iOS","wdio:maxInstances":1,"appium:orientation":"PORTRAIT","appium:automationName":"XCUITest","appium:newCommandTimeout":240,"appium:wdaLaunchTimeout":300000},"firstMatch":[{}]},"desiredCapabilities":{"browserName":"safari","platformName":"iOS","wdio:maxInstances":1,"appium:orientation":"PORTRAIT","appium:automationName":"XCUITest","appium:newCommandTimeout":240,"appium:wdaLaunchTimeout":300000}} 2024-09-19 16:37:16:488 [AppiumDriver@01ae] Calling AppiumDriver.createSession() with args: [{"browserName":"safari","platformName":"iOS","wdio:maxInstances":1,"appium:orientation":"PORTRAIT","appium:automationName":"XCUITest","appium:newCommandTimeout":240,"appium:wdaLaunchTimeout":300000},null,{"alwaysMatch":{"browserName":"safari","platformName":"iOS","wdio:maxInstances":1,"appium:orientation":"PORTRAIT","appium:automationName":"XCUITest","appium:newCommandTimeout":240,"appium:wdaLaunchTimeout":300000},"firstMatch":[{}]}] 2024-09-19 16:37:16:489 [AppiumDriver@01ae] Event 'newSessionRequested' logged at 1726763836489 (16:37:16 GMT+0000 (Coordinated Universal Time)) 2024-09-19 16:37:16:498 [Appium] Attempting to find matching driver for automationName 'XCUITest' and platformName 'iOS' 2024-09-19 16:37:16:498 [Appium] The 'xcuitest' driver was installed and matched caps. 2024-09-19 16:37:16:498 [Appium] Will require it at /Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/appium-xcuitest-driver 2024-09-19 16:37:16:503 [Appium] Requiring driver at /Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/appium-xcuitest-driver/build/index.js 2024-09-19 16:37:16:509 [AppiumDriver@01ae] Appium v2.11.4 creating new XCUITestDriver (v7.26.4) session 2024-09-19 16:37:16:509 [AppiumDriver@01ae] Checking BaseDriver versions for Appium and XCUITestDriver 2024-09-19 16:37:16:509 [AppiumDriver@01ae] Appium's BaseDriver version is 9.11.4 2024-09-19 16:37:16:510 [AppiumDriver@01ae] XCUITestDriver's BaseDriver version is 9.11.4 2024-09-19 16:37:16:513 [AppiumDriver@01ae] Applying relaxed security to 'XCUITestDriver' as per server command line argument. All insecure features will be enabled unless explicitly disabled by --deny-insecure 2024-09-19 16:37:16:514 [XCUITestDriver@1d90] 2024-09-19 16:37:16:514 [XCUITestDriver@1d90] Creating session with W3C capabilities: { "alwaysMatch": { "browserName": "safari", "platformName": "iOS", "wdio:maxInstances": 1, "appium:orientation": "PORTRAIT", "appium:automationName": "XCUITest", "appium:newCommandTimeout": 240, "appium:wdaLaunchTimeout": 300000 }, "firstMatch": [ {} ] } 2024-09-19 16:37:16:519 [XCUITestDriver@1d90] The following provided capabilities were not recognized by this driver: 2024-09-19 16:37:16:519 [XCUITestDriver@1d90] wdio:maxInstances 2024-09-19 16:37:16:519 [XCUITestDriver@1d90] 'platformVersion' capability ('undefined') is not a valid version number. Consider fixing it or be ready to experience an inconsistent driver behavior. 2024-09-19 16:37:16:520 [af0e649c][XCUITestDriver@1d90] Session created with session id: af0e649c-6b89-44c3-bdbf-bdcd08c6ba9a 2024-09-19 16:37:16:597 [af0e649c][XCUITest] Current user: 'runner' 2024-09-19 16:37:16:597 [af0e649c][XCUITestDriver@1d90] No real device udid has been provided in capabilities. Will select a matching simulator to run the test. 2024-09-19 16:37:27:538 [af0e649c][XCUITestDriver@1d90] iOS SDK Version set to '17.5' 2024-09-19 16:37:27:539 [af0e649c][XCUITestDriver@1d90] No platformVersion specified. Using the latest version Xcode supports: '17.5'. This may cause problems if a simulator does not exist for this platform version. 2024-09-19 16:37:29:179 [af0e649c][XCUITestDriver@1d90] Looking for an existing Simulator with platformName: iOS, platformVersion: 17.5, deviceName: undefined 2024-09-19 16:37:29:179 [af0e649c][XCUITestDriver@1d90] The 'deviceName' capability value is empty. Selecting the first matching device 'iPhone SE (3rd generation)' having the 'platformVersion' set to 17.5 2024-09-19 16:37:29:283 [af0e649c][XCUITestDriver@1d90] Constructing iOS simulator for Xcode version 15.4 with udid 'C3546977-665C-41EF-A019-865AF45435A9' 2024-09-19 16:37:29:284 [af0e649c][XCUITestDriver@1d90] Determining device to run tests on: udid: 'C3546977-665C-41EF-A019-865AF45435A9', real device: false 2024-09-19 16:37:29:284 [af0e649c][XCUITestDriver@1d90] Event 'xcodeDetailsRetrieved' logged at 1726763849284 (16:37:29 GMT+0000 (Coordinated Universal Time)) 2024-09-19 16:37:29:284 [af0e649c][XCUITestDriver@1d90] Safari test requested 2024-09-19 16:37:29:288 [af0e649c][XCUITestDriver@1d90] Event 'appConfigured' logged at 1726763849288 (16:37:29 GMT+0000 (Coordinated Universal Time)) 2024-09-19 16:37:29:288 [af0e649c][XCUITestDriver@1d90] Event 'resetStarted' logged at 1726763849288 (16:37:29 GMT+0000 (Coordinated Universal Time)) 2024-09-19 16:37:30:808 [af0e649c][simctl] Error running 'terminate': An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=405): Unable to lookup in current state: Shutdown 2024-09-19 16:37:30:808 [af0e649c][XCUITestDriver@1d90] Reset: failed to terminate Simulator application with id "com.apple.mobilesafari" 2024-09-19 16:37:31:998 [af0e649c][simctl] Error running 'terminate': An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=405): Unable to lookup in current state: Shutdown 2024-09-19 16:37:31:998 [af0e649c][XCUITestDriver@1d90] Scrubbing Safari data files 2024-09-19 16:37:32:991 [af0e649c][simctl] Error running 'get_app_container': An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=405): Unable to lookup in current state: Shutdown 2024-09-19 16:37:32:991 [af0e649c][XCUITestDriver@1d90] Error: Command '/usr/bin/xcrun simctl get_app_container C3546977-665C-41EF-A019-865AF45435A9 com.apple.mobilesafari data' exited with code 149 at ChildProcess. (/Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/appium-xcuitest-driver/node_modules/teen_process/lib/exec.js:110:19) at ChildProcess.emit (node:events:519:28) at maybeClose (node:internal/child_process:1105:16) at Socket. (node:internal/child_process:457:11) at Socket.emit (node:events:519:28) at Pipe. (node:net:339:12) at Pipe.callbackTrampoline (node:internal/async_hooks:130:17) 2024-09-19 16:37:32:991 [af0e649c][XCUITestDriver@1d90] Error running 'get_app_container': An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=405): Unable to lookup in current state: Shutdown ```

GitHub actions logs for iPhone 14 iOS 17.5 macos-14 - DEVICE SET

[0-0] 2024-09-19T16:43:19.139Z INFO webdriver: [POST] http://127.0.0.1:4723/session
[0-0] 20[24](https://github.com/xxx/ui-mobile-tests/actions/runs/10945273393/job/30389120598#step:6:25)-09-19T16:43:19.140Z INFO webdriver: DATA {
[0-0]   capabilities: {
[0-0]     alwaysMatch: {
[0-0]       browserName: 'safari',
[0-0]       platformName: 'iOS',
[0-0]       'wdio:maxInstances': 1,
[0-0]       'appium:deviceName': 'iPhone 14',
[0-0]       'appium:platformVersion': '17.5',
[0-0]       'appium:orientation': 'PORTRAIT',
[0-0]       'appium:automationName': 'XCUITest',
[0-0]       'appium:newCommandTimeout': 240,
[0-0]       'appium:wdaLaunchTimeout': [30](https://github.com/xxx/ui-mobile-tests/actions/runs/10945273393/job/30389120598#step:6:31)0000
[0-0]     },
[0-0]     firstMatch: [ {} ]
[0-0]   },
[0-0]   desiredCapabilities: {
[0-0]     browserName: 'safari',
[0-0]     platformName: 'iOS',
[0-0]     'wdio:maxInstances': 1,
[0-0]     'appium:deviceName': 'iPhone 14',
[0-0]     'appium:platformVersion': '17.5',
[0-0]     'appium:orientation': 'PORTRAIT',
[0-0]     'appium:automationName': 'XCUITest',
[0-0]     'appium:newCommandTimeout': 2[40](https://github.com/xxx/ui-mobile-tests/actions/runs/10945273393/job/30389120598#step:6:41),
[0-0]     'appium:wdaLaunchTimeout': 300000
[0-0]   }
[0-0] }
[0-0] 2024-09-19T16:45:19.203Z ERROR webdriver: AbortError: This operation was aborted

Appium logs

``` 2024-09-19 16:43:05:671 [Appium] Welcome to Appium v2.11.4 (REV 63626bf6af5b5027c4a75be76f952d2e6ddca494) 2024-09-19 16:43:05:674 [Appium] Non-default server args: 2024-09-19 16:43:05:676 [Appium] { basePath: '/', relaxedSecurityEnabled: true } 2024-09-19 16:43:05:676 [Appium] The autodetected Appium home path: /Users/runner/work/ui-mobile-tests/ui-mobile-tests 2024-09-19 16:43:05:676 [Appium] Attempting to load driver uiautomator2... 2024-09-19 16:43:05:677 [Appium] Attempting to load driver xcuitest... 2024-09-19 16:43:05:680 [Appium] Requiring driver at /Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/appium-uiautomator2-driver/build/index.js 2024-09-19 16:43:05:685 [Appium] Requiring driver at /Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/appium-xcuitest-driver/build/index.js 2024-09-19 16:43:11:327 [Appium] AndroidUiautomator2Driver has been successfully loaded in 5.650s 2024-09-19 16:43:11:327 [Appium] XCUITestDriver has been successfully loaded in 5.650s 2024-09-19 16:43:11:838 [Appium] Appium REST http interface listener started on http://0.0.0.0:4723 2024-09-19 16:43:11:839 [Appium] You can provide the following URLs in your client code to connect to this server: http://127.0.0.1:4723/ (only accessible from the same host) http://192.168.64.21:4723/ 2024-09-19 16:43:11:839 [Appium] Available drivers: 2024-09-19 16:43:11:840 [Appium] - uiautomator2@3.8.0 (automationName 'UiAutomator2') 2024-09-19 16:43:11:840 [Appium] - xcuitest@7.26.4 (automationName 'XCUITest') 2024-09-19 16:43:11:840 [Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use. 2024-09-19 16:43:19:165 [HTTP] --> POST /session {"capabilities":{"alwaysMatch":{"browserName":"safari","platformName":"iOS","wdio:maxInstances":1,"appium:deviceName":"iPhone 14","appium:platformVersion":"17.5","appium:orientation":"PORTRAIT","appium:automationName":"XCUITest","appium:newCommandTimeout":240,"appium:wdaLaunchTimeout":300000},"firstMatch":[{}]},"desiredCapabilities":{"browserName":"safari","platformName":"iOS","wdio:maxInstances":1,"appium:deviceName":"iPhone 14","appium:platformVersion":"17.5","appium:orientation":"PORTRAIT","appium:automationName":"XCUITest","appium:newCommandTimeout":240,"appium:wdaLaunchTimeout":300000}} 2024-09-19 16:43:19:166 [AppiumDriver@564f] Calling AppiumDriver.createSession() with args: [{"browserName":"safari","platformName":"iOS","wdio:maxInstances":1,"appium:deviceName":"iPhone 14","appium:platformVersion":"17.5","appium:orientation":"PORTRAIT","appium:automationName":"XCUITest","appium:newCommandTimeout":240,"appium:wdaLaunchTimeout":300000},null,{"alwaysMatch":{"browserName":"safari","platformName":"iOS","wdio:maxInstances":1,"appium:deviceName":"iPhone 14","appium:platformVersion":"17.5","appium:orientation":"PORTRAIT","appium:automationName":"XCUITest","appium:newCommandTimeout":240,"appium:wdaLaunchTimeout":300000},"firstMatch":[{}]}] 2024-09-19 16:43:19:167 [AppiumDriver@564f] Event 'newSessionRequested' logged at 1726764199167 (16:43:19 GMT+0000 (Coordinated Universal Time)) 2024-09-19 16:43:19:170 [Appium] Attempting to find matching driver for automationName 'XCUITest' and platformName 'iOS' 2024-09-19 16:43:19:171 [Appium] The 'xcuitest' driver was installed and matched caps. 2024-09-19 16:43:19:171 [Appium] Will require it at /Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/appium-xcuitest-driver 2024-09-19 16:43:19:173 [Appium] Requiring driver at /Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/appium-xcuitest-driver/build/index.js 2024-09-19 16:43:19:174 [AppiumDriver@564f] Appium v2.11.4 creating new XCUITestDriver (v7.26.4) session 2024-09-19 16:43:19:174 [AppiumDriver@564f] Checking BaseDriver versions for Appium and XCUITestDriver 2024-09-19 16:43:19:174 [AppiumDriver@564f] Appium's BaseDriver version is 9.11.4 2024-09-19 16:43:19:174 [AppiumDriver@564f] XCUITestDriver's BaseDriver version is 9.11.4 2024-09-19 16:43:19:176 [AppiumDriver@564f] Applying relaxed security to 'XCUITestDriver' as per server command line argument. All insecure features will be enabled unless explicitly disabled by --deny-insecure 2024-09-19 16:43:19:176 [XCUITestDriver@903a] 2024-09-19 16:43:19:176 [XCUITestDriver@903a] Creating session with W3C capabilities: { "alwaysMatch": { "browserName": "safari", "platformName": "iOS", "wdio:maxInstances": 1, "appium:deviceName": "iPhone 14", "appium:platformVersion": "17.5", "appium:orientation": "PORTRAIT", "appium:automationName": "XCUITest", "appium:newCommandTimeout": 240, "appium:wdaLaunchTimeout": 300000 }, "firstMatch": [ {} ] } 2024-09-19 16:43:19:181 [XCUITestDriver@903a] The following provided capabilities were not recognized by this driver: 2024-09-19 16:43:19:181 [XCUITestDriver@903a] wdio:maxInstances 2024-09-19 16:43:19:181 [5f430dec][XCUITestDriver@903a] Session created with session id: 5f430dec-dfcb-44d5-bb69-7315e5c5da50 2024-09-19 16:43:19:268 [5f430dec][XCUITest] Current user: 'runner' 2024-09-19 16:43:19:269 [5f430dec][XCUITestDriver@903a] No real device udid has been provided in capabilities. Will select a matching simulator to run the test. 2024-09-19 16:43:30:674 [5f430dec][XCUITestDriver@903a] iOS SDK Version set to '17.5' 2024-09-19 16:43:31:726 [5f430dec][XCUITestDriver@903a] Looking for an existing Simulator with platformName: iOS, platformVersion: 17.5, deviceName: iPhone 14 2024-09-19 16:43:31:810 [5f430dec][XCUITestDriver@903a] Constructing iOS simulator for Xcode version 15.4 with udid 'F9EFD965-9E4A-46BA-926F-C8575C0E7EA6' 2024-09-19 16:43:31:811 [5f430dec][XCUITestDriver@903a] Determining device to run tests on: udid: 'F9EFD965-9E4A-46BA-926F-C8575C0E7EA6', real device: false 2024-09-19 16:43:31:812 [5f430dec][XCUITestDriver@903a] Event 'xcodeDetailsRetrieved' logged at 1726764211812 (16:43:31 GMT+0000 (Coordinated Universal Time)) 2024-09-19 16:43:31:812 [5f430dec][XCUITestDriver@903a] Safari test requested 2024-09-19 16:43:31:813 [5f430dec][XCUITestDriver@903a] Event 'appConfigured' logged at 1726764211813 (16:43:31 GMT+0000 (Coordinated Universal Time)) 2024-09-19 16:43:31:813 [5f430dec][XCUITestDriver@903a] Event 'resetStarted' logged at 1726764211813 (16:43:31 GMT+0000 (Coordinated Universal Time)) 2024-09-19 16:43:32:537 [5f430dec][simctl] Error running 'terminate': An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=3): Simulator device failed to terminate com.apple.mobilesafari. found nothing to terminate Underlying error (domain=NSPOSIXErrorDomain, code=3): The request to terminate "com.apple.mobilesafari" failed. found nothing to terminate found nothing to terminate 2024-09-19 16:43:32:537 [5f430dec][XCUITestDriver@903a] Reset: failed to terminate Simulator application with id "com.apple.mobilesafari" 2024-09-19 16:43:33:159 [5f430dec][simctl] Error running 'terminate': An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=3): Simulator device failed to terminate com.apple.mobilesafari. found nothing to terminate Underlying error (domain=NSPOSIXErrorDomain, code=3): The request to terminate "com.apple.mobilesafari" failed. found nothing to terminate found nothing to terminate 2024-09-19 16:43:33:159 [5f430dec][XCUITestDriver@903a] Scrubbing Safari data files 2024-09-19 16:43:33:883 [5f430dec][XCUITestDriver@903a] Event 'resetComplete' logged at 1726764213883 (16:43:33 GMT+0000 (Coordinated Universal Time)) 2024-09-19 16:43:33:883 [5f430dec][XCUITestDriver@903a] Using WDA path: '/Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent' 2024-09-19 16:43:33:884 [5f430dec][XCUITestDriver@903a] Using WDA agent: '/Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj' 2024-09-19 16:43:36:644 [5f430dec][XCUITestDriver@903a] Starting log capture for iOS Simulator with udid 'F9EFD965-9E4A-46BA-926F-C8575C0E7EA6' using simctl 2024-09-19 16:43:38:030 [5f430dec][XCUITestDriver@903a] Event 'logCaptureStarted' logged at 1726764218029 (16:43:38 GMT+0000 (Coordinated Universal Time)) 2024-09-19 16:43:38:030 [5f430dec][XCUITestDriver@903a] Setting up simulator 2024-09-19 16:43:38:036 [5f430dec][XCUITestDriver@903a] Setting preferences of F9EFD965-9E4A-46BA-926F-C8575C0E7EA6 Simulator to {"SimulatorWindowOrientation":"Portrait","SimulatorWindowRotationAngle":0,"ConnectHardwareKeyboard":false} 2024-09-19 16:43:38:036 [5f430dec][XCUITestDriver@903a] Setting common Simulator preferences to {"RotateWindowWhenSignaledByGuest":true,"StartLastDeviceOnLaunch":false,"DetachOnWindowClose":false,"AttachBootedOnStart":true,"ConnectHardwareKeyboard":false,"PasteboardAutomaticSync":false} 2024-09-19 16:43:38:394 [5f430dec][XCUITestDriver@903a] Updated F9EFD965-9E4A-46BA-926F-C8575C0E7EA6 Simulator preferences at '/Users/runner/Library/Preferences/com.apple.iphonesimulator.plist' with {"RotateWindowWhenSignaledByGuest":true,"StartLastDeviceOnLaunch":false,"DetachOnWindowClose":false,"AttachBootedOnStart":true,"ConnectHardwareKeyboard":false,"PasteboardAutomaticSync":false,"DevicePreferences":{"F9EFD965-9E4A-46BA-926F-C8575C0E7EA6":{"SimulatorWindowOrientation":"Portrait","SimulatorWindowRotationAngle":0,"ConnectHardwareKeyboard":false}}} 2024-09-19 16:43:39:141 [5f430dec][XCUITestDriver@903a] Parsed BUILD_DIR configuration value: '/Users/runner/Library/Developer/Xcode/DerivedData/WebDriverAgent-bjkfltjzywmfwagcceicbvdqouyw/Build/Products' 2024-09-19 16:43:39:142 [5f430dec][XCUITestDriver@903a] Got derived data root: '/Users/runner/Library/Developer/Xcode/DerivedData/WebDriverAgent-bjkfltjzywmfwagcceicbvdqouyw' 2024-09-19 16:43:39:152 [5f430dec][XCUITestDriver@903a] Simulator 'F9EFD965-9E4A-46BA-926F-C8575C0E7EA6' is booted while its UI is not visible. Trying to restart it with the Simulator window visible 2024-09-19 16:43:43:825 [5f430dec][XCUITestDriver@903a] Starting Simulator UI: open -Fn /Applications/Xcode_15.4.app/Contents/Developer/Applications/Simulator.app 2024-09-19 16:44:04:182 [5f430dec][XCUITestDriver@903a] Simulator with UDID F9EFD965-9E4A-46BA-926F-C8575C0E7EA6 booted in 25.773s 2024-09-19 16:44:04:313 [5f430dec][XCUITestDriver@903a] Event 'simStarted' logged at 1726764244311 (16:44:04 GMT+0000 (Coordinated Universal Time)) 2024-09-19 16:44:04:565 [5f430dec][XCUITestDriver@903a] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found 2024-09-19 16:44:04:566 [5f430dec][DevCon Factory] Requesting connection for device F9EFD965-9E4A-46BA-926F-C8575C0E7EA6 on local port 8100 2024-09-19 16:44:04:578 [5f430dec][DevCon Factory] Cached connections count: 0 2024-09-19 16:44:04:579 [5f430dec][DevCon Factory] Successfully requested the connection for F9EFD965-9E4A-46BA-926F-C8575C0E7EA6:8100 2024-09-19 16:44:04:605 [5f430dec][XCUITestDriver@903a] Starting WebDriverAgent initialization with the synchronization key 'XCUITestDriver' 2024-09-19 16:44:04:679 [5f430dec][WD Proxy] Matched '/status' to command name 'getStatus' 2024-09-19 16:44:04:680 [5f430dec][WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body 2024-09-19 16:44:05:804 [5f430dec][WD Proxy] connect ECONNREFUSED 127.0.0.1:8100 2024-09-19 16:44:05:811 [5f430dec][XCUITestDriver@903a] WDA is not listening at 'http://127.0.0.1:8100/'. Original error:: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100 2024-09-19 16:44:05:811 [5f430dec][XCUITestDriver@903a] WDA is currently not running. There is nothing to cache 2024-09-19 16:44:05:811 [5f430dec][XCUITestDriver@903a] Trying to start WebDriverAgent 2 times with 10000ms interval 2024-09-19 16:44:05:811 [5f430dec][XCUITestDriver@903a] These values can be customized by changing wdaStartupRetries/wdaStartupRetryInterval capabilities 2024-09-19 16:44:05:815 [5f430dec][XCUITestDriver@903a] Event 'wdaStartAttempted' logged at 1726764245815 (16:44:05 GMT+0000 (Coordinated Universal Time)) 2024-09-19 16:44:05:815 [5f430dec][XCUITestDriver@903a] Launching WebDriverAgent on the device 2024-09-19 16:44:06:052 [5f430dec][XCUITestDriver@903a] There is no need to perform the project cleanup. A fresh install has been detected 2024-09-19 16:44:06:059 [5f430dec][WebDriverAgent] Killing running processes 'xcodebuild.*F9EFD965-9E4A-46BA-926F-C8575C0E7EA6, F9EFD965-9E4A-46BA-926F-C8575C0E7EA6.*XCTRunner, xctest.*F9EFD965-9E4A-46BA-926F-C8575C0E7EA6' for the device F9EFD965-9E4A-46BA-926F-C8575C0E7EA6... 2024-09-19 16:44:06:443 [5f430dec][WebDriverAgent] 'pgrep -if F9EFD965-9E4A-46BA-926F-C8575C0E7EA6.*XCTRunner' didn't detect any matching processes. Return code: 1 2024-09-19 16:44:06:443 [5f430dec][WebDriverAgent] 'pgrep -if xcodebuild.*F9EFD965-9E4A-46BA-926F-C8575C0E7EA6' didn't detect any matching processes. Return code: 1 2024-09-19 16:44:06:482 [5f430dec][WebDriverAgent] 'pgrep -if xctest.*F9EFD965-9E4A-46BA-926F-C8575C0E7EA6' didn't detect any matching processes. Return code: 1 2024-09-19 16:44:06:495 [5f430dec][XCUITestDriver@903a] Beginning test with command 'xcodebuild build-for-testing test-without-building -project /Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -derivedDataPath /Users/runner/Library/Developer/Xcode/DerivedData/WebDriverAgent-bjkfltjzywmfwagcceicbvdqouyw -destination id=F9EFD965-9E4A-46BA-926F-C8575C0E7EA6 IPHONEOS_DEPLOYMENT_TARGET=17.5 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO' in directory '/Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent' 2024-09-19 16:44:06:500 [5f430dec][XCUITestDriver@903a] Output from xcodebuild will only be logged if any errors are present there. To change this, use 'showXcodeLog' desired capability 2024-09-19 16:44:10:103 [5f430dec][XCUITestDriver@903a] Waiting up to 300000ms for WebDriverAgent to start 2024-09-19 16:44:10:108 [5f430dec][XCUITestDriver@903a] Matched '/status' to command name 'getStatus' 2024-09-19 16:44:10:109 [5f430dec][XCUITestDriver@903a] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body 2024-09-19 16:44:10:165 [5f430dec][XCUITestDriver@903a] connect ECONNREFUSED 127.0.0.1:8100 2024-09-19 16:44:11:168 [5f430dec][XCUITestDriver@903a] Matched '/status' to command name 'getStatus' 2024-09-19 16:44:11:169 [5f430dec][XCUITestDriver@903a] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body .... THE SAME HERE fo some time 2024-09-19 16:45:19:915 [5f430dec][XCUITestDriver@903a] connect ECONNREFUSED 127.0.0.1:8100 2024-09-19 16:45:20:943 [5f430dec][XCUITestDriver@903a] Matched '/status' to command name 'getStatus' 2024-09-19 16:45:20:943 [5f430dec][XCUITestDriver@903a] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body 2024-09-19 16:45:20:951 uncaughtException: write EPIPE Error: write EPIPE at afterWriteDispatched (node:internal/stream_base_commons:161:15) at writeGeneric (node:internal/stream_base_commons:152:3) at Socket._writeGeneric (node:net:954:11) at Socket._write (node:net:966:8) at writeOrBuffer (node:internal/streams/writable:570:12) at _write (node:internal/streams/writable:499:10) at Socket.Writable.write (node:internal/streams/writable:508:10) at Console.log (/Users/runner/work/ui-mobile-tests/ui-mobile ```

GitHub actions logs for iPhone 14 iOS 17.2 macos-13

[0-0] 2024-09-19T16:26:44.991Z ERROR webdriver: TypeError: fetch failed
[0-0]     at node:internal/deps/undici/undici:13178:13
[0-0] 2024-09-19T16:26:45.126Z DEBUG @wdio/utils:shim: Finished to run "after" hook in 0ms
[0-0]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[0-0]     at async FetchRequest._libRequest (/Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/webdriver/build/index.js:13[60](https://github.com/xxx/ui-mobile-tests/actions/runs/10945018232/job/30388252079#step:6:61):24)
[0-0]     at async FetchRequest._request (/Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/webdriver/build/index.js:1280:20)
[0-0]     at async startWebDriverSession (/Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/webdriver/build/index.js:895:16)
[0-0]     at async Function.newSession (/Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/webdriver/build/index.js:1508:41)
[0-0]     at async remote (/Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/webdriverio/build/index.js:7187:20)
[0-0]     at async Runner._startSession (file:///Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/@wdio/runner/build/index.js:781:23)
[0-0]     at async Runner._initSession (file:///Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/@wdio/runner/build/index.js:755:22)
[0-0]     at async Runner.run (file:///Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/@wdio/runner/build/index.js:6[62](https://github.com/xxx/ui-mobile-tests/actions/runs/10945018232/job/30388252079#step:6:63):16)
[0-0] 2024-09-19T16:26:45.125Z ERROR @wdio/runner: Error: Failed to create session.

Appium logs:

```bash 2024-09-19 16:26:39:225 [Appium] Welcome to Appium v2.11.4 (REV 1bb319c656888df529400bdaa5f6eb74dff639d7) 2024-09-19 16:26:39:229 [Appium] Non-default server args: 2024-09-19 16:26:39:232 [Appium] { basePath: '/', relaxedSecurityEnabled: true } 2024-09-19 16:26:39:232 [Appium] The autodetected Appium home path: /Users/runner/work/ui-mobile-tests/ui-mobile-tests 2024-09-19 16:26:39:233 [Appium] Attempting to load driver uiautomator2... 2024-09-19 16:26:39:234 [Appium] Attempting to load driver xcuitest... 2024-09-19 16:26:39:245 [Appium] Requiring driver at /Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/appium-uiautomator2-driver/build/index.js 2024-09-19 16:26:43:912 [Appium] AndroidUiautomator2Driver has been successfully loaded in 4.676s 2024-09-19 16:26:43:931 [Appium] Requiring driver at /Users/runner/work/ui-mobile-tests/ui-mobile-tests/node_modules/appium-xcuitest-driver/build/index.js 2024-09-19 16:26:49:389 [Appium] XCUITestDriver has been successfully loaded in 10.113s 2024-09-19 16:26:49:394 uncaughtException: write EPIPE ```

Environment

  "devDependencies": {
    "@wdio/appium-service": "^9.0.9",
    "@wdio/cli": "^9.0.9",
    "@wdio/globals": "^9.0.9",
    "@wdio/junit-reporter": "^9.0.8",
    "@wdio/local-runner": "^9.0.9",
    "@wdio/mocha-framework": "^9.0.8",
    "@wdio/spec-reporter": "^9.0.8",
    "appium": "^2.11.4",
    "appium-uiautomator2-driver": "^3.8.0",
    "appium-xcuitest-driver": "7.26.4",
    "typescript": "^5.6.2"
  },

GitHub Actions config

name: E2E - Browser Tests

on:
  workflow_dispatch:
  pull_request:
    branches:
      - main

jobs:
  iOS-browser:
    runs-on: macos-13
    timeout-minutes: 10
    steps:
      - name: ⬇️ Checkout Repository
        uses: actions/checkout@v4
      - name: 🟢 Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version-file: ".nvmrc"
      - name: 🧩 Install Dependencies
        run: npm ci
      - name: 📱 Start iOS Device
        uses: futureware-tech/simulator-action@v3
        with:
          model: "iPhone 14"
          os_version: "17.5" # or any other version
      - name: 🧪 Run tests iOS emulator
        run: |
          npm run ios.browser
unickq commented 1 month ago

I also tried launching simulators with xcode - the same result

sudo xcode-select -switch /Applications/Xcode.app
sudo xcodebuild -license accept
xcrun simctl create mySim com.apple.CoreSimulator.SimDeviceType.iPhone-14 com.apple.CoreSimulator.SimRuntime.iOS-17-5
xcrun simctl boot mySim
xcrun simctl bootstatus mySim

and tried old config from your samples - https://github.com/webdriverio/appium-boilerplate/blob/110c11cceaddba4241eee29297f5a0007176e4d3/.github/workflows/e2e-ios-app.yml

wswebcreation commented 1 month ago

The Appium logs state you don’t have a deviceName and no platformVersion

are you also running this on GHA? If so then there is a also a limited set of devices and versions available. You can check the docs of GHA

unickq commented 1 month ago

image I posted a very detailed report with all options and logs. @wswebcreation, thanks for closing it without even reading it.

wswebcreation commented 1 month ago

I'm sorry for closing it, I read the post, but I wasn't correct (I was doing that on my phone which I shouldn't do in the future).

Based on reading all the logs properly, this might be a connection timeout. What I know about GHA is that the resources are not as powerful as normal which might result in:

Based on the logs it stops the session after 120 seconds, this is also the default of WDIO, see https://webdriver.io/docs/configuration/#connectionretrytimeout. Try increasing this to 3 or 5 min.

I'm 99.99% sure this is not related to a bug in WDIO or the boilerplate, so I keep it closed, but it's still open for discussion. And again, sorry for closing it without the correct context

unickq commented 3 weeks ago

Thanks @wswebcreation, I tried to add those timeouts, but no luck

    {
      browserName: "safari",
      platformName: "iOS",
      "appium:deviceName": process.env.ios_model || "iPhone 14",
      "appium:platformVersion": process.env.ios_version || "17.5",
      "appium:orientation": "PORTRAIT",
      "appium:automationName": "XCUITest",
      "appium:newCommandTimeout": 240,
      // "appium:showXcodeLog": false,
      // "appium:showIOSLog": false,
      // "appium:launchWithIDB": true,
      // "appium:wdaLocalPort": 8101,
      "appium:wdaLaunchTimeout": 60_000 * 5,
      "appium:wdaStartupRetries": 5,
      "appium:wdaStartupRetryInterval": 30_000,
      "appium:wdaConnectionTimeout": 60_000 * 3,
      "appium:simulatorStartupTimeout": 60_000 * 3,
    }

I raised the same question in https://github.com/appium/appium/issues/20601

wswebcreation commented 3 weeks ago

Do you also have more logs about the simulator/XCODE on GHAs? It might tell more about how long it takes to start the sim/build WDA