unable to run scripts on simulator from cron tab - ios

We are using sikuli tool for mobile automation on our MAC OSX 10.7.3
I have written a shell script to open simulator and to run scripts on simulator
/Users/ezprintsqa/Downloads/FoneMonkey/bin/iphonesim launch /Users/ezprintsqa/Documents/Xcode/DerivedData/SnapCards- btmjdowsgmixpvdyfxfvhxtoihab/Build/Products/Debug-iphonesimulator/SnapCardsFoneMonkey.app&
/Users/ezprintsqa/Downloads/Sikuli-IDE.app/sikuli-ide.sh -r /Users/ezprintsqa/Downloads/SikuliWorkSpace/SnapcardsTestSuite1.sikuli
When I execute from command line I can see simulator opening and scripts getting executed on simulator.
But when I do same thing using cron tab I can see only simulator opening but the tool can't identify the simulator now to run scripts, the tool throws error message that it is unable to identify the simulator.
When the tool is able to identify the simulator while running from command prompt why is it unable to identify while running from crontab?
Thanks

You are saying:
the tool throws error message that it is unable to identify the simulator.
Do I understand right, that the script throws a FindFailed exception, meaning, that some image (might be the visual identification of the simulator window) is not found on the screen within the standard waiting time of 3 seconds?
I this is the case, you should give more time to the simulator to start up in the crontab case, either by adding a wait(n) at the beginning of the Sikuli script or use wait(image, n) to wait longer for the image to appear

Related

How to output log to terminal from iOS simulator?

Logging to Chrome is extremely slow for me to the point of being unusable so I'm trying to get it to log to the terminal instead. They provide a command react-native log-ios for this but it gives me this error:
error Cannot read property 'udid' of null. Run CLI with --verbose flag for more details.
which, like 99% of React Native errors, makes no sense to me.
Any idea how I can get this command to work? Or is there any system command, similar to adb logcat for Android, that I can use directly to print iOS Simulator log to the terminal?

Debugging Cordova iOS plugin with NSLog, where does it output?

I followed the tutorial at the Cordova official website to create my first "hello world" program for iOS, and everything went successfully, and I'm able to run the example application in the simulator just fine. What I need is to test, use and if necessary fix an iOS plugin. I installed the plugin and it seems to have installed and works fine.
My problem is simple: I'm trying to output some debugging information from the Objective-C code of the plugin using NSLog(), but I have no idea where that output can be seen.
I am definitely editing the correct .m file (inside the platforms/ios/HelloWorld/Plugins/plugin-name directory), as eg. syntax errors show up and stop the "cordova emulate ios" command from completing successfully. So I'm certain that my NSLog() additions are being compiled in. I'm also certain that the functions in question are being called from the javascript. I just don't know where those messages are being outputted to.
In the simulator I try to select Debug > Open System Log... but nothing of what I'm printing appears there.
When I run "cordova emulate ios", it says "[ios-sim] logPath: /path/to/the/project/platforms/ios/cordova/console.log". However, there is no such file in that directory. (In fact, there is no file named "console.log" anywhere inside the project directory tree.)
NSLog logs to the simulated device's logarchive. You must select the simulator device in Console to see that, or you can use the CLI:
xcrun simctl spawn booted log show
xcrun simctl spawn booted log stream
etc...
Check the log command's help and man pages for filtering options.

How to successfully run iOS simulator from Bamboo agent script

I'm trying to run tests using xcodebuild through a Bamboo job script task. It opens the simulator, but it stays black and nothing happens, and the script fails due to timeout. Running the identical xcodebuild script goes fine via terminal. Here's the only related log message I was able to find:
Unable to connect to SimulatorBridge
Simulator[30414] <Error>: Unable to determine device.
Things I've already tried:
removing simulator and adding new ones
checking that bamboo agent is running under default user (which happens to be admin)
reseting simulator in advance using xcrun simctl erase
running open -a /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/ does the job. source

Calabash-ios: Run test physical device installed ipa without xcodeproj

I am new with calabash-ios and have a dummy question is:
How possibly could I run a calabash test with real device which have installed ipa file (included calabash framework) and without xcodeproj?
Problem is I am doing QA and Dev only gives me ipa file to test without source code.
UPDATE:
I am able to run the ipa file in console and cucumber by adding BUNDLE_ID. And make sure the CFNetwork.framework is including in app framework to establish the connection.
But I got another problem to run the scenario:
1. When I run the command below:
DEVICE_ENDPOINT=http://192.168.1.9:37265 NO_LAUNCH=1 BUNDLE_ID=com.example.appname DEVICE_TARGET=UDID cucumber
Then I got this error:
A JSON text must at least contain two octets! (JSON::ParserError)
features/my_first.feature:8:in `Then I touch "LOG-IN/ CREATE ACCOUNT"'
all other steps was skipped
Then I run the console code
DEVICE_ENDPOINT=http://192.168.1.9:37265 NO_LAUNCH=1 BUNDLE_ID=com.example.appname DEVICE_TARGET=UDID calabash-ios console
Then I run server_version
I got reply back that said connection SUCCEED
But when I run start_test_server_in_background
It took me too long to wait and I see the app my physical device kept crashed and launch again and again until it stop as:
Unable to start. Make sure you've set APP_BUNDLE_PATH to a build supported by this simulator version
Calabash::Cucumber::Launcher::StartError: Calabash::Cucumber::Launcher::StartError:
"Timed out waiting for UIAutomation run-loop Error while writing to fifo. RunLoop::Fifo::NoReaderConfiguredError.
2015-10-01 10:49:41.634 instruments[15640:10558880] WebKit Threading Violation - initial use of WebKit from a secondary thread.
2015-10-01 10:49:42.574 instruments[15640:10558978] Attempting to change event horizon while disengage
2015-10-01 10:49:42.577 instruments[15640:10558877] Attempting to change event horizon while disengage
Instruments Trace Error : Target failed to run: Permission to debug app
Anyone can help please! I tried to search some solution but they almost issue on simulator and they contain xcodeproj. As a QA, I dont have the source code, only .ipa file. :(
Thanks
You should set 3 variables:
$ DEVICE_TARGET=<UDID> \
DEVICE_ENDPOINT=http://<ip>:37265 \
BUNDLE_ID=com.example.YourApp cucumber
The device and the host computer should be on the same network.
The .ipa must be installed on your device.
You can do this in Xcode by dragging-and-dropping in the Device Manager window or with a third-party tool like ideviceinstaller (available with homebrew).
You should never set NO_LAUNCH.
http://calabashapi.xamarin.com/ios/file.ENVIRONMENT_VARIABLES.html#label-NO_LAUNCH
You also need to enable you device for develop and turn on UIAutomation in the Settings.app > Developer.
Enabling device for development
RunLoop::Fifo::NoReaderConfiguredError
UPDATE In response to this question, I rewrote the Testing on Physical Devices Calabash iOS wiki page. Wow, that content was ancient!
As long as the file is build with calabash then that is not a problem. You just call cucumber with APP_BUNDLE_PATH to where ever your .ipa file is and should be all set.
But you should be aware that .ipa needs to be build to match the target you run the tests on.

Instrument crash at startup appium

Am trying to run appium tool for testing apps. While starting appium server i finished all setting right way. When appium running the app will start at time but suddently it get crash.
Yes.Am using Xcode 6.0 and Appium 1.3.4
Make sure the .app file you are using is build for simulator if you are running appium for simulator and a different build i.e the build for device if you want to run it into real device....This is one of the cause which causes the instruments to crash at start up.
When I create an new project with XCode then generate the app file, it is working fine - I can open the inspector.
But I have a problem when I use an already developed application and the build is coming from a developer profile : I can't open the inspector and instruments crash on startup.
While running the script please start xcode and go in the settings of the mobile device and find developer options. Make sure UIAutomation is enabled there. If it is not then enable it and after it try to run the script again. Surely it will work.

Resources