Angularjs E2E browser extender "not a feature"

I keep trying to run some E2E tests from ToT angular-seed master and keep getting the following error on startup ./scripts/e2e-test.sh:

TypeError: Property 'browser' of object #<Object> is not a function

I get this error when trying to run the following code snippet as one of my e2e scripts:

'use strict';

/* https://github.com/angular/protractor/blob/master/docs/getting-started.md */

describe('MyApp', function() {

  describe(Index', function() {
    beforeEach(function() {
      browser().navigateTo('/');
    });


    it('should render feature specific image', function() {
      expect(element('img.featurette-image').length).toBe('4');
    });
  });
});

I am wondering if your protractor configuration is incorrect:

exports.config = {
  allScriptsTimeout: 11000,

  specs: [
    '../test/e2e/*.js'
  ],

  capabilities: {
    'browserName': 'chrome'
  },

  baseUrl: 'http://localhost:3000/',

  framework: 'jasmine',

  jasmineNodeOpts: {
    defaultTimeoutInterval: 30000
  }
};

My unit tests work fine. This is Karma's configuration for them (note that this is an angular app in the public director of the sinatra app listening on the port 3000:

module.exports = function(config){
    config.set({
    basePath : '../',

    files : [
      'https://code.jquery.com/jquery-1.10.2.min.js',
      'app/lib/angular/angular.js',
      'app/lib/angular/angular-*.js',
      'test/lib/angular/angular-mocks.js',
      'app/js/**/*.js',
      'test/unit/**/*.js'
    ],

    exclude : [
      'app/lib/angular/angular-loader.js',
      'app/lib/angular/*.min.js',
      'app/lib/angular/angular-scenario.js'
    ],

    autoWatch : true,

    frameworks: ['jasmine'],

    browsers : ['Chrome'],

    plugins : [
            'karma-junit-reporter',
            'karma-chrome-launcher',
            'karma-firefox-launcher',
            'karma-jasmine'
            ],

    junitReporter : {
      outputFile: 'test_out/unit.xml',
      suite: 'unit'
    }

})}

Thanks for the help!

+3
source share
1 answer

You need to change this line:

browser().navigateTo('/');

to

browser.navigateTo('/');

What is it.

+5
source

All Articles