question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Message undefined. implement with following snippet

See original GitHub issue

Hi guys,

I have written a small angular 2 app and trying to write acceptance tests but it keeps failing. I am not sure if its a cucumber bug or protractor bug, please find below info and help me out in this one.

$ npm -v 3.10.3

$ node -v v4.4.5

$ protractor --version Version 3.3.0

“cucumber”: “0.9.5”, “protractor-cucumber-framework”: “0.3.4”

steps.js

var steps = function () {

    this.Given(/^I am on the homepage$/, function (callback) {
        // Write code here that turns the phrase above into concrete actions
        browser.get("http://localhost:5001/");
        callback(null, 'pending');
    });

    this.Then(/^I should see a "([^"]*)"$/, function (arg1, callback) {
        // Write code here that turns the phrase above into concrete actions
        callback(null, 'pending');
    });

};

module.exports = steps;

home.feature

Feature: Homepage 
  As a user
  I want to visit the homepage
  So that I can access the various features on offer

  Scenario: Visit Homepage
    Given I am on the homepage
    Then I should see a "app works!"

protractor.conf.js

exports.config = {
    seleniumAddress: 'http://localhost:4444/wd/hub',
    framework: 'custom',
    frameworkPath: '../node_modules/protractor-cucumber-framework/',
    capabilities: {
        'browserName': 'chrome'
    },
    cucumberOpts: {
        format: "summary"
    },
    specs: ['../e2e/features/*.feature'],

    onPrepare: function () {
        browser.baseUrl = "http://localhost:5001/";
    }
};

when i run using protractor <path to config file> I get below output. I am not sure what i am doing wrong.

$ protractor config/protractor.conf.js
[15:05:25] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[15:05:25] I/launcher - Running 1 instances of WebDriver
cucumber event handlers attached via registerHandler are now passed the associated object instead of an event
getPayloadItem will be removed in the next major release
Warnings:

1) Scenario: Visit Homepage - e2e\features\homepage.feature:6
   Step: Given I am on the homepage - e2e\features\homepage.feature:7
   Message:
     Undefined. Implement with the following snippet:

       this.Given(/^I am on the homepage$/, function (callback) {
         // Write code here that turns the phrase above into concrete actions
         callback(null, 'pending');
       });

2) Scenario: Visit Homepage - e2e\features\homepage.feature:6
   Step: Then I should see a "app works!" - e2e\features\homepage.feature:8
   Message:
     Undefined. Implement with the following snippet:

       this.Then(/^I should see a "([^"]*)"$/, function (arg1, callback) {
         // Write code here that turns the phrase above into concrete actions
         callback(null, 'pending');
       });

1 scenario (1 undefined)
2 steps (2 undefined)
0m00.000s
[15:05:28] I/launcher - 0 instance(s) of WebDriver still running
[15:05:28] I/launcher - chrome #01 passed

any help would be appreciated.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
avivbeericommented, Jul 11, 2016

In your cucumberOpts, I think you need to add: require: ["./path/to/steps.js"]

Otherwise cucumber doesn’t know where to find your step definitions.

0reactions
lock[bot]commented, Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting error -"Undefined. Implement with the following ...
Implement with the following snippet" when executing protractor ... I am on the homepage - e2e\Feature\google.feature:4 Message: Undefined.
Read more >
cucumber/cucumber-js - Gitter
Message : Undefined. Implement with the following snippet: this.Given(/^que estou na página de consulta de clientes$/, function (callback) { // Write code ...
Read more >
Getting undefined when I define {string} parameter in the ...
But on running this one, it gives me error as undefined, and suggest the following: Undefined. Implement with the following snippet:
Read more >
cucumber fails to find the step definitions in IntelliJ IDEA
Undefined scenarios | cucumber fails to find the step definitions in IntelliJ IDEA. Watch later. Share. Copy link.
Read more >
10 Minute Tutorial - Cucumber Documentation
Given today is Sunday Undefined. Implement with the following snippet: Given('today is Sunday', function () { // Write code here that turns the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found