量角器没有测试,WebDriver在1分钟后失败

时间:2015-03-06 18:27:42

标签: javascript angularjs protractor

我是Protractor和NodeJS的新手,我试图开始使用Protular与AngularJS。

我使用Yeoman generator-gulp-angular来生成一个项目,一切都很好,但是当我尝试protractor protractor.conf.js(我已经安装了Java和Chromium)时,会发生以下情况:

vagrant@server:/var/www/html/project/$ protractor protractor.conf.js 
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.103.173:38573/wd/hub

它挂在这里1分钟,然后喷出以下内容:

/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113
  var template = new Error(this.message);
                 ^
UnknownError: unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Linux 3.13.0-24-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.69 seconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'server', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-24-generic', java.version: '1.7.0_75'

Driver info: org.openqa.selenium.chrome.ChromeDriver
    at new bot.Error (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113:18)
    at Object.bot.response.checkResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/response.js:106:9)
    at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:152:24
    at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
    at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
    at notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)
    at notifyAll (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:442:7)
    at resolve (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:420:7)
    at fulfill (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:535:5)
    at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
==== async task ====
WebDriver.createSession()
    at Function.webdriver.WebDriver.acquireSession_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:149:22)
    at Function.webdriver.WebDriver.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:123:30)
    at Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/builder.js:294:22)
    at DriverProvider.getNewDriver (/usr/local/lib/node_modules/protractor/lib/driverProviders/driverProvider.js:38:7)
    at Runner.createBrowser (/usr/local/lib/node_modules/protractor/lib/runner.js:180:37)
    at /usr/local/lib/node_modules/protractor/lib/runner.js:257:21
    at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:797:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:826:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:759:13)
[launcher] Process exited with error code 1

退出。

这是我的protractory.conf.js

'use strict';

var paths = require('./.yo-rc.json')['generator-gulp-angular'].props.paths;

exports.config = {
node_modules/protractor/config.json
  capabilities: {
    'browserName': 'chrome'
  },
  specs: [paths.e2e + '/**/*.js'],
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000
  }
};

我希望有人可以帮助我!

修改

我添加了我的(单个)测试代码以提供更多洞察力:

'use strict';

describe('The main view', function () {
  var page;

  beforeEach(function () {
    browser.get('http://localhost:3000/index.html');
    page = require('./main.po');
  });

  it('Should display the homepage', function() {
    expect(page.header.getText()).toContain("Home");
  });

});

我的Page Object文件:

'use strict';

var MainPage = function() {
  this.header = element(by.tagName('header'));
};

module.exports = new MainPage();

0 个答案:

没有答案