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.82k stars 6.07k forks source link

bug: XCUITestDriver throwing the error: _**"Failed to create WDA session (A new session could not be created. Details: Cannot launch life.nuggets.app application. Make sure the correct bundle identifier has been provided in capabilities and check the device log for possible crash report occurrences). Retrying..."** specifically in circle ci. #19753

Closed lloydasamoah26 closed 8 months ago

lloydasamoah26 commented 8 months ago

Do I have the most recent component updates?

Is the component officially supported by the Appium team?

Is there an existing issue for this?

Current Behavior

When running appium in circle ci to perform test execution(WebdriverIO) against our react native ios application on an ios simulator I am getting the following error from the XCUITestDriver: "Failed to create WDA session (A new session could not be created. Details: Cannot launch XXXXX.app application. Make sure the correct bundle identifier has been provided in capabilities and check the device log for possible crash report occurrences). Retrying..." however when i run the same setup locally appium is able to launch the application on the simulator no issue and the tests run just fine.

Expected Behavior

I expected the appium to launch the ios application and begin running the tests

Minimal Reproducible Example

Unfortunately the project where this issue has occurred can't be shared for security reasons and I am unable to share the .app file publicly, However this issue can be recreated using any react native application . Please find the structure for the the appium tests within the project in question:

Screenshot 2024-02-05 at 00 29 31

This should help you to understand the paths used within the config.yml, wdio.ios.simulator.conf.js, and wdio.ios.real.conf.js i have included here: https://gist.github.com/lloydasamoah26/65e1ae98034730a21eae9a5f05cb5d80 to help you get your project set up to recreate the issue. I have the appium-tests directory sitting within a react native project as follows:

Screenshot 2024-02-05 at 00 43 10

Environment

All the details below are in relation to the circle environment where this issue occurs:

Link to Appium Logs

https://gist.github.com/lloydasamoah26/75499f8a561288d409b66f47178a1588

Further Information

No response

KazuCocoa commented 8 months ago

What the result of logs with showXcodeLog capability?

[XCUITestDriver@2c30 (c1cd7689)] Beginning **** with command 'xcodebuild build-for-****ing ****-without-building -project /Users/distiller/nuggets/mobile/react-native/appium-****s/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -derivedDataPath /Users/distiller/Library/Developer/Xcode/DerivedData/WebDriverAgent-bthntghqwpxelefdtqmrfsgiegry -destination id=17D29414-B320-4BD1-AB35-F487D5AEA0CA IPHONEOS_DEPLOYMENT_TARGET=16.2 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO' in directory '/Users/distiller/nuggets/mobile/react-native/appium-****s/node_modules/appium-webdriveragent'
[XCUITestDriver@2c30 (c1cd7689)] Output from xcodebuild will only be logged if any errors are present there. To change this, use 'showXcodeLog' desired capability
[XCUITestDriver@2c30 (c1cd7689)] Waiting up to 60000ms for WebDriverAgent to start

Or I guess test was replaced with **** in the log but that the result of below command issued by Appium:

xcodebuild build-for-ing -without-building -project /Users/distiller/nuggets/mobile/react-native/appium-****s/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -derivedDataPath /Users/distiller/Library/Developer/Xcode/DerivedData/WebDriverAgent-bthntghqwpxelefdtqmrfsgiegry -destination id=17D29414-B320-4BD1-AB35-F487D5AEA0CA IPHONEOS_DEPLOYMENT_TARGET=16.2 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO

mykola-mokhnach commented 8 months ago

[XCUITestDriver@2c30 (c1cd7689)] Got response with status 500: {"value":{"error":"session not created","message":"Cannot launch life.nuggets.app application. Make sure the correct bundle identifier has been provided in capabilities and check the device log for possible crash report occurrences","traceback":""},"sessionId":null}

From what I see in the above log the WDA starts properly, but the app itself fails to start. Are you sure it does not crash? Hve you tried to manually run it on a simulator?

lloydasamoah26 commented 8 months ago

Hi @KazuCocoa pease find the appium logs with Xcode Logs enabled here: https://gist.github.com/lloydasamoah26/35058967dfa3c820a7617425f7d47db0

lloydasamoah26 commented 8 months ago

@mykola-mokhnach thats what i thought initially but then

  1. Using the xcode application on my machine i was able to build the .app file then install and launch it on the simulator just fine.

  2. I then built the .app file using fastlane and and used the following commands to install it and launch it on the simulator on my machine successfully:

  1. I was then able to run appium against our application locally no issues

  2. So as part of the circle ci job i decided to run the above xcrun commands before attempting to run appium and starting the tests and there was no issue.

It is now only when webdriver attempts to launch the application do i get the error "Failed to create WDA session (A new session could not be created. Details: Cannot launch life.nuggets.app application. Make sure the correct bundle identifier has been provided in capabilities and check the device log for possible crash report occurrences). Retrying...".

mykola-mokhnach commented 8 months ago

Have you actually checked the device log from CircleCI? Might it be your machine is building for arm, but the remote one is Intel?

lloydasamoah26 commented 8 months ago

@mykola-mokhnach nope both my local machine and the circle ci machine are both running x86_64 intel machines which i have verified running uname -m.

mykola-mokhnach commented 8 months ago

I don't have any other ideas. Fetch the Simulator log. Most likely the app just crashes on execution

mykola-mokhnach commented 8 months ago

Closed because of no response