Skip to content

Cy command chain not repeating until assertion fulfilled #1210

@shcallaway

Description

@shcallaway
  • Operating System: macOS High Sierra 10.13.2
  • Cypress Version: 1.0.3
  • Browser Version: Chrome 63

Is this a Feature or Bug?

Bug

Current behavior:

My cy command chain is not repeating until the chained assertion is fulfilled, as the documentation suggested it would.

I have a page where users can view their credit cards and change default payment method. My test involves changing the default payment card and asserting that the credit cards swap places (putting the default first).

But here's the thing: It takes a moment for the credit cards to re-render. So cy.get("credit-card") is grabbing the old credit card DOM elements (which are in the wrong order) and then passing them to the first chainer.

The first chainer gets repeated, as one would expect, but not the whole command chain.

Desired behavior:

The whole cy command chain should be repeated until the chained assertion is fulfilled.

How to reproduce:

N/A

Test code:

This code works...

cy.get("credit-card:first")
    .should("contain", "4242");

This code does not...

cy.get("credit-card")
    .first()
    .should("contain", "4242");

Additional Info (images, stack traces, etc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions