Skip to content

Commit

Permalink
refactor(assertions): reuse button query
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Oct 2, 2023
1 parent b86f104 commit dcd5dd0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/assertions/button.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { Then } from '@badeball/cypress-cucumber-preprocessor';

import { When_I_find_button_by_text } from '../queries';
import { getCypressElement } from '../utils';

/**
* Then I see button:
*
Expand All @@ -22,7 +25,8 @@ import { Then } from '@badeball/cypress-cucumber-preprocessor';
* - {@link Then_I_see_text | Then I see text}
*/
export function Then_I_see_button(text: string) {
cy.contains('button:visible', text).should('exist');
When_I_find_button_by_text(text);
getCypressElement().should('exist');
}

Then('I see button {string}', Then_I_see_button);

0 comments on commit dcd5dd0

Please sign in to comment.