title: Conditional statement in cypress
body: <p>I am trying to do a conditional statement on cypress to check if the login link in the header is Sign in or Account or a class and then click on it.</p>
  
  <p>The if condition is not working.</p>
  
  <pre><code>cy.get('header').then((header) =&gt; { 
  
  if (header.find('Sign in').length &gt; 0) { 
      cy.contains('Sign In')
      .click({force:true})  
  
  } else if (header.find('Account').length &gt; 0) {
      cy.contains('Account')
      .click()
  
  } else {
      cy.get('.navUser-item--account .navUser-action').click()
  
  }
  </code></pre>
  
  <p>})</p>
  
  <p>I expect if Sign in found then it will click else if the Account is available then it will click else it will check by the class.</p>
  
  <p>[always doing the last else condition][1] [1]: <a href="https://i.stack.imgur.com/liEF9.png" rel="nofollow noreferrer">https://i.stack.imgur.com/liEF9.png</a></p>
  
  <p>[there is Account text and still it applied the last  else condition][2] [2]: <a href="https://i.stack.imgur.com/sXYr8.png" rel="nofollow noreferrer">https://i.stack.imgur.com/sXYr8.png</a></p>
  
  <p><a href="https://i.stack.imgur.com/UYTqL.png" rel="nofollow noreferrer">Another code structure and now it always apply the first condition no matter what</a></p>