Skip to content

Commit

Permalink
fix(assertions): correct find label logic in "Then I see label"
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Jan 2, 2023
1 parent 0db97b1 commit 8a480fd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/assertions/label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export function Then_I_see_label(text: string) {
cy.get('body').then(($body) => {
if ($body.find('label:visible').text().includes(text)) {
cy.contains('label:visible', text).should('exist');
} else if (!$body.find(`[aria-labelledby='${text}']:visible`).length) {
cy.contains(`[aria-labelledby='${text}']:visible`, text).should('exist');
} else if (!$body.find(`[aria-label='${text}']:visible`).length) {
cy.contains(`[aria-label='${text}']:visible`, text).should('exist');
} else if ($body.find(`[aria-labelledby='${text}']:visible`).length) {
cy.get(`[aria-labelledby='${text}']:visible`).should('exist');
} else if ($body.find(`[aria-label='${text}']:visible`).length) {
cy.get(`[aria-label='${text}']:visible`).should('exist');
} else {
throw new Error(`Unable to see label: ${text}`);
}
Expand Down

0 comments on commit 8a480fd

Please sign in to comment.