Search code examples
angularjstestingprotractorkarma-jasminegulp-protractor

e2e testin with jasmine protractor "no specs found"


I'm new testing with protractor, but I cant run my tests. My protractor.config.js:

exports.config = {

  allScriptsTimeout: 99999,

  // The address of a running selenium server.
  seleniumAddress: 'http://localhost:4444/wd/hub',

  // Capabilities to be passed to the webdriver instance.
  capabilities: {
    browserName: 'chrome'
  },

  baseUrl: 'http://localhost:8080/',

  framework: 'jasmine',

  // Spec patterns are relative to the current working directly when
  // protractor is called.
  specs: ['.src/test/e2e/login.e2e.spec.js'],

  // Options to be passed to Jasmine-node.
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000,
    isVerbose: true,
    includeStackTrace: true
  }
};

and this is the test I'm trying to run:

'use strict';

    describe('my app', function() {

      beforeEach(function () {
        browser.get('index.html');
      });

      it('should automatically redirect to / when location hash is empty', function() {
        expect(browser.getLocationAbsUrl()).toMatch("/");
      });
    });

And this is the error I get:

I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[13:20:49] I/launcher - Running 1 instances of WebDriver
Started


No specs found
Finished in 0.001 seconds

[13:20:50] I/launcher - 0 instance(s) of WebDriver still running
[13:20:50] I/launcher - chrome #01 passed
[13:20:50] The following tasks did not complete: e2e
[13:20:50] Did you forget to signal async completion?

I'm running webdriver-manager and my app server. My jasmine version is: 2.5.2 and my protractor version is: 4.0.9

Any idea of what I'm doing wrong??

Thanks!!!


Solution

  • I realized what was my problem (thanks to the comments that helped me to realize). I was running my test with a gulp task I made:

    function e2e() {
      gulp.src(["/src/test/*.js"]).pipe(protractor({
        configFile: "conf/protractor.config.js",
        args: ['--baseUrl', 'http://localhost8080']
      })).on('error', function (e) {
        throw e;
      });
    }
    

    I dont know why this: gulp.src(["/src/test/*.js"])wasnt getting to acces to my test files, so I changed it for: gulp.src(["src/test/e2e/login.e2e.spec.js"])

    I know its not the best solution,but enough to survive...