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.

@badeball - I am facing step implementation missing error while using cucumber with cypress

See original GitHub issue

Current behavior

While using cucumber with cypress its showing step implementation missing while running tests. curent error

Desired behavior

it must run test.

Test code to reproduce

Versions

  • Cypress version:

  • Preprocessor version:

  • Node version:

  • Package.json------- { “name”: “cypressautomation”, “version”: “1.0.0”, “description”: “”, “main”: “index.js”, “scripts”: { “test”: “cypress open --browser edge --e2e” }, “author”: “”, “license”: “ISC”, “devDependencies”: { “@cypress/webpack-preprocessor”: “^5.12.0”, “cypress”: “^10.3.0”,

    “cypress-xpath”: “^1.6.2” }, “dependencies”: { “@badeball/cypress-cucumber-preprocessor”: “^11.4.0” },

    @badeball/cypress-cucumber-preprocessor”: { “nonGlobalStepDefinitions”: true } } .cypress-cucumber-preprocessorrc.json---------------------- {“json” : { “enabled” : false, “nonGlobalStepDefinitions”: true, “output” : “jsonreport/test.json” }, “stepDefinitions”: [ “[filepath]/**/.{js}", “[filepath].{js}”, "cypress/e2e/.{js}”
    ]

}

login.js file-------- import {Given, When, Then, And} from “@badeball/cypress-cucumber-preprocessor/steps”

Given(/^A user open website {url}/, function () { cy.visit(“https://www.saucedemo.com/”) })

When(/^A user enter username {string}/, (username) => { cy.get(‘#user-name’).type(username)

})

And(/^A user enters the password {string}/, (password) => { cy.get(‘#password’).type(password)

}) And(/^A user clicks on login button/, ()=>{ cy.get(‘#login-button’).click()

}) Then(/^A user will be logged in/, ()=> { cy.url().should(“contains”, ‘/inventory.html’) });

login.feature---------------------

Feature: user open the website

Feature this is required to login for a user.
Scenario: login

Given A user open website When A user enter username “standard_user” And A user enters the password “secret_sauce” And A user clicks on login button Then A user will be logged in

cypress.config.js-------------------------- /*const { defineConfig } = require(“cypress”); const webpack = require(“@cypress/webpack-preprocessor”); const preprocessor = require(“@badeball/cypress-cucumber-preprocessor”); const addCucumberPreprocessorPlugin = require(“@badeball/cypress-cucumber-preprocessor”).addCucumberPreprocessorPlugin; module.exports = defineConfig({

e2e: {

async function setupNodeEvents(on, config) {
  await preprocessor.addCucumberPreprocessorPlugin(on, config);

  on(
    "file:preprocessor",
    webpack({
      webpackOptions: {
        resolve: {
          extensions: [".ts", ".js"],
        },
        module: {
          rules: [
            {
              test: /\.ts$/,
              exclude: [/node_modules/],
              use: [
                {
                  loader: "ts-loader",
                },
              ],
            },
            {
              test: /\.feature$/,
              use: [
                {
                  loader: "@badeball/cypress-cucumber-preprocessor/webpack",
                  options: config,
                },
              ],
            },
          ],
        },
      },
    })
  );

  // Make sure to return the config object as it might have been modified by the plugin.
  return config;
}

},

"baseUrl" : 'https://www.saucedemo.com/',
"chromeWebSecurity" : false,
"specPattern" : "cypress/e2e/features/*.feature",
asyn

}, });*/

const { defineConfig } = require(“cypress”); const webpack = require(“@cypress/webpack-preprocessor”); const preprocessor = require(“@badeball/cypress-cucumber-preprocessor”);

module.exports = defineConfig({ e2e: { async setupNodeEvents(on, config) { await preprocessor.addCucumberPreprocessorPlugin(on, config);

  on(
    "file:preprocessor",
    webpack({
      webpackOptions: {
        resolve: {
          extensions: [".ts", ".js"],
        },
        module: {
          rules: [
            {
              test: /\.ts$/,
              exclude: [/node_modules/],
              use: [
                {
                  loader: "ts-loader",
                },
              ],
            },
            {
              test: /\.feature$/,
              use: [
                {
                  loader: "@badeball/cypress-cucumber-preprocessor/webpack",
                  options: config,
                },
              ],
            },
          ],
        },
      },
    })
  );

  // Make sure to return the config object as it might have been modified by the plugin.
  return config;
},

specPattern: "cypress/e2e/**/*.feature",
supportFile: false,
chromeWebSecurity: false,
specFiles: "cypress/e2e/**/*.feature",
//baseUrl: "https://www.saucedemo.com/",

},

});

Checklist

  • I’ve read the FAQ.
  • I’ve read Instructions for logging issues.
  • I’m not using cypress-cucumber-preprocessor@4.3.1 (package name has changed and it is no longer the most recent version, see #689).

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
matharecommented, Jul 11, 2022

Try taking “{url}” out of your Given step here: Given(/^A user open website {url}/, function () { cy.visit("https://www.saucedemo.com/") }) i.e. change it to Given(/^A user open website/, function () { cy.visit("https://www.saucedemo.com/") }) as that is the step you are calling in the feature and there is no matching implementation for that step

0reactions
badeballcommented, Jul 13, 2022

That’s not due to an issue with the preprocessor, but rather you mixing regular expressions with cucumber expressions.

FYI, this is as far as my help goes. I can’t be the one to guide you through this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[step_definition] when trying to run a scenario using cucumber ...
Error : Step implementation missing for: [step_definition] when trying to run a scenario using cucumber with cypress - Stack Overflow. Stack ...
Read more >
Cypress_Cucumber Error || Step implementation Missing for
Getting Step Implementation Missing for : i open the page || {Stepname}, How to resolve this cypress - cucumber step implementation missing ......
Read more >
Step implementation missing for: feature name #556 - GitHub
Hi, I am using the cypress cucumber preprocessor and each time I get "error: Step implementation missing for:.
Read more >
Step implementation missing for: [step_definition] when trying ...
I tried to do a simple test to try how cucumber works with cypress, but I didn't manage to solve the problem described...
Read more >
cypress-io/cypress - Gitter
Step implementation missing for: I open Google page node_modules/cypress-cucumber-preprocessor/lib/resolveStepDefinition.js:223:1.
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