aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/support/elements/element.select.actions.ts
blob: 1f8eea02445376e2d2146f6a4c7af806a8e14936 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
declare namespace Cypress {
  interface Chainable {
    selectDropdownOptionByText : typeof selectDropdownOptionByText;
    checkIsOptionSelected : typeof checkIsOptionSelected;
  }
}

/************************************************
 select option with some text with select tag id
 ************************************************/
function selectDropdownOptionByText(selectId : string, optionText : string) : void {
  cy.getElementByDataTestsId(selectId)
    .select(optionText);
}

/************************************************
 check if  option is selected
 ************************************************/
function checkIsOptionSelected(selectId : string, optionText : string) : void {
  cy.getElementByDataTestsId(selectId)
    .should('have.value', optionText)
}

Cypress.Commands.add('selectDropdownOptionByText', selectDropdownOptionByText);
Cypress.Commands.add('checkIsOptionSelected', checkIsOptionSelected);