title: Cypress: How to verify generated checkBox is checked and has attribute aria-checked="true"
body: <p>I want to verify that a checkbox is checked. But it isn't a usually checkbox from type=&quot;checkbox&quot;, so it HASN'T the property &quot;checked&quot;.
  Instead of this you can find in the HTML-Doom  aria-checked=&quot;true&quot;.
  How can I read out this value?</p>
  <p>HTML-Snipet:</p>
  <pre><code>
  &lt;mat-checkbox class=&quot;mat-checkbox mat-primary mat-checkbox-checked&quot; aria-label=&quot;checkBoxCapacityBaseEditDayofWeek: 1&quot; id=&quot;DAY1&quot;&gt;
    &lt;label class=&quot;mat-checkbox-layout&quot; for=&quot;DAY1-input&quot;&gt;
    &lt;span class=&quot;mat-checkbox-inner-container&quot;&gt;
     &lt;input type=&quot;checkbox&quot; class=&quot;mat-checkbox-input cdk-visually-hidden&quot; id=&quot;DAY1-input&quot; tabindex=&quot;0&quot; value=&quot;1&quot; aria-checked=&quot;true&quot;&gt;
  </code></pre>
  <p>What I've tried for so long:</p>
  <p>Cypress-Code (nothing works):</p>
  <pre><code>// cy.get('#DAY2')
      // .should('have.value', 'aria-checked=&quot;true&quot;')
      
      cy.get('#DAY1')
      .should('have.attr', 'aria-checked', 'false')
  
      cy.get('#DAY2')
      .should('have.attr', 'aria-checked', 'true')
  
      // .invoke('val', 'aria-checked')
      // .should('eq', true)
      // .should('have.prop', 'aria-checked', true)
      // .should('have.attr', 'aria-checked', 'true')
  </code></pre>
  <p>How can I get to the value  true?</p>
  <p>EDIT:
  I found the solution:
  Cypress-Code:</p>
  <pre><code>cy.get('#DAY1-input').should('have.attr', 'aria-checked', 'true')
  </code></pre>