unable to run scripts from jenkins - 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:
SikuliScript.sh
/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 run from Jenkins I am getting the following error:
[JavaAppLauncher Error] CFBundleCopyResourceURL() failed loading MRJApp.properties file
[DEBUG] Could not start simulator session: Error Domain=DTiPhoneSimulatorErrorDomain Code=5 "Operation failed with underlying error 4294956486." UserInfo=0x100305c70 {NSLocalizedDescription=Operation failed with underlying error 4294956486., NSUnderlyingError=0x100300610 "The operation couldn’t be completed. (OSStatus error -10810.)"}
[LaunchRunner Error] No main class specified
[JavaAppLauncher Error] CallStaticVoidMethod() threw an exception
Exception in thread "main" java.lang.NullPointerException
at apple.launcher.LaunchRunner.run(LaunchRunner.java:113)
at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:51)
at apple.launcher.JavaApplicationLauncher.main(JavaApplicationLauncher.java:61)
Any suggestions will be very helpful

It definitely looks like a permission issue. The official Jenkins installer for Mac sets up Jenkins to run either as user "daemon" or user "jenkins". You need to make tools needed by Jenkins readable and executable by that user. Also, they need to be in a directory which is readable and executable by that user.
However, even if you get the permissions fixed, you will probably have further problems with your test run. The official Jenkins installer for Mac sets up Jenkins to run as a launch daemon. These run in the system context and they have no access to any desktop or GUI session, which means it is not possible to draw windows on the screen => Any tool that displays windows, like iPhone Simulator or Sikuli is going to fail.
You could try my unofficial Jenkins.app instead, which should solve your problem. It is available at https://github.com/stisti/jenkins-app (download it under the Downloads tab.)

Related

Trying to run a Robot Framework Test Case against a Windows app with Appium Server - possible?

I am using Robot Framework with the RIDE IDE. I have an Appium Server session running. As a first try, I want to write a Robot Framework test case to open an instance of the Windows notepad. Firstly, is this even possible, or am I misguided?
Appium
The following are the settings used:
Remote Host: 127.0.0.1
Remote Port: 4723
Remote Path: /
SSL: disabled
The "Desired Capabilities" are set as represented by the following JSON:
{
"app": "C:\\Windows\\system32\\notepad.exe"
}
WinAppDriver
It is running on port 4723.
RIDE IDE
The following test case is being executed:
*** Settings ***
Library AppiumLibrary
*** Test Cases ***
TC0
Open Application http://localhost:4723/wd/hub app=C:\Windows\System32\notepad.exe
This yields the following error:
[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: No application is open
What might be the cause of this?
Edit: Additional information - when executing the above test case, the following appears in the WinAppDriver console:
Per default AppiumLibrary will run Capture Page Screenshot on failure.
AppiumLibrary Documentation
Most likely sequence is as follow.
Test case try open notepad but fail.
Open Application http://localhost:4723/wd/hub app=C:\Windows\System32\notepad.exe
On this failure AppiumLibrary try Capture Page Screenshot but fails due to there is no open application since step 1 failed.
I believe you need to focus on troubleshooting why the app do not open properly.
If you like to suppress this failure you can you can set AppiumLibrary to not capture screen on failure in the import with run_on_failure=No Operation, see the linked documentation above.
Library AppiumLibrary run_on_failure=No Operation
Slightly unrelated but I just wanted to give a few tips with using winappdriver and robotframework as there isn't a lot of concise information out there.
I personally have found that running the winappdriver through appium has been slower than running the winappdriver standalone.
localhost is also slower than using 127.0.0.1 as your system has to resolve that address each time: https://github.com/microsoft/WinAppDriver/issues/1269
AppiumLibrary is still very tailored to Mobile automation so it is missing some of the usual things you would want in desktop automation such as 'drag and drop', 'mouse over element', keywords for controlling the driver setup/teardown, etc. RobotFramework-Zoomba's DesktopLibrary extends AppiumLibrary and adds a lot of these keywords if you would be willing to try that out. Keyword docs can be found here: https://accruent.github.io/robotframework-zoomba/DesktopLibraryDocumentation.html

How to update to UiAutomator2?

I have some Robot Framework tests for Android device which I'm running. I'm currently using Windows10 computer to develop those tests.
I just installed version v1.15.0-1 of Appium. By default this new Appium is using UIAutomator2. Not anymore UIAutomator1. My problem is, that I have installed UIAutomator2, but Appium not seem to find that. Only way I can run my tests is to use UIAutomator1.
I have installed UIAutomator2 driver:
npm -g install appium-uiautomator2-driver
Not working:
Open Application ${REMOTE_URL} platformName=${PLATFORM_NAME} platformVersion=${PLATFORM_VERSION} deviceName=${DEVICE_NAME} appPackage=${${ENV}_APP_PACKAGE} automationName=UiAutomator2 app=${${ENV}_APP} appActivity=com.dummyfi.viestit.ui.splash.SplashActivity noReset=True
Working:
Open Application ${REMOTE_URL} platformName=${PLATFORM_NAME} platformVersion=${PLATFORM_VERSION} deviceName=${DEVICE_NAME} appPackage=${${ENV}_APP_PACKAGE} automationName=UiAutomator1 app=${${ENV}_APP} appActivity=com.dummyfi.viestit.ui.splash.SplashActivity noReset=True
This is what I get, when I'm trying to run tests with UIAutomator2:
Suite setup failed:
WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: The application at 'fi.dummy.viestit.sa' does not exist or is not accessible
With UIAutomator1, everything is working fine.

Azure Pipelines | App Center test | error when including category

I'm running a job (series of tasks including nuget restore, build & signing application) on Azure DevOps to build android application and Test (Xamarin.UITest) application through Appcenter.
Test runs fine, if I don't specify any arguments on "Additional options for run" on "Test with Visual Studio App Center" task. When I do that (--include-category LandingPage) task throws error saying:
Error: Command 'test run manifest --manifest-path d:\a\12\a\AppCenterTest\manifest.json --app-path d:/a/12/b/Release/PUBLISH_PACKAGE_NAME_PHONE_ANDROID.PUBLISH_PACKAGE_NAME_PHONE_ANDROID.apk --app SampleApp/Android --devices 12345abcd --test-series DevOps --locale en_US --include-category LandingPage --quiet --token ***' failed with exception "Unknown argument --include-category"
What I'm missing?
[command works perfectly when I run appcenter test run from my local machine.]
Any help is appreciated.
For people facing this issue, make sure you're providing your --include-category AppCenterTest under Prepare Tests area not under Run tests. Additional Options under Run Tests have different purpose it seems.
failed with exception "Unknown argument --include-category
In fact, the error message has been clear to express the caused reason. For this App Center Test task in Azure Devops, this command argument --include-category does not supportted.
Please Refer to the open source of about this task: azure-pipelines-tasks/Tasks/AppCenterTestV1. You can check its logic and which arguments are supported by this task.
After you open the source file in github, go function getTestRunner and you will see that for test runner, the arguments it defined and supported to compile in this task does not include --include-category. That's why you receive the Unknown argument error.

unable to publish mvc6 app due to invokepowershell failure in vs2015

I am having some serious grief trying to publish my mvc6 application due to a powershell file blockage. I ran powershell as an administrator and adjusted the execution policy. But it doesnt seem to have any impact on the publishing process in vs2015. Further to that i even tried in vain to run the Unblock-File cmdlet in the NPM.
Anyone have any ideas about how I can get this to work? the full error is below:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(386,5): Error MSB4018: The "InvokePowerShell" task failed unexpectedly.
System.Management.Automation.PSSecurityException: AuthorizationManager check failed. ---> System.Management.Automation.Host.HostException: A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning message. Do you want to run G:\_PIPELINE_MANAGEMENT\_SOURCE\_MANAGEMENT\_2016\ProjMgr\src\ProjMgr\Properties\PublishProfiles\ProjMgr-publish.ps1?
at System.Management.Automation.Internal.Host.InternalHostUserInterface.ThrowPromptNotInteractive(String promptMessage)
at System.Management.Automation.Internal.Host.InternalHostUserInterface.PromptForChoice(String caption, String message, Collection`1 choices, Int32 defaultChoice)
at Microsoft.PowerShell.PSAuthorizationManager.RemoteFilePrompt(String path, PSHost host)
at Microsoft.PowerShell.PSAuthorizationManager.CheckPolicy(ExternalScriptInfo script, PSHost host, Exception& reason)
at Microsoft.PowerShell.PSAuthorizationManager.ShouldRun(CommandInfo commandInfo, CommandOrigin origin, PSHost host, Exception& reason)
at System.Management.Automation.AuthorizationManager.ShouldRunInternal(CommandInfo commandInfo, CommandOrigin origin, PSHost host)
--- End of inner exception stack trace ---
at System.Management.Automation.Runspaces.AsyncResult.EndInvoke()
at System.Management.Automation.PowerShell.EndInvoke(IAsyncResult asyncResult)
at Microsoft.Web.Publishing.Tasks.InvokePowerShell.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
Done executing task "InvokePowerShell" -- FAILED.
Done building target "PowerShellPublish" in project "ProjMgr.xproj" -- FAILED.
Done building project "ProjMgr.xproj" -- FAILED.
Done executing task "MSBuild" -- FAILED.
Done building target "FileSystemPublish" in project "ProjMgr.xproj" -- FAILED.
Done building project "ProjMgr.xproj" -- FAILED.
2>Publish failed due to build errors. Check the error list for more details.
Create another publish profile and try again.
For me this works.
I managed to get it to publish by copying my entire project folder to the root of my local. Must be a folder permissions issue somewhere...

Msbuild error: failed to start monitoring file changes

when i run Msbuild web.csproj i get the following error:
AfterBuild target> -> C:..\web\obj\debug\csautoparameterize\original\web.config
: error ASPconfig: an error occurred
loading a configuration file:
Directory C:..\web\obj\debug\csautoparameterize\original\Configs'
does not exist. Fail to start
monitoring file changes.
if i open visual studio (2010)..clean solution and rebuild, its fine. if i try to do publish via visual studio, this error returns and i cant build again (until i clean solution).
any ideas?
thanks
Is that a network drive? I was getting a similar error when I had my SVN working copy on a network drive, apparently the folder monitoring service for the test server completely freaks out when it's not a physical drive.

Resources