2016-10-20 29 views
1

我是新的量角器测试,但我不能运行我的测试。 我protractor.config.js:e2e testin与茉莉量角器“没有规格找到”

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 
    } 
}; 

,这是我试图运行测试:

'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("/"); 
     }); 
    }); 

这是错误我得到:

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? 

我运行webdriver-manager和我的应用服务器。我的茉莉花版本是:2.5.2 和我的量角器版本是: 4.0.9

任何想法我做错了什么?

谢谢!

+0

可能意味着您指定给您的规格的文件路径不正确。你使用什么命令来运行你的测试? – Gunderson

+0

你的测试文件夹树是什么样的? – stsatlantis

+0

嗨!我使用的是一口任务: 功能E2E(){ gulp.src([ “./ SRC /测试/ * JS。”])管(量角器({ CONFIGFILE:“CONF/protractor.config。 js“, args:['--baseUrl','http:// localhost8080'] }))。on('error',function(e){ throw e; }); } –

回答

0

我意识到我的问题是什么(感谢帮助我实现的意见)。 我跑我的测试与一饮而尽任务我做:

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

我不知道为什么会这样:gulp.src(["/src/test/*.js"]) wasnt前往查看在我的测试文件,所以我改变它:gulp.src(["src/test/e2e/login.e2e.spec.js"])

我知道它不是最好的解决方案,但足以生存......

+1

您遇到的问题是'src/test/login.e2e.spec.js'与' src/test/e2e/login.e2e.spec.js'尝试使用'src/test/**/*。js'代替。 – tehbeardedone

+0

你是对的,它的工作!谢谢!! –