Positive Assertions
assertTextPresentInPage
Description: This function will assert if the expected text is present on the page.
Input Format : @Expected Text
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
Mobile | assertTextPresentInPage |
@value | |||
Mobile | assertTextPresentInPage |
Sheet:Column | |||
Mobile | assertTextPresentInPage |
%dynamicVar% |
@Action(object = ObjectType.MOBILE, desc = "Assert if text: [<Data>] is present on the page", input = InputType.YES)
public void assertTextPresentInPage() throws RuntimeException {
try {
String strObj = Data;
if (mDriver.findElement(By.tagName("html")).getText().contains(strObj)) {
System.out.println("assertTextPresent passed");
Report.updateTestLog("assertTextPresentInPage",
"Expected text '" + strObj + "' is present in the page", Status.PASS);
} else {
System.out.println("assertTextPresentInPage failed");
throw new Exception("Expected text '" + strObj + "' is not present in the page");
}
} catch (Exception e) {
Logger.getLogger(this.getClass().getName()).log(Level.OFF, null, e);
throw new ForcedException("assertTextPresentInPage", e.getMessage());
}
}
assertCookiePresent
Description: This function will assert if the cookie is present.
Input Format : @Expected Text
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
Mobile | assertCookiePresent |
@value | |||
Mobile | assertCookiePresent |
Sheet:Column | |||
Mobile | assertCookiePresent |
%dynamicVar% |
@Action(object = ObjectType.MOBILE, desc = "Assert if cookie name: [<Data>] is present", input = InputType.YES)
public void assertCookiePresent() {
try {
String strCookieName = Data;
if ((mDriver.manage().getCookieNamed(strCookieName) != null)) {
System.out.println("assertCookiePresent Passed");
Report.updateTestLog("assertCookiePresent", "Cookie name matched with the data provided", Status.PASS);
} else {
throw new Exception("Cookie name did not match with data provided");
}
} catch (Exception ex) {
System.out.println("assertCookiePresent Failed");
Logger.getLogger(Assertions.class.getName()).log(Level.SEVERE, null, ex);
throw new ForcedException("assertCookiePresent", ex.getMessage());
}
}
assertCookieByName
Description: This function will assert if the cookie has the expected name.
Input Format : @Expected text
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
Mobile | assertCookieByName |
@value | |||
Mobile | assertCookieByName |
Sheet:Column | |||
Mobile | assertCookieByName |
%dynamicVar% |
@Action(object = ObjectType.MOBILE, desc = "Assert if cookie: [<Object>] has name: [<Data>]", input = InputType.YES)
public void assertCookieByName() {
try {
String strCookieName = Data.split(":", 2)[0];
String strCookieValue = Data.split(":", 2)[1];
if (mDriver.manage().getCookieNamed(strCookieName) != null) {
if ((mDriver.manage().getCookieNamed(strCookieName).getValue().equals(strCookieValue))) {
System.out.println("assertCookieByName Passed");
Report.updateTestLog("assertCookieByName", "Cookie name matched with provided data", Status.PASS);
} else {
throw new Exception("Cookie value did not match with provided data");
}
} else {
throw new Exception("Cookie with the name '" + strCookieName + "' did not exist");
}
} catch (Exception ex) {
System.out.println("assertCookieByName Failed");
Logger.getLogger(Assertions.class.getName()).log(Level.SEVERE, null, ex);
throw new ForcedException("assertCookieByName", ex.getMessage());
}
}
assertElementPresent
Description: This function will assert if the Element is present.
ObjectName | Action | Input | Condition | Reference |
---|---|---|---|---|
mobileObject | assertElementPresent |
assertElementSelected
Description: This function will assert if the Element is selected.
ObjectName | Action | Input | Condition | Reference |
---|---|---|---|---|
mobileObject | assertElementSelected |
assertElementDisplayed
Description: This function will assert if the Element is displayed.
ObjectName | Action | Input | Condition | Reference |
---|---|---|---|---|
mobileObject | assertElementDisplayed |
assertElementEnabled
Description: This function will assert if the Element is enabled.
ObjectName | Action | Input | Condition | Reference |
---|---|---|---|---|
mobileObject | assertElementEnabled |
assertElementAttrEquals
Description: This function will assert if element attribute equals given data in input column
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | assertElementAttrEquals |
@Data | PageName | << Hardcoded Input | |
mobileObject | assertElementAttrEquals |
DatasheetName:ColumnName | PageName | << Input from Datasheet | |
mobileObject | assertElementAttrEquals |
%variableName% | PageName | <<Input from variable |
assertElementAttrContains
Description: This function will assert if element attribute contains given data in input column
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | assertElementAttrContains |
@Data | PageName | << Hardcoded Input | |
mobileObject | assertElementAttrContains |
DatasheetName:ColumnName | PageName | << Input from Datasheet | |
mobileObject | assertElementAttrContains |
%variableName% | PageName | <<Input from variable |
assertElementAttrStartsWith
Description: This function will assert if element attribute starts with given data in input column
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | assertElementAttrStartsWith |
@Data | PageName | << Hardcoded Input | |
mobileObject | assertElementAttrStartsWith |
DatasheetName:ColumnName | PageName | << Input from Datasheet | |
mobileObject | assertElementAttrStartsWith |
%variableName% | PageName | <<Input from variable |
assertElementAttrEndsWith
Description: This function will assert if element attribute ends with given data in input column
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | assertElementAttrEndsWith |
@Data | PageName | << Hardcoded Input | |
mobileObject | assertElementAttrEndsWith |
DatasheetName:ColumnName | PageName | << Input from Datasheet | |
mobileObject | assertElementAttrEndsWith |
%variableName% | PageName | <<Input from variable |
assertElementAttrMatches
Description: This function will assert if element attribute matches given data in input column
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | assertElementAttrMatches |
@Data | PageName | << Hardcoded Input | |
mobileObject | assertElementAttrMatches |
DatasheetName:ColumnName | PageName | << Input from Datasheet | |
mobileObject | assertElementAttrMatches |
%variableName% | PageName | <<Input from variable |
assertElementContains
Description: This function will assert if element contains
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | assertElementContains |
PageName |
assertElementContainsPartly
Description: This function will assert if element partly contains
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | assertElementContainsPartly |
PageName |
assertElementTextEquals
Description: This function will assert if element text equals given text in input column
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | assertElementTextEquals |
@Data | PageName | << Hardcoded Input | |
mobileObject | assertElementTextEquals |
DatasheetName:ColumnName | PageName | << Input from Datasheet | |
mobileObject | assertElementTextEquals |
%variableName% | PageName | <<Input from variable |
assertElementTextContains
Description: This function will assert if element text contains given text in input column
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | assertElementTextContains |
@Data | PageName | << Hardcoded Input | |
mobileObject | assertElementTextContains |
DatasheetName:ColumnName | PageName | << Input from Datasheet | |
mobileObject | assertElementTextContains |
%variableName% | PageName | <<Input from variable |
assertElementTextStartsWith
Description: This function will assert if element text starts with given text in input column
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | assertElementTextStartsWith |
@Data | PageName | << Hardcoded Input | |
mobileObject | assertElementTextStartsWith |
DatasheetName:ColumnName | PageName | << Input from Datasheet | |
mobileObject | assertElementTextStartsWith |
%variableName% | PageName | <<Input from variable |
assertElementTextEndsWith
Description: This function will assert if element text ends with given text in input column
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | assertElementTextEndsWith |
@Data | PageName | << Hardcoded Input | |
mobileObject | assertElementTextEndsWith |
DatasheetName:ColumnName | PageName | << Input from Datasheet | |
mobileObject | assertElementTextEndsWith |
%variableName% | PageName | <<Input from variable |
assertElementTextMatchesWith
Description: This function will assert if element text matches with given text in input column
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | assertElementTextMatchesWith |
@Data | PageName | << Hardcoded Input | |
mobileObject | assertElementTextMatchesWith |
DatasheetName:ColumnName | PageName | << Input from Datasheet | |
mobileObject | assertElementTextMatchesWith |
%variableName% | PageName | <<Input from variable |
assertElementTextByLabel
Description: This function is used to assert if the element text adjacent to provided label element equals the expected data.
Input Format : @Expected Text
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | assertElementTextByLabel |
@value | |||
mobileObject | assertElementTextByLabel |
Sheet:Column | |||
mobileObject | assertElementTextByLabel |
%dynamicVar% |
assertElementTextContainsByLabel
Description: This function is used to assert if the element text adjacent to provided label element contains the expected data.
Input Format : @Expected Text
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | assertElementTextContainsByLabel |
@value | |||
mobileObject | assertElementTextContainsByLabel |
Sheet:Column | |||
mobileObject | assertElementTextContainsByLabel |
%dynamicVar% |