0

below provided is the config file and the stepdefinition file. after running it says 2 scenarios (2 passed) 7 steps (7 passed) 0m00.001s

E/launcher - expected 'Hello Ayush!' to equal 'Hello Rahul!' Process exited with error code 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 Answers1

0

Try to add callback or return into steps. like:

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