0

I am trying to run protractor test(ios-11, iPhoneX)in browserstack. I am getting "Error: Error while running testForAngular: Unable to communicate to node" error and some time I am getting the error as "Could not find Angular on page". In fact this is an angular application and I can run test on android and in all desktop browsers. my config file is below, when i used browser.ignoreSynchronization = 'true' before the browser.get() than the tests will pass on iOS 10.3. As I am testing the angular application and I don't want to use it. Can you please help on this.

     var browserstack = require('browserstack-local');

    exports.config = {

        seleniumAddress: 'http://hub-cloud.browserstack.com/wd/hub',

       'commonCapabilities': {
           'browserstack.local': true,
           'browserstack.user': '............',
           'browserstack.key': '.............'
       },
     multiCapabilities: [
           {

              'device': 'iPhone X',
               'realMobile': 'true',
               'os_version': '11.0',
                browserName: 'safari'
            },
       ],
    specs:['./myspec.js'],

         allScriptsTimeout: 60000,

        maxSessions: 1,

        jasmineNodeOpts: {
        defaultTimeoutInterval: 300000,
        showColors:             true,
        showTiming:             true,
        includeStackTrace:      true,
        isVerbose:              true,
        realtimeFailure:        true,
        print: function() {
        }
    },

    framework: 'jasmine2',

    rootElement: 'body',


       // Code to start browserstack local before start of test
    beforeLaunch: function() {
        console.log('Connecting local');
        return new Promise(function (resolve, reject) {
            exports.bs_local = new browserstack.Local();
            exports.bs_local.start({'key': exports.config.commonCapabilities['browserstack.key']}, function (error) {
                if (error) {
                    console.log(error.message);
                    return reject(error);
                }
                console.log('Connected. Now testing...');
                resolve();
            });
        });
    },

// Code to stop browserstack local after end of test
    afterLaunch: function() {
        return new Promise(function (resolve) {
            exports.bs_local.stop(resolve);
            console.log('Stopping...');
        });
    },
};

// Code to support common capabilities
exports.config.multiCapabilities.forEach(function(caps){
  for(var i in exports.config.commonCapabilities) caps[i] = caps[i] || exports.config.commonCapabilities[i];
});
  • This is an open issue with protractor: github.com/angular/protractor/issues/2840. You can use the workaround mentioned here: github.com/angular/protractor/issues/… "Safari 10.3 & 11.0 do not work with Protractor, however on Sierra macOS running Safari 11.0.1 does. Just turn off synchronization right before your first browser.get call and immediately turn it back on following that first call, then you're good to go." – BountyHunter Mar 21 '18 at 9:49
  • I’ll post my comment as answer, please mark it as accepted if it helped – BountyHunter Mar 23 '18 at 19:00
0

This is an open issue with protractor: github.com/angular/protractor/issues/2840. You can use the workaround mentioned here: github.com/angular/protractor/issues/… "Safari 10.3 & 11.0 do not work with Protractor, however on Sierra macOS running Safari 11.0.1 does. Just turn off synchronization right before your first browser.get call and immediately turn it back on following that first call, then you're good to go."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.