https://cypress.io logo
Error from cy.visit
# i-need-help
c
Hi all I am capturing
headers
from api request by cy.wait. It was working before, and the code is basically copied from Cypress document:
Copy code
describe('test', function () {
    let headers;
    beforeEach(function () {
        cy.intercept(userApi).as('request');
        cy.visit('/')
        cy.wait('@request').its('request.headers').then((headers) => {
            headers = headers;
        })
    });
    it('test', function () {
        ...
    })
But I get this error:
Copy code
> Cypress detected that you returned a promise from a command while also invoking one or more cy commands in that promise.
The line it points to is
cy.visit()
Any idea why this would happen? Thanks
m
Could you link the Cypress docs you got the example from?
g
are you sure this is the complete test you are running?
c
the problem went away after i restarted cypress without any change. not sure why thanks anyway
2 Views