title: Cypress - if - else condition doesn't work
body: <p>I need to automate an <code>if</code>/<code>else</code> condition with Cypress, but it doesn't work in my script. If an <code>if</code> element is present (or visible) then click <code>Yes</code> otherwise proceed. But in my case, if the first condition is not present the test try to click <code>Yes</code> anyway.</p>
  <pre><code>it('Logout', () =&gt; {
        const out = new logout();
        const lged = new logged();
        
        lged.logged().then($button =&gt; {
          if ($button.is(':visible')){
            lged.logged().click()
            out.bar().click()
            out.clickout()
          }
          else {
            out.bar().click()
            out.clickout()
          }
        })
      })
  </code></pre>
  <p>in my pageObjects I have the class &quot;logged&quot;:</p>
  <pre><code>    class logged {
  
      logged(){
          return cy.contains('Yes', { timeout: 10000 })
      }
  }
  
  export default logged
  </code></pre>