Skip to content

Commit

Permalink
feat(assertions): pass options to "I see label" and "I do not see label"
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Dec 8, 2023
1 parent 2ad8bad commit 417ae1f
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions src/assertions/label.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Then } from '@badeball/cypress-cucumber-preprocessor';
import { DataTable, Then } from '@badeball/cypress-cucumber-preprocessor';

import { When_I_find_elements_by_label_text } from '../queries';
import { getCypressElement } from '../utils';
Expand All @@ -18,12 +18,22 @@ import { getCypressElement } from '../utils';
* Then I see label "Label"
* ```
*
* With [options](https://docs.cypress.io/api/commands/get#Arguments):
*
* ```gherkin
* Then I see label "Label"
* | log | true |
* | timeout | 4000 |
* | withinSubject | null |
* | includeShadowDom | false |
* ```
*
* @see
*
* - {@link Then_I_see_text | Then I see text}
*/
export function Then_I_see_label(text: string) {
When_I_find_elements_by_label_text(text);
export function Then_I_see_label(text: string, options?: DataTable) {
When_I_find_elements_by_label_text(text, options);
getCypressElement().should('exist');
}

Expand All @@ -44,12 +54,22 @@ Then('I see label {string}', Then_I_see_label);
* Then I do not see label "Label"
* ```
*
* With [options](https://docs.cypress.io/api/commands/get#Arguments):
*
* ```gherkin
* Then I do not see label "Label"
* | log | true |
* | timeout | 4000 |
* | withinSubject | null |
* | includeShadowDom | false |
* ```
*
* @see
*
* - {@link Then_I_do_not_see_text | Then I do not see text}
*/
export function Then_I_do_not_see_label(text: string) {
When_I_find_elements_by_label_text(text);
export function Then_I_do_not_see_label(text: string, options?: DataTable) {
When_I_find_elements_by_label_text(text, options);
getCypressElement().should('not.exist');
}

Expand Down

0 comments on commit 417ae1f

Please sign in to comment.