Skip to content

Misleading argument description in .should('have.been.calledWith', ['arg1, 'arg2']) #5736

@t-benze

Description

@t-benze

Subject

guides/references/assertions

Description

Screenshot 2024-03-02 181146

https://docs.cypress.io/guides/references/assertions#Sinon-Chai

The current document states that the arguments should be passed in as an array, while the actual behavior expects a list of arguments.

For example, the following assertion will fail when running the test.

        //wrong assertion with array
        cy.get('@open').should('have.been.calledOnceWithExactly', [
           `${Cypress.config('baseUrl')}/?space=e7bf21ca`,
           `inkstain-e7bf21ca`,
         ]);

Changing to argument list will pass.

        cy.get('@open').should(
          'have.been.calledOnceWithExactly',
          `${Cypress.config('baseUrl')}/?space=e7bf21ca`,
          `inkstain-e7bf21ca`
        );

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions