cypress-io / cypress-documentation

Cypress Documentation including Guides, API, Plugins, Examples, & FAQ.

Home Page:https://docs.cypress.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

t-benze opened this issue · comments

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`
        );

@t-benze We're open to a pull request to clarify this.

hi @jennifer-shehane i've created a pull request regarding this issue, thanks.