NativeScript / nativescript-dev-appium

A package to help with writing and executing e2e Appium tests in NativeScript apps
Apache License 2.0
70 stars 27 forks source link

Difficulty installing #218

Closed kenny-evitt closed 5 years ago

kenny-evitt commented 5 years ago

I've got a vanilla JavaScript NativeScript (NativeScript core) app.

Version numbers:

$ tns --version
5.2.0
$ tns info
✔ Getting NativeScript components versions information...
⚠ Update available for component nativescript. Your current version is 5.2.0 and the latest available version is 5.3.4.
⚠ Update available for component tns-core-modules. Your current version is 5.1.2 and the latest available version is 5.3.2.
⚠ Update available for component tns-android. Your current version is 5.1.0 and the latest available version is 5.3.1.
⚠ Update available for component tns-ios. Your current version is 5.1.0 and the latest available version is 5.3.1.

Contents of package.json:

{
  "nativescript": {
    "id": "ly.partial.PartiallyPos",
    "tns-android": {
      "version": "5.1.0"
    },
    "tns-ios": {
      "version": "5.1.0"
    }
  },
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "dependencies": {
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.23",
    "nativescript-drawingpad": "^3.0.4",
    "nativescript-geolocation": "^4.5.0",
    "nativescript-iqkeyboardmanager": "^1.4.0",
    "nativescript-numeric-keyboard": "^4.2.1",
    "nativescript-ui-sidedrawer": "^5.1.0",
    "tns-core-modules": "~5.1.0"
  },
  "devDependencies": {
    "@types/jasmine": "~3.3.4",
    "@types/node": "~10.12.18",
    "appium": "^1.13.0",
    "ios-deploy": "^1.9.4",
    "jasmine": "~3.3.1",
    "jasmine-core": "~3.3.0",
    "jasmine-spec-reporter": "~4.2.1",
    "nativescript-dev-appium": "^5.2.0",
    "nativescript-dev-webpack": "~0.19.0"
  },
  "readme": "NativeScript Application",
  "scripts": {
    "e2e": "node ./node_modules/nativescript-dev-appium/check-dev-deps.js &&  jasmine --config=./e2e/config/jasmine.json "
  }
}

I (mostly) followed the instructions in the project's current README. The only difference is that I installed the Appium and ios-deploy npm packages as dev dependencies instead of globally.

I wasn't able to install libimobiledevice via Homebrew on my first attempt:

$ brew install libimobiledevice --HEAD
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
pipx
==> Updated Formulae
allureofthestars    awscli              camlp4              libmatroska         mariadb@10.1        mkvtoolnix          mu                  nexus               php@7.1             tor                 unp64               velero              yara
==> Deleted Formulae
imapsync

Warning: Your Xcode (10.1) is outdated.
Please update to Xcode 10.2 (or delete it).
Xcode can be updated from the App Store.

Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences.

==> Cloning https://git.libimobiledevice.org/libimobiledevice.git
Updating /Users/kenny/Library/Caches/Homebrew/libimobiledevice--git
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
HEAD is now at eea4f1b Updated ac_python_devel.m4 to newer ax_python_devel.m4
==> ./autogen.sh
Last 15 lines from /Users/kenny/Library/Logs/Homebrew/libimobiledevice/01.autogen.sh:
checking dynamic linker characteristics... darwin18.2.0 dyld
checking how to hardcode library paths into programs... immediate
checking for pkg-config... /usr/local/opt/pkg-config/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for libusbmuxd >= 1.1.0... no
configure: error: Package requirements (libusbmuxd >= 1.1.0) were not met:

Requested 'libusbmuxd >= 1.1.0' but version of libusbmuxd is 1.0.10

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables libusbmuxd_CFLAGS
and libusbmuxd_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

READ THIS: https://docs.brew.sh/Troubleshooting

Error: Your Xcode (10.1) is outdated.
Please update to Xcode 10.2 (or delete it).
Xcode can be updated from the App Store.

Error: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences.

I ended up updating macOS, Xcode, and Command Line Tools, and installing the 'HEAD' version of the usbmuxd Homebrew package. Then I was seemingly able to finish installing all of the dependencies listed in the README.

I created a GitHub Gist of my complete notes:

SvetoslavTsenov commented 5 years ago

Hey @kenny-evitt, this is related to Jasmin and parsing arguments. Please use '=' instead white space. npm run e2e -- --runType=sim.iPhone7

kenny-evitt commented 5 years ago

@SvetoslavTsenov Thanks! Any thoughts on the problem I ran into installing libimobiledevice via Homebrew?

SvetoslavTsenov commented 5 years ago

It seem that you have some local issues and conflict with older versions. Not sure though. This is script that we use on our CI to install Appium. Just copy it in a file and give it a try.

`#!/bin/bash

source $HOME/.bash_profile APPIUM_VERSION="1.9.1"

hack to handle Xcode 10

if [[ $(xcodebuild -version) =~ "9." ]]; then APPIUM_VERSION="1.8.1" fi

install_ios_deps() { echo "Install Appium dependencies for iOS." { brew update brew uninstall --ignore-dependencies libimobiledevice && true brew uninstall --ignore-dependencies usbmuxd && true brew install --HEAD usbmuxd brew unlink usbmuxd && true brew link usbmuxd && true brew install --HEAD libimobiledevice brew uninstall --ignore-dependencies ideviceinstaller && true brew install ideviceinstaller --HEAD brew unlink ideviceinstaller && true brew link ideviceinstaller && true brew uninstall --ignore-dependencies ios-webkit-debug-proxy && true brew install ios-webkit-debug-proxy brew uninstall --ignore-dependencies carthage && true brew install carthage

    carthage help | grep bootstrap

    set +e
    $(carthage help | grep bootstrap &> /dev/null)
    EXIT_CODE=$?
    set -e
    if [ $EXIT_CODE == 0 ]; then
        echo "Carthage installed."
    else
        echo "Failed to carthage!"
        exit 1
    fi
} &> "$HOME/logs/install-appium.log"

}

install_appium() { echo "Install Appium." { npm un -g appium -f || true npm i -g appium@$APPIUM_VERSION if [[ "$OSTYPE" == "darwin"* ]]; then cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent sh Scripts/bootstrap.sh -d || true cd - fi appium -v } &> "$HOME/logs/install-appium.log" }

set +e $(appium -v | grep $APPIUM_VERSION &> /dev/null) EXIT_CODE=$? set -e if [ $EXIT_CODE == 0 ]; then echo "Appium@$APPIUM_VERSION found." else if [[ "$OSTYPE" == "darwin"* ]]; then install_ios_deps fi install_appium fi`

kenny-evitt commented 5 years ago

@SvetoslavTsenov Thanks! Your install script has some of the same commands I ended-up running. Maybe the project README should be updated?

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.