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.

Steps definitions are not executed

See original GitHub issue

I used this project successfully about a onth ago, and today I can’t make it work anymore.

Whatever I do, I always get the error Error: Step implementation missing for: I am on the "/" page.

Here is my feature : tests/e2e/specs/vue-cli-demo.feature

Feature: Vue cli demo

I want to see the demo created by 'vue-cli create' to test cypress with cucumber preprocessor

  Scenario: Visualizing the home page
    Given I am on the "/" page
    Then I see the vue logo

  # Scenario: Navigating to the about page
  #   Given I am on the "/" page
  #   When I click on the "about" link in the menu
  #   Then The current page is "/about"
  #   And The page title is "This is an about page"

And the steps : tests/e2e/support/step_definitions/common.js

/* global given, when, then */
console.log('Hello')
given('I am on the "/" page', () => {
  cy.visit('/');
})

then('I see the vue logo', () => {
  cy.get('img[src="../assets/logo.png"]')
})

The non-default paths are all correctly configured (I think)

I added a console.log in the compile method of the index.js file of the project which prints the result of the function. I get this :

const {resolveAndRunStepDefinition, given, when, then} = require('cypress-cucumber-preprocessor/resolveStepDefinition');
  const { createTestFromScenario } = require('cypress-cucumber-preprocessor/createTestFromScenario');
  const { createTestsFromFeature } = require('cypress-cucumber-preprocessor/createTestsFromFeature');
  { 
    /* global given, when, then */
console.log('Hello')
given('I am on the "/" page', () => {
  cy.visit('/');
})

then('I see the vue logo', () => {
  cy.get('img[src="../assets/logo.png"]')
}) 
    }
  const {Parser, Compiler} = require('gherkin');
  const spec = `Feature: Vue cli demo

I want to see the demo created by 'vue-cli create' to test cypress with cucumber preprocessor

  Scenario: Visualizing the home page
    Given I am on the "/" page
    Then I see the vue logo

  # Scenario: Navigating to the about page
  #   Given I am on the "/" page
  #   When I click on the "about" link in the menu
  #   Then The current page is "/about"
  #   And The page title is "This is an about page"
`
  const gherkinAst = new Parser().parse(spec);
  
  createTestsFromFeature(gherkinAst);

This makes me believe that the plugin correctly finds my step definitions, but they are never executed (I don’t see the console.log(“Hello”) at the top)

Can you help me figure out what’s wrong ?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:17 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lgandeckicommented, Mar 27, 2019

nice! Thanks for sharing

1reaction
lgandeckicommented, Apr 24, 2020

yes, you write them “by hand” 😄 There is no need for scary regex though! take a look here: https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/blob/master/cypress/support/step_definitions/scenario_outline_string.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

Step Definitions are not recognized while running cucumber ...
However when I try to run it from command prompt, after creating a runner class, the step definitions are not recognized.
Read more >
Running Cucumber feature file doesn't generate step definitions
When a new step is implemented in a feature file. The step definitions is not generate for that step and it shows the...
Read more >
Why is my Feature File failing to find the Step Definition?
Your java is defined as a folder and not package try defining it as package and calling java.uk.co... if you see the folder...
Read more >
Step Definition - Cucumber - Tools QA
A Step Definition is a small piece of code with a pattern attached to it or in other words a Step Definition is...
Read more >
FAQ - Cucumber Documentation
If Cucumber is telling you that your steps are undefined, when you have defined step definitions, this means that Cucumber cannot find your...
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