Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected there to be a timestamp for current step #1206

Closed
topesho opened this issue Jun 26, 2024 · 4 comments
Closed

Expected there to be a timestamp for current step #1206

topesho opened this issue Jun 26, 2024 · 4 comments

Comments

@topesho
Copy link

topesho commented Jun 26, 2024

Hi @badeball I am having this issue with when you run the command -e.g. npm run test or npx cypress run -e TAGS='@home' --headed .

The test only runs from the Cypress dashboard with npx cypress open.

CypressError: cy.task('cypress-cucumber-preprocessor:test-case-started') failed with the following error:

state.messages.current.findLastIndex is not a function

https://on.cypress.io/api/task

Error: Expected there to be a timestamp for current step (this might be a bug, please report at https://github.com/badeball/cypress-cucumber-preprocessor)

Because this error occurred during a after each hook we are skipping the remaining tests in the current suite:

An error was thrown in your plugins file while executing the handler for the after:spec event.

The error we received was:

image

node version 17.5.0

I am using the following
package.json.

{
"name": "xx",
"version": "1.0.0",
"description": "xx",
"main": "index.js",
"scripts": {
"remove-cucumber-json-formatter": "rm -f tools/cucumber-json-formatter",
"download-cucumber-json-formatter": "curl -L https://github.com/cucumber/cucumber-json-formatter/releases/download/vX.Y.Z/cucumber-json-formatter-linux-amd64 -o tools/cucumber-json-formatter && chmod +x tools/cucumber-json-formatter",
"full_regression": "npm run download-cucumber-json-formatter && npx cypress run -e TAGS='@home' --headed && node cucumber-html-report.js; npm run remove-cucumber-json-formatter"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@badeball/cypress-cucumber-preprocessor": "^20.1.0",
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.1",
"cypress": "^13.12.0",
"multiple-cucumber-html-reporter": "^3.6.2",
"ts-loader": "^9.5.1"
},
"cypress-cucumber-preprocessor": {
"stepDefinitions": "cypress/support/step_definitions/**/*.js",
"html": {
"enabled": true,
"output": "cypress/reports/cucumber-html/cucumber-report.html"
},
"json": {
"enabled": true,
"formatter": "cucumber-json-formatter",
"output": "cypress/reports/cucumber-json/cucumber-report.json"
}
}
}

CYPRESS.CONFIG.ts

import { defineConfig } from "cypress";
import createBundler from "@bahmutov/cypress-esbuild-preprocessor";
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
import { createEsbuildPlugin } from "@badeball/cypress-cucumber-preprocessor/esbuild";

export default defineConfig({
e2e: {
specPattern: "**/*.feature",
async setupNodeEvents(
on: Cypress.PluginEvents,
config: Cypress.PluginConfigOptions
): Promise<Cypress.PluginConfigOptions> {
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
await addCucumberPreprocessorPlugin(on, config);

on(
"file:preprocessor",
createBundler({
plugins: [createEsbuildPlugin(config)],
})
);

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

  • [yes ] I've read the FAQ.
  • [yes ] I've read instructions for logging issues.
  • [ yes] 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).
@badeball
Copy link
Owner

state.messages.current.findLastIndex is not a function

This is answered in the FAQ.

As for the following error:

Expected there to be a timestamp for current step (this might be a bug, please report at https://github.com/badeball/cypress-cucumber-preprocessor)

.. you need to provide a reproducible example and not just snippets of what information you think is relevant.

@topesho
Copy link
Author

topesho commented Jun 27, 2024

ok will provide the example project on Monday

@badeball
Copy link
Owner

I recommend that you just update your node version as per the FAQ, before trying anything else.

@badeball
Copy link
Owner

badeball commented Jul 7, 2024

Closing due to lack of a reproducible example. Feel free to open up another issue if anything changes in this regard.

@badeball badeball closed this as completed Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants