title: Cypress - how to find by text content?
body: <p>In Cypress, I want to select a button from a group of buttons based on its text-content. How can I do it? Here is my approach:</p>
  
  <pre><code>export const getCustomerButton = () =&gt; getNavigationSidenav()
    .find('mat-expansion-panel-header')
    .each(($el, index, $list) =&gt; {
      const text = $el.find('.mat-content &gt; mat-panel-title').text();
      if (text === 'Customer') {
        return $el;
      }
      return null;
    });
  </code></pre>
  
  <p>The problem I have now is that I have to filter out the nulls from the element array. Is there a less complicated way?</p>