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

Getting error mixing cy.request with cy.now #44

Closed
sergeyKhristenko opened this issue Aug 20, 2020 · 1 comment
Closed

Getting error mixing cy.request with cy.now #44

sergeyKhristenko opened this issue Aug 20, 2020 · 1 comment

Comments

@sergeyKhristenko
Copy link

Hello! First of all thank you for this plugin!

However, there is an error I'm stuck with. Getting this error when mixing cy.now with cy.request and cy.wrap:
image

Steps to reproduce:

it('cy.request + cy.now', function () {
  cy.wrap(true).then(() => {
    return cy
      .now('request', {
        url: `http://google.com`,
      })
      .then(($res) => cy.wrap($res, { log: false }));
  });
});

I see that the plugin overwrites request and server. Maybe it makes sense to make request and server logs configurable(turn on/off)?

@archfz
Copy link
Owner

archfz commented Aug 20, 2020

Hi. This is not related to the plugin. I think you should not be using cy.now in the tests as it is meant for debugging and especially only used in the browser console. See https://docs.cypress.io/guides/guides/debugging.html#Run-Cypress-command-outside-the-test . Also you don't need cy.wrap. You can just do directly cy.request(..).

Also the error is pointing to a logic issue somewhere. Please note that all cy command add to a queue that will only start executing once your current execution context finished (all queuing finished). Attempting to add additional cy commands on this queue during async execution will produce this error since cypress detects that something was queued while it's executing the queue and it doesn't know where to put this new command.

@archfz archfz closed this as completed Aug 20, 2020
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

2 participants