cypress-cucumber-preprocessor: Steps definitions are not executed
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 ?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (3 by maintainers)
nice! Thanks for sharing
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