0

While I was doing the tutorial of AngularJS protractor testing from https://docs.angularjs.org/tutorial/step_02 , I get the error message as "no specs found", when I run the e2e test. This means the e2e test is not happening. I am new to protractor and I have come across similar questions in stack overflow but those did not really solve my problem.

I am not sure if I am missing any configuration or if I am issuing the command from the wrong directory. My question is how do I ensure that "no specs found" error does not happen?

I ran the command in /angular-phonecat/app directory as: npm run protractor

The folder structure of the project is as follows:

 angular-phonecat
     |_____app
          |_____app.js
          |_____app.spec.js
          |_____index.html
     |_____e2e-tests
           |_____protractor.conf.js

This is the content of app.spec.js:

'use strict';

describe('PhoneListController', function() {

  beforeEach(module('phonecatApp'));

  it('should create a `phones` model with 3 phones', inject(function($controller) {
    var scope = {};
    var ctrl = $controller('PhoneListController', {$scope: scope});

    expect(scope.phones.length).toBe(3);
  }));

});

Protractor.conf.js is as follows:

//jshint strict: false
exports.config = {

  allScriptsTimeout: 11000,

  specs: [
    '*.js'
  ],

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

  baseUrl: 'http://localhost:8000/',

  framework: 'jasmine',

  jasmineNodeOpts: {
    defaultTimeoutInterval: 30000
  }

};
rupali317
  • 472
  • 1
  • 9
  • 22

1 Answers1

3

End-to-end (e2e) tests, which are run with Protractor, are only intorduced on step 5. So, trying to run the tests in earlier step, will result in "no specs found" errors (as expected).

You might be confused by the unit tests, which are introduced in earlier steps. These are different kinds of tests and are run with a different test runner (i.e. Karma, not Protractor).

gkalpak
  • 47,844
  • 8
  • 105
  • 118