title: Cypress - if then functions
body: <p>I have question about Cypress.</p>
  
  <p>I have an element on page which doesn't appear allways. There is no logic when it shows and when not.</p>
  
  <p>Is in Cypress some IF/THEN function or something how do you check if the element is displayed (so fill it up) and when you don't see it than skip that step?</p>
  
  <p>My code:        </p>
  
  <pre><code>if (Cypress.$('[data-bind="validationElement: interestInsurable"]').length &gt; 0) {
              cy.get('[for="p4-conditional-csob-interest-insurable-1"]').click()        
          }
  else {cy.get('#car-info-serie')}
  </code></pre>
  
  <p>This is how it looks like in playground:
  <a href="https://i.stack.imgur.com/fDNFU.png" rel="noreferrer">Picture</a></p>
  
  <p>And there is HTML of that checkbox:</p>
  
  <pre><code>&lt;label class="z-radio z-radio-inline primary" for="p4-conditional-csob-interest-insurable-1" data-bind="popover: { content: VehicleInsuranceTooltips.conditionalDataCsobInterestInsurable1Tooltip }" data-original-title="" title=""&gt;
      &lt;input id="p4-conditional-csob-interest-insurable-1" name="p4-conditional-csob-interest-insurable" type="radio" class="custom-radio" data-toggle="radio" data-bind="checkedValue: 1, checked: interestInsurable" value="1"&gt;
  &lt;span class="icons"&gt;
  &lt;span class="icon-unchecked"&gt;&lt;/span&gt;
  &lt;span class="icon-checked"&gt;&lt;/span&gt;
  &lt;/span&gt;
  Patří vozidlo zájemci o pojištění?
  &lt;/label&gt;
  </code></pre>