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

Should will not wait when used on custom command #3683

Closed
danielberecz opened this issue Mar 11, 2019 · 1 comment
Closed

Should will not wait when used on custom command #3683

danielberecz opened this issue Mar 11, 2019 · 1 comment

Comments

@danielberecz
Copy link

danielberecz commented Mar 11, 2019

Current behavior:

The should() method will not wait in case of custom command:

Desired behavior:

The should() method waits also in case of custom command

Steps to reproduce: (app code and test code)

Custom command:

Cypress.Commands.add("position", {prevSubject: 'element'}, ($subject) => {
    return {top: +$subject.get(0).getBoundingClientRect().top.toFixed(0),
        left: +$subject.get(0).getBoundingClientRect().left.toFixed(0)};
});

Test:

cy.get('.my-class').position().should('deep.equal', {top: 25, left: 18});

This assertion will fail if the condition is not met immediately.

Versions

cypress: 3.1.5
macOS 10.14.2
Chrome 72.0.3626.121

@Lakitna
Copy link
Contributor

Lakitna commented Mar 11, 2019

Waiting on an upcoming assertion has to be defined for every command, this is no different for custom commands. This is currently not documented. I have solved it a while ago, see #3109 (comment)

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

No branches or pull requests

3 participants