blob: 714daf98a6e704023ab1642b3a0a39d4d2139394 [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001declare namespace Cypress {
2 interface Chainable {
3 typeToInput : typeof typeToInput;
4 blurInput : typeof blurInput;
5 focusInput : typeof focusInput;
6 shouldInputContainsText: typeof shouldInputContainsText;
7 }
8}
9
10/**********************************
11 Type to input with id some text
12 *********************************/
13function typeToInput(id : string, text : string) : void {
14 cy.get( "[data-tests-id='" + id +"']")
15 .type(text, {force: true});
16}
17
18/********************
19 blur input with id
20 ********************/
21function blurInput(id : string) : void {
22 cy.get( "[data-tests-id='" + id +"']")
23 .blur();
24}
25
26/********************
27 focus input with id
28 ********************/
29function focusInput(id : string) : void {
30 cy.get( "[data-tests-id='" + id +"']")
31 .focus();
32}
33
34/*****************************************
35 test if input with id contains some text
36 ****************************************/
37function shouldInputContainsText(id : string, text : string) : void {
38 cy.get( "[data-tests-id='" + id +"']")
39 .contains('text')
40}
41
42Cypress.Commands.add('typeToInput', typeToInput);
43Cypress.Commands.add('blurInput', blurInput);
44Cypress.Commands.add('focusInput', focusInput);
45Cypress.Commands.add('shouldInputContainsText', shouldInputContainsText);
46