Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor - Unable to run protractor tests

My tests are throwing the following error. It used to run fine before. Please advise.

My Config file:

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  allScriptsTimeout: 20000,
  baseUrl: 'https://mylink/#/',

   // frameworks to use
    frameworks: ['jasmine'],

// Capabilities to be passed to the webdriver instance.

  multiCapabilities: [{
    'browserName': 'chrome'
 //}, {
   // 'browserName': 'firefox'
    //
   }],

 // Spec patterns are relative to the current working directory.
  specs: [
    'tests/HomePage.js'
  ],


  onPrepare: function() {
    browser.driver.manage().window().maximize();
    require('jasmine-reporters');
    jasmine.getEnv().addReporter(
      new jasmine.JUnitXmlReporter('xmloutput', true. true));
  },

  jasmineNodeOpts: {
    showColors: true
  }

}

My Spec file:

// spec.js
describe('MyTest homepage', function() {
   var ptor;
   require('protractor-linkuisref-locator')(protractor);

  beforeEach(function() {
    browser.ignoreSynchronization = true;
    ptor = protractor.getInstance();
    browser.rootEl = 'div';
    //browser.driver.manage().window().setSize(1280, 1024);
    browser.debugger();
  });


  it('Should enter homepage url and credentials', function() {
     browser.get('/#/');
     element(by.name('userName')).sendKeys('');
     element(by.name('password')).sendKeys('');
     element(by.xpath("//button[@class=' btn orange small wide']")).click();
  });

  it('Should the title contain', function() {
    expect(browser.getTitle()).toEqual('');

  });

  it('Should click on the PowerGuide', function() {
     element(by.linkUiSref('locator')).click();
     ptor.sleep(100); 
     //expect(ptor.getCurrentUrl(locator)).toEqual('');
    });

   it('Should click on Month', function() {
     element(by.id('month-tab')).click();
     ptor.sleep(100);

    });


   //it('Should load the images', function() {
   // element(by.css('.pure-u-1-2')).click();
    //var icons = element.all(by.css('.pure-u-1-2')).click();
    //icons.first().click();
   //});


});

This is the error I am getting.

        seleniumProcess.pid: 1380
14:43:45.163 INFO - Launching a standalone server
Setting system property webdriver.chrome.driver to C:\Users\sramamoorthy\AppData\Roaming\npm\node_modules\protractor\sel
enium\chromedriver.exe
14:43:45.342 INFO - Java: Oracle Corporation 25.40-b25
14:43:45.342 INFO - OS: Windows 7 6.1 amd64
14:43:45.373 INFO - v2.45.0, with Core v2.45.0. Built from revision 5017cb8
14:43:45.597 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
14:43:45.597 INFO - Version Jetty/5.1.x
14:43:45.597 INFO - Started HttpContext[/selenium-server,/selenium-server]
14:43:45.779 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@23223dd8
14:43:45.781 INFO - Started HttpContext[/wd,/wd]
14:43:45.781 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
14:43:45.781 INFO - Started HttpContext[/,/]
14:43:45.789 INFO - Started SocketListener on 0.0.0.0:4444
14:43:45.789 INFO - Started org.openqa.jetty.jetty.Server@133314b
14:44:41.384 INFO - Executing: [new session: Capabilities [{count=1, browserName=chrome}]])
14:44:41.399 INFO - Creating a new session for Capabilities [{count=1, browserName=chrome}]
Starting ChromeDriver 2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf) on port 44385
Only local connections are allowed.
14:44:43.309 INFO - Done: [new session: Capabilities [{count=1, browserName=chrome}]]
14:44:43.567 INFO - Executing: [set script timeoutt: 20000])
14:44:43.584 INFO - Executing: [delete session: 64c8dac4-559f-416d-b77b-78c5184b6538])
14:44:43.590 INFO - Done: [set script timeoutt: 20000]
14:44:45.303 INFO - Done: [delete session: 64c8dac4-559f-416d-b77b-78c5184b6538]

Test Error: This is the error I am getting where i am calling the Conf.js file from

Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
[launcher] Error: TypeError: undefined is not a function
    at
  at Object.exports.run (C:\Users\AppData\Roaming\npm\node_modules\protractor\lib\frameworks\jasmine.js:6
2:17)
    at C:\Users\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:326:35
    at _fulfilled (C:\Users\sr\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:797:54)
    at self.promiseDispatch.done (C:\Users\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:
826:30)
    at Promise.promise.promiseDispatch (C:\Users\ppData\Roaming\npm\node_modules\protractor\node_modules\q
\q.js:759:13)
[launcher] Process exited with error code 100
like image 687
user2744620 Avatar asked May 12 '15 21:05

user2744620


1 Answers

There is a typo inside onPrepare():

onPrepare: function() {
    browser.driver.manage().window().maximize();
    require('jasmine-reporters');
    jasmine.getEnv().addReporter(
      new jasmine.JUnitXmlReporter('xmloutput', true. true));
    //                                          HERE^
},

You meant instead:

jasmine.getEnv().addReporter(
    new jasmine.JUnitXmlReporter('xmloutput', true, true));
like image 139
alecxe Avatar answered Oct 17 '22 05:10

alecxe