ssharma
ssharma

Reputation: 941

not able to run protractor test from eclipse on chrome browser

not able to run protractor test from eclipse on chrome browser but if I change browser to firefox test runs fine.

      exports.config = {

allScriptsTimeout : 60000,

suites : {

    LoginTestSuite: 'e2e/TestSuites/Full/LoginTestSuite/*.js',
},    
 capabilities: { 'browserName': 'chrome' },
 directConnect : true,      
baseUrl : 'http://test:8080/',

framework : 'jasmine2',

jasmineNodeOpts : {
    defaultTimeoutInterval : 60000
},
onPrepare : function() {        
    var jasmineReporters = require('jasmine-reporters');
    browser.driver.manage().window().maximize();
    return browser.getProcessedConfig().then(function(config) {
        var browserName = config.capabilities.browserName;
        var junitReporter = new jasmineReporters.JUnitXmlReporter({
            consolidateAll : true,
            savePath : 'tests/test-results',
            filePrefix : browserName + '-xmloutput',
            modifySuiteName : function(generatedSuiteName, suite) {
                return browserName + '.' + generatedSuiteName;
            }
        });
        jasmine.getEnv().addReporter(junitReporter);

        var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');

        var today = new Date(),
        year = today.getFullYear(),
         month = today.getMonth() + 1,
         date = today.getDate(),      
         hh = today.getHours(),
         min = today.getMinutes(),
         timeStamp = year +''+ month+'' + date+'' + hh + min;

        var reporter = new HtmlScreenshotReporter({               
            cleanDestination: false,
            showSummary: true,
            showConfiguration: true,
            showQuickLinks: true,                
            reportTitle: "E2E Report--Test run on" + timeStamp,               
            dest : 'tests/test-results/screenshots',
            filename : 'my-report-'+ timeStamp + '.html',
            captureOnlyFailedSpecs : true,
            pathBuilder : function(currentSpec, suites, browserCapabilities) {

                return browserCapabilities.get('browserName')+'-' +timeStamp + '/' + currentSpec.fullName;
            }
        });
        jasmine.getEnv().addReporter(reporter);
    });
},
resultJsonOutputFile : 'tests/test-results/output.json'
};

I have tried updating protractor version to 4.0.11 and this uses chrome driver version : 2.25 if I run it from eclipse I get following error :

  E/launcher - session not created exception
  from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"8084.1","isDefault":true},"id":1,"name":"","origin":"://"}
  (Session info: chrome=54.0.2840.99)

If I run my test from command npm run e2e-full my test will run in chrome browser but running it from eclipse give error.

Also If I change browser type to firefox in config file and run it from eclipse test will run fine.

Not sure what could be the issue only running from eclipse in chrome browser gives this error.

Upvotes: 0

Views: 234

Answers (1)

doct03
doct03

Reputation: 317

I ran into similar issues when I updated my version of Google Chrome. I believe it's a bug in protractor.

I was able to fix this by reinstalling protractor and chrome driver. My respective versions:

Protractor: 4.0.9
Chromedriver: 2.24

Upvotes: 1

Related Questions