blob: 1f8eea02445376e2d2146f6a4c7af806a8e14936 [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001declare namespace Cypress {
2 interface Chainable {
3 selectDropdownOptionByText : typeof selectDropdownOptionByText;
Ittay Stern6f900cc2018-08-29 17:01:32 +03004 checkIsOptionSelected : typeof checkIsOptionSelected;
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03005 }
6}
7
8/************************************************
9 select option with some text with select tag id
10 ************************************************/
11function selectDropdownOptionByText(selectId : string, optionText : string) : void {
12 cy.getElementByDataTestsId(selectId)
13 .select(optionText);
14}
15
Ittay Stern6f900cc2018-08-29 17:01:32 +030016/************************************************
17 check if option is selected
18 ************************************************/
19function checkIsOptionSelected(selectId : string, optionText : string) : void {
20 cy.getElementByDataTestsId(selectId)
21 .should('have.value', optionText)
22}
23
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030024Cypress.Commands.add('selectDropdownOptionByText', selectDropdownOptionByText);
Ittay Stern6f900cc2018-08-29 17:01:32 +030025Cypress.Commands.add('checkIsOptionSelected', checkIsOptionSelected);
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030026