Appium tests / setup

Hi all,
I want to run appium tests for UI testing. This framework requires to run an appium server on the same machine to run the tests. How can I do that with bitrise?

1 Like

Hi @alexander.savonin,

The same way you would run it in your Terminal / Command Line. You can use a Script step to install and use any tool if there’s something you can’t find a ready made build step for.

Related docs: http://devcenter.bitrise.io/tips-and-tricks/install-additional-tools/

If you have any questions just let us know! :wink:

Thank you! I’ll try it.

1 Like

SOLUTION: Create a script step with the following code

#!/bin/bash
set -ex
npm install -g appium
appium &>/dev/null &

It will launch an appium server in the background and hide an output.
Maybe it will be helpful for someone.

1 Like

It definitely will! Thank you @alexander.savonin! :blush:

I would like more information as where I would put my java classes, as I currently run through intellij. Also, how would I be able to get the results and affect my bitrise build, so if the tests fails, the build will fail also.

Just follow the official Appium docs (http://appium.io/getting-started.html?lang=en). As mentioned above:


I’d suggest you to use the Deploy to Bitrise.io step for that: Build artifacts online - Bitrise Docs


Make sure your command/script returns a non zero exit code and the Bitrise CLI will mark the step as failed. If you use a Script step this is as simple as starting the Script with:

#!/bin/bash
set -ex

This will print the commands before execution for debugging (-x flag) and the script/bash will return a non zero exit code if any command after the set -ex line fails (-e flag).

If you have any questions just let us know! :slight_smile:

One more thing @plin, I’d suggest you to check these guides so that you can run the configuration locally on your Mac/Linux:

and debug it if needed:

Thanks for the information viktor, I have gone very far with the resources you gave me. Everything works locally, the only thing that doesn’t work is when I run my maven tests and try to connect to the appium server opened through “#!/bin/bash
set -ex
npm install -g appium
appium &>/dev/null &” . It doesn’t seem like I can connect, even though I have the correct address. I verfied by starting an appium server without muting the logs to see the address created. Which is 0.0.0.0:4723.

Any ideas this is happening? Also any people with working appium on their apps can help me?

@plin can you share a bit more details? The best would be if you could share the link/url of the build, feel free to do that through the onsite chat on bitrise.io, so that we can check the logs of the build & the related build config.

Did you run it with the Bitrise CLI?

Hi,

This script does not work for me and gives this error.

(node:2981) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: EACCES: permission denied, mkdir ‘/usr/lib/node_modules/appium/node_modules/appium-chromedriver/2017730-2981-1xiwuq4.ocj0g’
(node:2981) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
info Chromedriver Install Installing Chromedriver version ‘2.28’ for platform ‘linux’ and architecture '64’
info Chromedriver Install Opening temp file to write chromedriver_linux64 to…
Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/appium/node_modules/appium-chromedriver/2017730-2981-1450uny.5xwn’
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/appium/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! appium-chromedriver@2.11.2 install: node install-npm.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the appium-chromedriver@2.11.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

@ankitpachouri0891 this seems to be a config issue. Can you please create a #issues:build-issues report, with the full log or a link to the build’s bitrise.io page?

Has same problem with @ankitpachouri0891

Just to connect the discussions, the report & fix can be found here:

Thanks @han.tran! :slight_smile:

1 Like

@ankitpachouri0891 did you manage to solve the issue? If not, can you check this report and fix: Cannot install appium on Android, Ubuntu stack ?

@viktorbenei Will try this and update you soon.

1 Like

@viktorbenei Buddy, its done. Thanks alot for the support. Now, I will be writing my test cases and want those to be used to push the build via bitrise. Will surely get back to you, if I stuck somewhere. :wink:

@han.tran Thanks a ton man! And thank you so much for your efforts :slight_smile:

1 Like

Glad to hear @ankitpachouri0891! :tada: :slight_smile:

Glad to help @ankitpachouri0891 took me a day :slight_smile: By the way, I’m stuck with the android emulator, sometimes when installing the apk, it’s taking forever. @viktorbenei should I open a ticket?

@han.tran yes, please do create a new one, but unfortunately in lots of cases the answer is to use

as the standard emulators are quite buggy…