I have a long table with status buttons:
<td class="evaluation-button-cell">
<button class="conduct btn btn-tertiary">Met</button>
<button class="conduct btn btn-tertiary">Not Met</button>
</td>
<td class="evaluation-button-cell">
<button class="conduct btn btn-tertiary">Met</button>
<button class="conduct btn btn-tertiary">Not Met</button>
<button class="conduct btn btn-warning">N/A</button>
</td>
<td class="evaluation-button-cell">
<button class="conduct btn btn-tertiary">Met</button>
<button class="conduct btn btn-danger">Not Met</button>
<button class="conduct btn btn-tertiary">N/A</button>
</td>
<td class="evaluation-button-cell">
<button class="conduct btn btn-success">Met</button>
<button class="conduct btn btn-tertiary">Not Met</button>
<button class="conduct btn btn-tertiary">N/A</button>
</td>
<td class="evaluation-button-cell">
<button class="conduct btn btn-tertiary">Met</button>
<button class="conduct btn btn-danger">Not Met</button>
</td>
I need to find a Not Met button with class btn-danger, which also has an adjacent N/A button (with class btn-teriary) and click the N/A button.
I'm a bit lost in all the Cypress options of get, find, within, etc.
I can find one of the buttons but not sure the best approach how to verify it also has the additional button next to it, and that both buttons have the expected classes.
My issue is I need to find the button, with a specific class, adjacent to another button with a specific class. Psuedo code:
cy.contains('Not Met').and('has.class', 'btn-danger').next().contains('N/A).and('has.class', 'btn-tertiary')...and then somehow click the Not Met button :)