void checkMandatory(FieldValidationHelper helper, ExecutionLog log) { log.Log("FieldValidationFrame", "check validation:Mandatory"); goToFP(helper, log); log.Log("FieldValidationFrame", "check mandatory"); clearAllChoice(helper, log); helper.ClickElement("Mandatory"); log.Log("FieldValidationFrame", "check field length"); helper.ClickElement("FieldLength"); helper.TypeText("LengthMin", "5"); helper.TypeText("LengthMax", "10"); log.Log("FieldValidationFrame", "save validation"); helper.ClickElement("SaveVali"); log.Log("FieldValidationFrame", "go to client"); goToClient(helper, log); log.Log("FieldValidationFrame", "mandatory check:no input"); helper.ClearText("LegalNameInput"); helper.ClickElement("Save"); helper.WaitForWorkAround(500); helper.verifyElementPresent("ErrorMes"); log.Log("FieldValidationFrame", "mandatory no input pass"); log.Log("FieldValidationFrame", "field length: check short input"); helper.ClearText("LegalNameInput"); helper.TypeText("LegalNameInput", "55"); helper.ClickElement("Save"); helper.verifyElementPresent("ErrorMes"); log.Log("FieldValidationFrame", "short input pass"); log.Log("FieldValidationFrame", "field length: check long input"); helper.ClearText("LegalNameInput"); helper.TypeText("LegalNameInput", "jjiiawethfjiwe"); helper.ClickElement("Save"); string nameinput = helper.GetTextContent("LegalNameInput"); Assert.IsTrue(nameinput.Length == 10); log.Log("FieldValidationFrame", "field length: long input pass"); }
//check data type and data format void checkDataTypeandFormat(FieldValidationHelper helper, ExecutionLog log) { log.Log("FieldValidationFrame", "check datatype:Numeric"); changeDataType(helper, "numeric", log); log.Log("FieldValidationFrame", "check datatype:Numeric data range"); helper.TypeText("LengthMin", "5"); helper.TypeText("LengthMax", "10"); helper.ClickElement("SaveVali"); log.Log("FieldValidationFrame", "check datatype:Numeric go to client"); goToClient(helper, log); log.Log("FieldValidationFrame", "check datatype:Numeric clear legal name text box"); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check datatype:Numeric illegal input string"); helper.TypeText("LegalNameInput", "fdsf"); helper.ClickElement("Save"); helper.verifyElementPresent("ErrorMes"); log.Log("FieldValidationFrame", "check datatype:Numeric illegal input string pass"); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check datatype:Numeric small input"); helper.TypeText("LegalNameInput", "1"); helper.ClickElement("Save"); helper.verifyElementPresent("ErrorMes"); log.Log("FieldValidationFrame", "check datatype:Numeric small input pass"); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check datatype:Numeric large input"); helper.TypeText("LegalNameInput", "12"); helper.ClickElement("Save"); helper.verifyElementPresent("ErrorMes"); log.Log("FieldValidationFrame", "check datatype:Numeric large input pass"); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check datatype:Numeric illegal input decimal"); helper.TypeText("LegalNameInput", "6.5"); helper.ClickElement("Save"); helper.verifyElementPresent("ErrorMes"); log.Log("FieldValidationFrame", "check datatype:Numeric illegal input decimal pass"); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check datatype:Numeric legal input"); helper.TypeText("LegalNameInput", "6"); helper.ClickElement("Save"); string nameinput = helper.GetTextContent("LegalNameInput"); Assert.IsTrue(nameinput == "6"); log.Log("FieldValidationFrame", "check datatype:Numeric legal input pass"); log.Log("FieldValidationFrame", "check datatype:Decimal"); changeDataType(helper, "decimal", log); log.Log("FieldValidationFrame", "check datatype:Decimal range"); helper.TypeText("LengthMax", "10"); helper.ClickElement("SaveVali"); log.Log("FieldValidationFrame", "check datatype:Decimal go to client"); goToClient(helper, log); log.Log("FieldValidationFrame", "check datatype:Decimal clear legal name text box"); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check datatype:Decimal illegal input string"); helper.TypeText("LegalNameInput", "fdsf"); helper.ClickElement("Save"); helper.verifyElementPresent("ErrorMes"); log.Log("FieldValidationFrame", "check datatype:Decimal illegal input string pass"); log.Log("FieldValidationFrame", "check datatype:Decimal clear input box"); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check datatype:Decimal small input"); helper.TypeText("LegalNameInput", "1.5"); helper.ClickElement("Save"); helper.verifyElementPresent("ErrorMes"); log.Log("FieldValidationFrame", "check datatype:Decimal small input pass"); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check datatype:Decimal large input"); helper.TypeText("LegalNameInput", "12.5"); helper.ClickElement("Save"); helper.verifyElementPresent("ErrorMes"); log.Log("FieldValidationFrame", "check datatype:Decimal large input pass"); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check datatype:Decimal legal input"); helper.TypeText("LegalNameInput", "6.5"); helper.ClickElement("Save"); nameinput = helper.GetTextContent("LegalNameInput"); Assert.IsTrue(nameinput == "6.5"); log.Log("FieldValidationFrame", "check datatype:Decimal legal input pass"); log.Log("FieldValidationFrame", "check format:Email"); changeDataFormat(helper, "email", log); log.Log("FieldValidationFrame", "check format:Email go to client"); goToClient(helper, log); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check format:Email illegal input"); helper.TypeText("LegalNameInput", "gg"); helper.ClickElement("Save"); helper.verifyElementPresent("ErrorMes"); log.Log("FieldValidationFrame", "check format:Email illegal input pass"); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check format:Email legal input"); helper.TypeText("LegalNameInput", "*****@*****.**"); helper.ClickElement("Save"); nameinput = helper.GetTextContent("LegalNameInput"); Assert.IsTrue(nameinput == "*****@*****.**"); log.Log("FieldValidationFrame", "check format:Email legal input pass"); log.Log("FieldValidationFrame", "check format:ssn"); changeDataFormat(helper, "ssn", log); log.Log("FieldValidationFrame", "check format:ssn go to client"); goToClient(helper, log); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check format:ssn illegal input string"); helper.TypeText("LegalNameInput", "gg"); helper.ClickElement("Save"); nameinput = helper.GetTextContent("LegalNameInput"); Assert.IsTrue(nameinput.Length == 0); log.Log("FieldValidationFrame", "check format:ssn illegal input string pass"); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check format:ssn short input"); helper.TypeText("LegalNameInput", "44"); helper.ClickElement("Save"); nameinput = helper.GetTextContent("LegalNameInput"); Assert.IsTrue(nameinput.Length == 0); log.Log("FieldValidationFrame", "check format:ssn short input pass"); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check format:ssn long input"); helper.TypeText("LegalNameInput", "543737345245273762"); helper.ClickElement("Save"); nameinput = helper.GetTextContent("LegalNameInput"); Assert.IsTrue(nameinput.Length == 11); log.Log("FieldValidationFrame", "check format:ssn long input pass"); log.Log("FieldValidationFrame", "check format:Phone"); changeDataFormat(helper, "phone", log); log.Log("FieldValidationFrame", "check format:Phone go to client"); goToClient(helper, log); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check format:Phone inllegal input string"); helper.TypeText("LegalNameInput", "gg"); helper.ClickElement("Save"); nameinput = helper.GetTextContent("LegalNameInput"); Assert.IsTrue(nameinput.Length == 0); log.Log("FieldValidationFrame", "check format:Phone illegal input string pass"); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check format:Phone short"); helper.TypeText("LegalNameInput", "44"); helper.ClickElement("Save"); nameinput = helper.GetTextContent("LegalNameInput"); Assert.IsTrue(nameinput.Length == 0); log.Log("FieldValidationFrame", "check format:Phone short pass"); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check format:Phone long"); helper.TypeText("LegalNameInput", "543737345245273762"); helper.ClickElement("Save"); nameinput = helper.GetTextContent("LegalNameInput"); Assert.IsTrue(nameinput.Length == 14); log.Log("FieldValidationFrame", "check format:Phone long pass"); log.Log("FieldValidationFrame", "check format:TaxID"); changeDataFormat(helper, "taxid", log); goToClient(helper, log); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check format:TaxID illegal input string"); helper.TypeText("LegalNameInput", "gg"); helper.ClickElement("Save"); nameinput = helper.GetTextContent("LegalNameInput"); Assert.IsTrue(nameinput.Length == 0); log.Log("FieldValidationFrame", "check format:TaxID illegal input string pass"); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check format:TaxID short"); helper.TypeText("LegalNameInput", "44"); helper.ClickElement("Save"); nameinput = helper.GetTextContent("LegalNameInput"); Assert.IsTrue(nameinput.Length == 0); log.Log("FieldValidationFrame", "check format:TaxID short pass"); helper.ClearText("LegalNameInput"); log.Log("FieldValidationFrame", "check format:TaxID long"); helper.TypeText("LegalNameInput", "543737345245273762"); helper.ClickElement("Save"); nameinput = helper.GetTextContent("LegalNameInput"); Assert.IsTrue(nameinput.Length == 10); log.Log("FieldValidationFrame", "check format:TaxID long pass"); }