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 error while running tests #1222

Open
3 tasks done
RankaPalak opened this issue Aug 15, 2024 · 9 comments
Open
3 tasks done

Comments

@RankaPalak
Copy link

RankaPalak commented Aug 15, 2024

Current behavior

Random expected there to be a timestamp for current step (this might be a bug, please report at https://github.com/badeball/cypress-cucumber-preprocessor) error is occurring while running the tests.
Because this error occurred during a after each hook we are skipping the remaining tests in the current suite:

Desired behavior

Test should not halt in between.

Test code to reproduce

-- To be added.

Versions

"@bahmutov/cypress-esbuild-preprocessor": "^2.2.0",
"@deepakvishwakarma/cucumber-json-formatter": "^0.0.3",
"cypress": "12.17.3",
"cypress-recurse": "^1.31.2",
"dayjs": "^1.11.7",
"esbuild": "0.18.17",
"pactum": "^3.2.3",
"pkg": "^5.8.0",
"prettier": "^2.8.0",
"otplib": "^12.0.1",
"cypress-wait-until": "^3.0.1"
"@badeball/cypress-cucumber-preprocessor": "18.0.2",
"convert-units": "^2.3.4",
"cucumber-html-reporter": "^5.5.0",
"cypress-keycloak-commands": "^1.2.0",
"cypress-real-events": "^1.8.1",
"dotenv": "16.3.1",
"fs-extra": "^11.1.0",
"lodash": "^4.17.15",
"multiple-cucumber-html-reporter": "3.4.0",
"node-fetch": "^2.6.0",
"performance-results-parser": "0.0.4",
"test-results-parser": "latest",
"typescript": "^3.8.3"

  • Node version: v18.14.2

Checklist

@badeball
Copy link
Owner

badeball commented Aug 15, 2024

Hey, and thanks for reporting this issue. You need to provide a minimal, reproducible example that illustrates the issue.

@wakeboardfit
Copy link

We got the same last night. Unfortunately I don't have more information than already provided. This is the first time I've seen this though.

@RankaPalak
Copy link
Author

This is random error and there is no way to reproduce this error. I am trying to create a repo with the required details in case I understand where exactly this issue is coming from.

@tbeckettaa
Copy link

I'm getting a similar but slight different error Expected to find a testStep...
Error: Unexpected state in afterSpecHandler: step-started ... that stops the test execution.

I've managed to reliably reproduce my issue by running 2 scenarios in a feature that both fail, with the second scenario changing the baseUrl and visiting a different domain. With Cypress.config("baseUrl", url); and cy.visit(url);
I've found that if one of the tests passes, the error doesn't occur. Moving the scenarios into separate feature files also stops the error

@RankaPalak are you changing the baseUrl in your tests?

@badeball
Copy link
Owner

badeball commented Sep 6, 2024

@tbeckettaa, aside from the somewhat similar wording of the error messages, each expectation-error usually represents completely different edge-cases, with uncomparable fixes. My advice is to open up a new ticket and provide said reproducible example.

@mscudlik
Copy link

Same issue here and some first analysis:

This is actually a symptom of the error handling here:

This means that there is another error and because of that error no timestamp is there which then produces the error you see.

The other error is caused of a nullpointer accessing the id here:

"Included pickle stack is unsynchronized",

This means the stack of is out of sync / empty.

@badeball
Copy link
Owner

@mscudlik, if you have seen line 545, IE.

context.includedPickles[0].id === pickle.id,

.. fail with a "nullpointer access" (I assume you mean an error á Cannot read properties of undefined) then I'd love to see a reproducible example in order to remedy it.

@RankaPalak
Copy link
Author

I'm getting a similar but slight different error Expected to find a testStep... Error: Unexpected state in afterSpecHandler: step-started ... that stops the test execution.

I've managed to reliably reproduce my issue by running 2 scenarios in a feature that both fail, with the second scenario changing the baseUrl and visiting a different domain. With Cypress.config("baseUrl", url); and cy.visit(url); I've found that if one of the tests passes, the error doesn't occur. Moving the scenarios into separate feature files also stops the error

@RankaPalak are you changing the baseUrl in your tests?

Hey @tbeckettaa No, I am not changing any URL.

@richardszanyi
Copy link

richardszanyi commented Oct 17, 2024

I'm having the same issue, it is randomly happening between 330 tests, so I don't think we would be able to provide a reproducible example..

Stacktrace on the error:

Because this error occurred during a `after each` hook we are skipping the remaining tests in the current suite: `Main Navigation` at createError (node_modules/@badeball/cypress-cucumber-preprocessor/dist/helpers/error.js:10:0) at fail (node_modules/@badeball/cypress-cucumber-preprocessor/dist/helpers/assertions.js:14:0) at assert (node_modules/@badeball/cypress-cucumber-preprocessor/dist/helpers/assertions.js:20:0) at assertAndReturn (node_modules/@badeball/cypress-cucumber-preprocessor/dist/helpers/assertions.js:23:0) at Context.afterEachHandler (node_modules/@badeball/cypress-cucumber-preprocessor/dist/browser-runtime.js:610:0) at Context.eval (node_modules/@badeball/cypress-cucumber-preprocessor/dist/browser-runtime.js:207:0)

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

6 participants