Skip to content

Does cypress support chained not? #9598

Discussion options

You must be logged in to vote

Yes, it does support chaining multiple nots.

index.html

<html>
  <body>
    <div class="foo">Foo
      <div class="bar type-more">Foo 1</div>
      <div class="bar hide">Foo 2</div>
      <div class="bar">Foo 3</div>
      <div class="bar type-more">Foo 4</div>
      <div class="bar hide">Foo 5</div>
    </div>
    <div class="baz">Baz
      <div class="bar">Foo 1</div>
      <div class="bar">Foo 2</div>
      <div class="bar">Foo 3</div>
      <div class="bar">Foo 4</div>
      <div class="bar">Foo 5</div>
    </div>
  </body>
</html>

spec.js

it('test', () => {
  cy.visit('index.html');
  cy.get('.foo')
    .find('.bar')
    .not('.hide')
    .not('.type-more')
    .should('contain', 'Fo…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jennifer-shehane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants