1

I'm trying to test an app using Appium and Genymotion (android emulator).

Here's my spec.js file for protractor:

"use strict";

var wd = require('wd');
console.log(wd.Q);
var wdBridgeModule = require('wd-bridge');
var protractor = require('protractor');
var wdBridge = wdBridgeModule(protractor, wd);

exports.config = {
    specs: ['tests/e2e/e2e.js'],
    framework: 'jasmine',
    capabilities: {
        'platformName': 'Android',
        'platformVersion': '6.0',
        'deviceName': 'Android Device',
        'autoWebView': true,
        'autoWebviewTimeout': 10000,
        'app': "C:/src/app-v5/platforms/android/build/outputs/apk/android-x86-debug.apk",
        'fullReset': true,
        'browserName': ''
    },

    onPrepare: function () {
        var SpecReporter = require('jasmine-spec-reporter');
        //jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));
        jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: ''}));
        wdBridge.initFromProtractor(exports.config);
    },
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 30000,
        print: function (){}
    },
    seleniumAddress: 'http://localhost:4723/wd/hub'
};

I start webdriver with webdriver-manager start, then, on a different terminal window, i run appium & and in another terminal window i launch protractor spec file.

webdriver doesn't have any error

Appium & terminates with the following log:

[debug] [Logcat] Stopping logcat capture
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"shutdown"}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"shutdown"}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type SHUTDOWN
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Closed client connection
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: numtests=1
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=.
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: current=1
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: 0
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=
[debug] [AndroidBootstrap] [UIAUTO STDOUT] Test results for WatcherResultPrinter=.
[debug] [AndroidBootstrap] [UIAUTO STDOUT] Time: 2.365
[debug] [AndroidBootstrap] [UIAUTO STDOUT] OK (1 test)
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: -1
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [UiAutomator] Shutting down UiAutomator
[debug] [UiAutomator] Moving to state 'stopping'
[debug] [UiAutomator] UiAutomator shut down normally
[debug] [UiAutomator] Moving to state 'stopped'
[debug] [ADB] Attempting to kill all uiautomator processes
[debug] [ADB] Getting all processes with uiautomator
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running C:\Android\adk\sdk\platform-tools\adb.exe with args: ["-P",5037,"-s","192.168.56.102:5555","shell","ps","uiautomator"]
[ADB] No uiautomator process found to kill, continuing...
[debug] [UiAutomator] Moving to state 'stopped'
[Appium] Removing session d772ce79-f1c5-4fbe-b073-d4a4ae602570 from our master session list
[debug] [MJSONWP] Received response: null
[debug] [MJSONWP] But deleting session, so not returning
[MJSONWP] Responding to client with driver.deleteSession() result: null
[HTTP] <-- DELETE /wd/hub/session/d772ce79-f1c5-4fbe-b073-d4a4ae602570 200 1687 ms - 76

And protractor spec file with the following:

[15:22:46] I/hosted - Using the selenium server at http://localhost:4723/wd/hub
[15:22:46] I/launcher - Running 1 instances of WebDriver
[15:22:54] E/runner - Unable to start a WebDriver session.
[15:22:56] E/launcher - Error: WebDriverError: Method has not yet been implemented
    at WebDriverError (C:\Users\Administrator\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\error.js:26:26)
    at Object.checkLegacyResponse (C:\Users\Administrator\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\error.js:580:13)
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:360:15
    at Promise.invokeCallback_ (C:\Users\Administrator\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1329:14)
    at TaskQueue.execute_ (C:\Users\Administrator\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2790:14)
    at TaskQueue.executeNext_ (C:\Users\Administrator\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2773:21)
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2652:27
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:639:7
    at process._tickCallback (node.js:406:9)
[15:22:56] E/launcher - Process exited with error code 100

what is wrong with my setup?

Appium: 1.5.2

Node: 5.8.0

npm: 3.7.3

Thanks for any help and advice

EDIT

It is now working. I change my protractor config file like following:

exports.config = {
    seleniumAddress: 'http://localhost:4723/wd/hub',
    specs: ['tests/e2e/e2e.js'],
    //framework: 'jasmine',
    capabilities: {
        'platformName': 'android',
        'platformVersion': '6.0',
        'deviceName': 'android emulator',
        //'autoWebView': true,
        //'autoWebviewTimeout': 10000,
        //'app': "C:/src/app/platforms/android/build/outputs/apk/android-x86-debug.apk",
        //'fullReset': true,
        'appium-version': '1.5.2',
        'browserName': 'chrome',
        "nativeInstrumentsLib":true
    },

    baseUrl: 'http://localhost:8100',

    onPrepare: function () {
        //var SpecReporter = require('jasmine-spec-reporter');
        //jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));
        //jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: ''}));
        var wd = require('wd'),
            protractor = require('protractor'),
            wdBridge = require('wd-bridge')(protractor, wd);
        wdBridge.initFromProtractor(exports.config);
    }
    //jasmineNodeOpts: {
    //    showColors: true,
    //    defaultTimeoutInterval: 30000,
    //    print: function () {
    //    }
    //},

};

updated everything and now it works fine on my machine

Nick
  • 13,493
  • 8
  • 51
  • 98

0 Answers0