summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/support/elements
diff options
context:
space:
mode:
Diffstat (limited to 'vid-webpack-master/cypress/support/elements')
-rw-r--r--vid-webpack-master/cypress/support/elements/element.actions.ts19
-rw-r--r--vid-webpack-master/cypress/support/elements/element.input.actions.ts19
-rw-r--r--vid-webpack-master/cypress/support/elements/element.select.actions.ts10
3 files changed, 36 insertions, 12 deletions
diff --git a/vid-webpack-master/cypress/support/elements/element.actions.ts b/vid-webpack-master/cypress/support/elements/element.actions.ts
index 2d30aa1b1..44e85830c 100644
--- a/vid-webpack-master/cypress/support/elements/element.actions.ts
+++ b/vid-webpack-master/cypress/support/elements/element.actions.ts
@@ -7,6 +7,7 @@ declare namespace Cypress {
isElementEnabled : typeof isElementEnabled;
hasClass : typeof hasClass;
getElementByDataTestsId : typeof getElementByDataTestsId;
+ getTagElementContainsText : typeof getTagElementContainsText;
}
}
@@ -14,36 +15,42 @@ declare namespace Cypress {
isElementContainsAttr : check if element with id contains some attribute
*************************************************************************/
function isElementContainsAttr(id : string, attr: string) : void {
- cy.get("[data-tests-id='" + id +"']")
- .should('have.attr', attr);
+ cy.getElementByDataTestsId(id).should('have.attr', attr);
}
/*********************************************************
isElementDisabled : check if element with id is disabled
*********************************************************/
function isElementDisabled(id : string) : void {
- cy.get( "[data-tests-id='" + id +"']").should('be:disabled');
+ cy.getElementByDataTestsId(id).should('be:disabled');
}
function isElementEnabled(id : string) : void {
- cy.get( "button[data-tests-id='" + id +"']").should('be:enabled');
+ cy.getElementByDataTestsId(id).should('be:enabled');
}
/****************************************************************
hasClass : check if element with id contains some class name
****************************************************************/
function hasClass(id : string, className : string) : void {
- cy.get( "[data-tests-id='" + id +"']")
- .should('have.class', className);
+ cy.getElementByDataTestsId(id).should('have.class', className);
}
function getElementByDataTestsId(dataTestsId : string) : Chainable<JQuery<HTMLElement>> {
return cy.get( "[data-tests-id='" + dataTestsId +"']");
}
+/**************************************************
+ getTagElementContainsText : return tag with text
+ **************************************************/
+function getTagElementContainsText(tag : string, text : string) : Chainable<JQuery<HTMLElement>> {
+ return cy.contains(tag,text);
+}
+
Cypress.Commands.add('isElementContainsAttr', isElementContainsAttr);
Cypress.Commands.add('isElementDisabled', isElementDisabled);
Cypress.Commands.add('isElementEnabled', isElementEnabled);
Cypress.Commands.add('hasClass', hasClass);
Cypress.Commands.add('getElementByDataTestsId', getElementByDataTestsId);
+Cypress.Commands.add('getTagElementContainsText', getTagElementContainsText);
diff --git a/vid-webpack-master/cypress/support/elements/element.input.actions.ts b/vid-webpack-master/cypress/support/elements/element.input.actions.ts
index 714daf98a..4e6b5e879 100644
--- a/vid-webpack-master/cypress/support/elements/element.input.actions.ts
+++ b/vid-webpack-master/cypress/support/elements/element.input.actions.ts
@@ -4,6 +4,7 @@ declare namespace Cypress {
blurInput : typeof blurInput;
focusInput : typeof focusInput;
shouldInputContainsText: typeof shouldInputContainsText;
+ clearInput: typeof clearInput;
}
}
@@ -15,32 +16,38 @@ function typeToInput(id : string, text : string) : void {
.type(text, {force: true});
}
+/**********************************
+ clear input
+ *********************************/
+function clearInput(id : string) : void {
+ cy.get( "[data-tests-id='" + id +"']")
+ .clear();
+}
+
/********************
blur input with id
********************/
function blurInput(id : string) : void {
- cy.get( "[data-tests-id='" + id +"']")
- .blur();
+ cy.getElementByDataTestsId(id).blur();
}
/********************
focus input with id
********************/
function focusInput(id : string) : void {
- cy.get( "[data-tests-id='" + id +"']")
- .focus();
+ cy.getElementByDataTestsId(id).focus();
}
/*****************************************
test if input with id contains some text
****************************************/
function shouldInputContainsText(id : string, text : string) : void {
- cy.get( "[data-tests-id='" + id +"']")
- .contains('text')
+ cy.getElementByDataTestsId(id).contains('text')
}
Cypress.Commands.add('typeToInput', typeToInput);
Cypress.Commands.add('blurInput', blurInput);
Cypress.Commands.add('focusInput', focusInput);
Cypress.Commands.add('shouldInputContainsText', shouldInputContainsText);
+Cypress.Commands.add('clearInput', clearInput);
diff --git a/vid-webpack-master/cypress/support/elements/element.select.actions.ts b/vid-webpack-master/cypress/support/elements/element.select.actions.ts
index 452323d3d..1f8eea024 100644
--- a/vid-webpack-master/cypress/support/elements/element.select.actions.ts
+++ b/vid-webpack-master/cypress/support/elements/element.select.actions.ts
@@ -1,6 +1,7 @@
declare namespace Cypress {
interface Chainable {
selectDropdownOptionByText : typeof selectDropdownOptionByText;
+ checkIsOptionSelected : typeof checkIsOptionSelected;
}
}
@@ -12,5 +13,14 @@ function selectDropdownOptionByText(selectId : string, optionText : string) : vo
.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);