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

Returning chain from step definition fails #713

Closed
badeball opened this issue May 16, 2022 · 1 comment
Closed

Returning chain from step definition fails #713

badeball opened this issue May 16, 2022 · 1 comment

Comments

@badeball
Copy link
Owner

badeball commented May 16, 2022

Feature: a feature
  Scenario: a scenario
    Given a step
const { Given } = require("@badeball/cypress-cucumber-preprocessor");

Given("a step", () => cy.log("foo"))
CypressError: Cypress detected that you returned a promise from a command while also invoking one or more cy commands in that promise.

The command that returned the promise was:

  > `cy.wrap()`

The cy command you invoked inside the promise was:

  > `cy.then()`

Because Cypress commands are already promise-like, you don't need to wrap them or return your own promise.

Cypress will resolve your command with whatever the final Cypress command yields.

The reason this is an error instead of a warning is because Cypress internally queues commands serially whereas Promises execute as soon as they are invoked. Attempting to reconcile this would prevent Cypress from ever resolving.

#689 (comment)

@badeball
Copy link
Owner Author

Fixed with v9.2.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant