rolandc
rolandc

Reputation: 31

How to install / upgrade Appium 1.6.3 / 1.6.x with Appium Version Manager

Appium 1.4.16 or any 1.4.x version works fine. We used Appium Version Manager (avm) to upgrade to new versions, but with 1.5.x onwards does not seem to be working.

I am currently on Appium 1.4.16 and would want to upgrade to Appium 1.6.3 (current latest). Can we do that?

Note - the reason we need avm is to switch between appium versions, which i feel is good to have. Helps us specially when we are in the process of upgrading our suite to cater the changes in 1.6.x, so that until we finish, we can still use an older (stable) version

Upvotes: 0

Views: 7131

Answers (2)

rolandc
rolandc

Reputation: 31

Phew... after some searching, testing and playing around, found a way.

When Appium releases a newer version or a beta, I feel its an advantage to keep an older (stable) version and switch between Appium versions. Because in my experience, a newer Appium version could break some existing automation tests, so until we fix them separately, having an older version helps in executing those tests without errors.

Plus switching versions without every time needing to install / uninstall is advantageous while testing out a beta.

AVM was (rather is) a great utility that allows this switching between versions, but somehow it had stopped working after Appium1.5.0. So here are the steps to use AVM to install Appium after version 1.5.0 and keep switching between as many instances of Appium.

At the moment, Appium1.6.4 is the official release, so I'll highlight the steps with that version.

(Also, I use a Mac but think installing it on Windows should be similar).

Steps to Install Appium with AVM:

Part A) Install AVM --> (first time only to get AVM)

Pre requisite --> install 'brew' and 'node'.

  1. Launch terminal
  2. npm install -g appium-version-manager
  3. brew update note: if step 2 did not execute, then perform steps 3 and 4.
  4. (optional) sudo chown -R $(whoami):admin /usr/local
  5. (optional) cd $(brew --prefix) && git fetch origin && git reset --hard origin/master
  6. avm --help

If it shows list of commands, then congrats, avm is installed !!!

Now since AVM is not maintained since Appium1.5.0, we need to install a version < 1.5.0. Let us do with 1.4.16

Part B) Install Appium 1.4.16 (or any old version) --> (one time only)

  1. avm 1.4.16
  2. In Finder --> Go to Folder /usr/local/bin/ --> Open filename ‘avm’ in an editor
  3. Search for method 'activate ()' and comment this line

ln -s $dir/node_modules/appium/bin/appium.js $AVM_PREFIX/bin/appium

replace with

ln -s $dir/node_modules/appium/build/lib/main.js $AVM_PREFIX/bin/appium

sample screenshot to edit 'activate ()' method

  1. Similarly, Search for method 'execute_with_version ()' and comment this line

local bin=$VERSIONS_DIR/$version/node_modules/appium/bin/appium.js

replace with

local bin=$VERSIONS_DIR/$version/node_modules/appium/build/lib/main.js

note - i'll post a reference link that mentioned about this change being made to 'avm' file.

  1. brew unlink node
  2. brew install node6-lts (node version - v6.9.4)

and this is our final act !!! :)

Part C) Install Appium version 1.6.x (or any version above 1.5.0)

  1. avm 1.6.x (x = minor version of appium. To install Appium version 1.6.4, in terminal type --> avm 1.6.4)
  2. cd /usr/local/avm/versions/1.6.x/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
  3. npm install -g ios-deploy if step 3 does not install ios-deply try step 4.
  4. (optional) sudo npm install --global --unsafe-perm=true ios-deploy
  5. brew install carthage
  6. ./Scripts/bootstrap.sh
  7. ./Scripts/build.sh -d
  8. Launch Xcode. For Appium1.6.4, I used Xcode8.3.1
  9. In Finder, navigate to path in step 2. Open WebDriverAgent Project in Xcode.
  10. Sign profiles. I select the WebDriverAgent project and click on the 'Automatically manage signing'. Then select the team profiles for WebDriverAgentLib and WebDriverAgentRunner.
  11. Build the WebDriverAgent Project and Run. If it Succeeds, then welcome aboard Appium1.6.x via AVM.

More information on singing profiles for WDA in a nice detail manner here --> https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md note - while executing tests on real devices, if you get an Error 65, means the WebDriverAgent has not been signed properly.

Once installed, for any Future versions of Appium, only Part C is required, no need of Part A and Part B if you've got avm

  • credit to the creator of Appium-Version-Manager - abhinavsingh. ( couldn't post the link as I do not have a reputation > 10 yet)

Upvotes: 2

Vinod
Vinod

Reputation: 976

Below is the command to install and upgrade specific version of appium.

Installation : SYNTAX : npm install -g appium@versionNumber

e.g. : npm install -g [email protected]

Upgrade : SYNTAX : npm update -g appium@versionNumber

e.g. : npm update -g [email protected]

Upvotes: 0

Related Questions