merge from ecomp a88f0072 - Modern UI
Issue-ID: VID-378
Change-Id: Ibcb23dd27f550cf32ce2fe0239f0f496ae014ff6
Signed-off-by: Ittay Stern <ittay.stern@att.com>
diff --git a/vid-webpack-master/cypress/support/elements/element.actions.ts b/vid-webpack-master/cypress/support/elements/element.actions.ts
index 2d30aa1..44e8583 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 @@
isElementEnabled : typeof isElementEnabled;
hasClass : typeof hasClass;
getElementByDataTestsId : typeof getElementByDataTestsId;
+ getTagElementContainsText : typeof getTagElementContainsText;
}
}
@@ -14,36 +15,42 @@
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 714daf9..4e6b5e8 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 @@
blurInput : typeof blurInput;
focusInput : typeof focusInput;
shouldInputContainsText: typeof shouldInputContainsText;
+ clearInput: typeof clearInput;
}
}
@@ -15,32 +16,38 @@
.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 452323d..1f8eea0 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 @@
.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);