title: How to count DOM elements in Cypress assertion
body: <p>I'm trying to count the number of options in a select element, and the number of elements of a certain class in the DOM.</p>
  
  <p>I need to compare the two totals for a Cypress assertion.</p>
  
  <p>I can select the options I need, and iterate over them with each(), and increment a counter that way. However, it's asynchronous, and it's also a clumsy solution. I'm certain that the object yielded by my cy.get() has a length property, I just can't seem to get at it.</p>
  
  <p>Here is one of the things I expected to work. It logs <em>undefined</em> to the console.</p>
  
  <pre><code>cy.get('div[data-cy-type="group-component"]:first').as('firstGroup');
  cy.get('@firstGroup').find('[name=group_id]').as('groupSelect');
  console.log(cy.get('@groupSelect').children('option').length);
  </code></pre>
  
  <p>I know my alias is good and my cy.get() is yielding the correct select element.</p>
  
  <p>If I do something like this:</p>
  
  <pre><code>cy.get('@groupSelect').children('option').each(function(){
      console.log(i++);
  });
  </code></pre>
  
  <p>then it will iterate over each option. But it's asynchronous so not very helpful in this flow.</p>