title: Cypress: How to know if element is visible or not in using If condition?
body: <p>I want to know if an element is visible or not. I am not sure how to do that.
  I know that we can run this:</p>
  
  <p><code>cy.get('selector').should('be.visible')</code></p>
  
  <p>But if element is invisible then test is failed. So I just want a boolean value if element is not visible so I can decide through if condition.</p>
  
  <p><strong>Use case:</strong></p>
  
  <p>I want to open a side menu by clicking on the button only if sidebar is invisible.</p>
  
  <pre><code>if(sidebarIsInvisible){
     cy.get('#sideMenuToggleButton').click();
  }
  </code></pre>
  
  <p>Is this possible? </p>
  
  <p>I really appreciate for any contribution.</p>
  
  <p>Thanks in advance</p>