How To Determine a tvOS Simulator Started and Ready? - xcode

I'm working on an Ant build automating start/boot of a tvOS simulator, installs app in the running simulator and launch.
When I execute install-to-simulator command, many a time it appears that the simulator is not fully started yet, hence thrown an error like:
[exec] Unable to lookup in current state: Shutdown
I added a delay of 10 seconds between the start-simulator and install-to-simulator commands, but that solution isn't sufficient either.
How I can determine the state of a particular simulator? Or, how to ensure that the simulator is properly started and not in 'Shutdown' state anymore?

Initially I tried to find a solution with following command:
xcrun simctl spawn booted log stream
Unfortunately, I couldn't able to find much of an answer to my needs from the available options.
Thus, I chose to resort on following command:
// since I have simulator UDID already available
xcrun simctl list devices available | grep '$UDID'
This returns me a string output in following way:
Apple TV 4K (3rd generation) (Booted | Shutdown)
Therefore a string-check for "(Booted)" or "(Shutdown)" from the output value, does the job for me.

Related

Azure Devops running iOS XCUITests gives "Failed to start launchd_sim:"

When running my XCUITests on Azure Devops and I use 2 simulators, I get the following error:
Unable to boot the Simulator. launchd failed to respond. (Underlying Error: Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed or quit responding)))
When I use one simulator it works. Is there a way to reset the simulator are delete deviated data? Any other idea what could help is highly appreciated.
EDIT: Here are the 2 simulators I run:
destinations: |
platform=iOS Simulator,name=iPhone 8,OS=15.4
platform=iOS Simulator,name=iPhone 14,OS=16.1
I first ran them maxParallel: 4. Now I reduced to maxParallel: 1 with the result that it sometimes works and sometimes not. Really strange.
In the Xcode project I use a testplan where "Execute in parallel (if possible)" is not checked.

Discover why GoDC won't start on Mac

I'm trying to run GoCD on MacOS (10.12) for testing purposes. When I run both the server and the client apps, they do not provide any GUI output (they should show progress bars or a host configuration) and they quit a couple of seconds after starting.
When I try to run the apps from Terminal as:
/Applications/Go\ Server.app/Contents/MacOS/go-server
I get the following output:
Got directory: /Users/taatyyu1/Library/Application Support/Go Server [It exists]
and then the app quits.
How can I discover what is the issue of the apps not starting properly?
The logs of the apps are available in
~/Library/Application\ Support/Go\ Server/osx-app.log
and
~/Library/Application\ Support/Go\ Agent/osx-app.log
They contain the information from apps starting up and you can use them to figure out what goes wrong

appcelerator studio cannot find device

I'm using appcelerator studio version 4.6.0.201605201934
I'm using a nexus 6P, and windows 10
The phone has debugging enabled, and has MTP mode selected. File-Explorer detects the phone each time it is plugged in and tries to download photos from it.
I have put the google USB folder in the android/sdk/extras/google/usb_driver folder
I can see my device on the command prompt by going to the android/sdk folder
adb devices -l
HOWEVER when i go to appcelerator studio, it does not find the phone - the "run configurations" has an empty list of phones to choose from, and running it leads to it informing me that there is no device connected.
What am I doing wrong?
Have you tried to run the kill-server, and devices commands with the adb path?
In my case:
bash-3.2$ /Applications/Android/android-sdk-macosx/platform-tools/adb kill-server
bash-3.2$ /Applications/Android/android-sdk-macosx/platform-tools/adb devices
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
If this still doesn't solve your problem, try to add the Vendor ID of the device to the adb_usb.ini file, usually placed:
Windows: C:\Users\YourUser\.android
Mac OS: ~/.android
You can find the Vendor ID at the hardware info on Mac OS here: /Applications/Utilities/System Information
There is also a list of Vendor IDs at the android documentation: https://developer.android.com/studio/run/device.html
Your file will look, like this:
# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0x18d1
I have been using Titanium for some time and I also have the same issue regardless of what device or USB port I use. I even have the issue with simulators.
So I do the following instead:
# Install the application (replacing the existing one if it exists)
adb install -r build/android/bin/YOURAPP.apk
# Run the application (you could also just open the application on your phone)
adb shell am start -n com.package.name/com.package.name.ActivityName
# Show logs
adb logcat "TiAPI:*" "*:S"
The adb tool can be found in windows 10 at this path
/Users/username/AppData/Local/Android/sdk/platform-tools/adb.exe
The activity name can be found in the build/android/AndroidManifest.xml file.
It's usually: YourAppNameActivity
More information about logcat can be found here:
https://logmatic.io/blog/a-how-to-guide-to-debugging-with-android-logcat/
https://developer.android.com/studio/command-line/logcat.html

Issue with IOS Instruments running from command line on build machine

I've successfully run IOS UI Automation Instruments from command line on my local Mac. When it starts to test, the simulator will automatically pop up and then do the stuff.
However, when I SSH to a build server (with OSX and xcode, will use Jenkins eventually) and try to do the same thing, it doesn't work well.
Building process is fine, but as long as I run instruments, the terminal will then hang there without doing anything. I figure it has something to do with iphone simulator GUI but since it's CLI, I don't know what's going on...
Do you guys have any idea? Thanks!!
.
After executing the command from Jenkins through SSH; in most cases you would see a pop up window as in the screen shot. You will have to get past this screen to execute your tests. This post addresses how to get past that issue Stop "developer tools access needs to take control of another process for debugging to continue" alert
I've had the same issue. instruments -w "$DEVICE" were ignoring parameters.
Same with
DEVICE_TARGET='iPhone 6 (8.1 Simulator)' cucumber --format json -o test-reports/cucumber-8.1-iphone.json
It were ignoring DEVICE_TARGET parameter.
Solved via running Jenkins slave NOT as a SSH slave but as the Slave agent via java web start
http://i.stack.imgur.com/lNlPA.png
As i understand this issue is caused by OS X launchagent that managing sshd and performs scope of restrictions for remote users.
IMPORTANT! Slave agent should be started from OS X desktop, not via ssh! I've connected via VNC and launched slave java web agent on the OS X UI terminal.

Titanium Studio and VirtualBox Android x86

Step by step: 0) Install Appcelerator Titanium Studio.
1) Install Oracle VirtualBox.
2) Download and Install Android x86 VM. Instructions (Russian) here http://habrahabr.ru/post/119931/
3) Run and configure Android x86 (configure means that you should have 2 ethernet adapters and your Android x86 Virtual Machine(VM) must have an IP (for example 192.168.56.101))
3.5) try to ping your VM. Everithing should works just fine.
4) Run you Titanium studio and create an new project.
5) Run command line and from %Android SDK%/platform-tools/ directory perform operation
"adb connect 192.168.56.101".
it has to connect to VM successfully on port 5555.
Note: IF you not did this your Titanium Studio will log something like this
[DEBUG] ...\AndroidSDK\platform-tools\adb.exe start-server
[INFO] Titanium SDK version: 2.1.4 (11/09/12 12:46 51f2c64)
[DEBUG] Waiting for device to be ready ...
[TRACE] adb devices returned 0 devices/emulators
[TRACE] adb devices returned 0 devices/emulators
[TRACE] adb devices returned 0 devices/emulators
6) Try to install your Titanium Application on the DEVICE. As a platform i select Android 4.0.3 [x86]
6.5) Titanium studio would do a lot of work and it ends with:
[DEBUG] Waiting for device to be ready ...
[TRACE] adb devices returned 1 devices/emulators
[DEBUG] Device connected... (waited 0 seconds)
[DEBUG] waited 0.015000 seconds on emulator to get ready
[INFO] Installing application on device
7) Titanium successfully found the and have connected to the device? compiled all of the resources and trying to install your application to the device with this:
"C:\!Development\AndroidSDK\platform-tools\adb.exe -d install -r C:\!Development\Titanium\china\build\android\bin\app.apk"
But there is not matter how much time you will wait it won't install.
What is the problem? What i did wrong?
You have to make corrections to the file:
%HOME%\AppData\Roaming\Titanium\mobilesdk\win32\3.0.2.GA\android\builder.py
according to the screenshots in this article (Russian).
Can't this help?
It seems that you need to use adbhost
http://code.google.com/p/android-on-freerunner/wiki/AndroidDebugBridge
Here is the manual from xda to make it through wifi
How can I connect to Android with ADB over TCP?
Since the Link in ReinRaus 's post is down, i wanted to share the solution with you guys:
Get to %APPDATA%/Titanium/mobilesdk/win32/3.1.3.GA/android and open up builder.py
(Note: Replace 3.1.3.GA with your Version)
At around line #2601 you find:
device_args = ['-d']
# We have to be careful here because Windows can't handle an empty argument
# on the command line, so if a device serial number is not passed in, but
# a debugger_host (the argument after device serial number) _is_ passed in,
# to Windows it just looks like a serial number is passed in (the debugger_host
# argument shifts left to take over the empty argument.)
This is the line which causes the Install Script to force USBDebug mode, as seen in the Log while deploying:
[DEBUG] XX/sdk/platform-tools/adb.exe -d shell ls /data/app/xx.yyy.zzz*.apk
Change the args to ['-a']. This will stop forcing USB Devices only and you should be fine

Resources