在运行config.js文件时,结果显示甚至没有执行开始,但结果需要纳秒才能完成

时间:2016-09-24 04:50:58

标签: protractor cucumberjs

下面提供的是配置文件和stepdefinition文件。跑完后说道 2个场景(2个通过) 7个步骤(7个通过) 0m00.001s

E / launcher - 期待'你好Ayush!'等于你好Rahul!' 进程已退出,错误代码为199



var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');

chai.use(chaiAsPromised);
var expect = chai.expect;

module.exports = function() {
  this.Given(/^I go to "([^"]*)"$/, function(site) {
    browser.get(site);
  });

  this.When(/^I add "([^"]*)" in the task field$/, function(task) {
    element(by.model('todoList.todoText')).sendKeys(task);
  });

  this.When(/^I typed name in the field$/, function() {
    element(by.model('yourName')).sendKeys('Ayush');
  });

  this.Then(/^I click the add button$/, function() {
    var el = element(by.css('[value="add"]'));
    el.click();
  });

  this.Then(/^I should see my new task in the list$/, function(callback) {
    var todoList = element.all(by.repeater('todo in todoList.todos'));
    expect(todoList.count()).to.eventually.equal(3);
    expect(todoList.get(2).getText()).to.eventually.equal('Be Awesome');
    callback();
  });

  this.Then(/^The name should be displayed in the greeting$/, function() {
    var greeting = element(by.binding('yourName'));
    expect(greeting.getText()).to.eventually.equal('Hello Rahul!');
    //callback();
  });
};






exports.config = {
  seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
  getPageTimeout: 60000,
  allScriptsTimeout: 500000,
  framework: 'custom',
  // path relative to the current config file
  frameworkPath: require.resolve('protractor-cucumber-framework'),
  capabilities: {
    'browserName': 'chrome'
  },

  // Spec patterns are relative to this directory.
  specs: [
    '/Users/viveka1/vivek_ayush_angular_ui/feature/login.feature'
  ],

  //baseURL: 'http://localhost:8080/',
  baseURL: 'https://angularjs.org/',

  cucumberOpts: {
    require: '/Users/viveka1/vivek_ayush_angular_ui/step_definition/login.js',
    tags: false,
    format: 'summary',
    profile: false,
    'no-source': true
  }
};




1 个答案:

答案 0 :(得分:0)

尝试添加回调或返回步骤。 像:

 this.When(/^I add "([^"]*)" in the task field$/, function(task) {
    return element(by.model('todoList.todoText')).sendKeys(task);   });