Closed zerazeon closed 1 year ago
Hello,
Can you share your package.json and cypress.config.js files please?
I've this issue when I try to run your test. Is it normal ?
1) SearchEngine
visiting the frontpage (example #1):
Error:
Step implementation missing for "I visit http://duckduckgo.com".
We tried searching for files containing step definitions using the following search pattern templates:
- cypress/e2e/[filepath]/**/*.{js,mjs,ts,tsx}
- cypress/e2e/[filepath].{js,mjs,ts,tsx}
- cypress/support/step_definitions/**/*.{js,mjs,ts,tsx}
These templates resolved to the following search patterns:
- cypress/e2e/spec/**/*.{js,mjs,ts,tsx}
- cypress/e2e/spec.{js,mjs,ts,tsx}
- cypress/support/step_definitions/**/*.{js,mjs,ts,tsx}
These patterns matched **no files** containing step definitions. This almost certainly means that you have misconfigured `stepDefinitions`.
You can implement it using the suggestion(s) below.
Given("I visit http:\\/\\/duckduckgo.com", function () {
return "pending";
});
Cypress v12.5.1
@Tay08
Hello,
Can you share your package.json and cypress.config.js files please?
package.json
{
"name": "cucumber",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@badeball/cypress-cucumber-preprocessor": "^15.1.3",
"@bahmutov/cypress-esbuild-preprocessor": "^2.1.5",
"cypress": "^12.5.1",
"esbuild": "0.16.5"
}
}
cypress.config.js
const { defineConfig } = require("cypress");
const createBundler = require("@bahmutov/cypress-esbuild-preprocessor");
const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
const createEsbuildPlugin = require("@badeball/cypress-cucumber-preprocessor/esbuild");
async function setupNodeEvents(on, config) {
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
await preprocessor.addCucumberPreprocessorPlugin(on, config);
on(
"file:preprocessor",
createBundler({
plugins: [createEsbuildPlugin.default(config)],
})
);
// Make sure to return the config object as it might have been modified by the plugin.
return config;
}
module.exports = defineConfig({
e2e: {
specPattern: "**/*.feature",
setupNodeEvents,
},
defaultCommandTimeout: 10000,
viewportWidth: 1366,
viewportHeight: 768,
screenshotOnRunFailure: false,
video: false,
videosFolder: "output/videos",
screenshotsFolder: "output/screenshots",
downloadsFolder: "output/downloads",
});
I apologize for accidentally closed
Sorry @zerazeon but I've the same issue. Any idea?
1) SearchEngine
visiting the frontpage (example #1):
Error:
Step implementation missing for "I visit http://duckduckgo.com".
We tried searching for files containing step definitions using the following search pattern templates:
- cypress/e2e/[filepath]/**/*.{js,mjs,ts,tsx}
- cypress/e2e/[filepath].{js,mjs,ts,tsx}
- cypress/support/step_definitions/**/*.{js,mjs,ts,tsx}
These templates resolved to the following search patterns:
- cypress/e2e/spec/**/*.{js,mjs,ts,tsx}
- cypress/e2e/spec.{js,mjs,ts,tsx}
- cypress/support/step_definitions/**/*.{js,mjs,ts,tsx}
These patterns matched **no files** containing step definitions. This almost certainly means that you have misconfigured `stepDefinitions`.
You can implement it using the suggestion(s) below.
Given("I visit http:\\/\\/duckduckgo.com", function () {
return "pending";
});
@Tay08 I'm sorry. I forgot to give you ".cypress-cucumber-preprocessorrc.json" .cypress-cucumber-preprocessorrc.json
{
"filterSpecs": true,
"omitFiltered": true,
"stepDefinitions": [
"cypress/steps/**/*.{js,ts}"
],
"json": {
"enabled": true,
"output": "output/cucumber.json",
"formatter": "cucumber-json-formatter"
},
"messages": {
"enabled": true,
"output": "output/cucumber.ndjson"
},
"html": {
"enabled": true,
"output": "output/cucumber.html"
}
}
Ok @zerazeon no worries, and to make sure, can you share also your project structure please?
@Tay08 here my project structure
Thank you @zerazeon Any info about my issue previously? Do you encountered already this issue?
Anything else inside commands.js and e2e.js files?
@Tay08 for commands.js and e2e.js
commands.js
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
e2e.js
// ***********************************************************
// This example support/e2e.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')
Cypress.on('uncaught:exception', (err, runnable, promise) => {
// when the exception originated from an unhandled promise
// rejection, the promise is provided as a third argument
// you can turn off failing the test in this case
// if (promise) {
return false
// }
// we still want to ensure there are no other unexpected
// errors, so we let them fail the test
})
Interfacing with Cypress in cases of domain switch during a test is unfortunately difficult and not handled properly. I'm not sure at this point if this will ever change, but I'm leaving the isuse open for now.
@Tay08 here my project structure
hello, please what theme are using ?? i like the theme.
hello, please what theme are using ?? i like the theme.
It's Dark+ and Material Icon
any news on this? Seem to have strange behaviour too. in the reports, I get only the failed tests.
This will likely depend on whether this is answered: https://github.com/cypress-io/cypress/issues/26613.
This has been fixed in v17.0.0.
Current behavior
cucumber-report.json
Desired behavior
From my code, result of "http://duckduckgo.com" should be in json and ndjson.
Test code to reproduce
My code
search.feature
search.step.js
Versions