public void contactPrimaryPhoneAndExistingOverlay() { string[] username = null; string[] password = null; var oXMLData = new XMLParse(); oXMLData.LoadXML("../../Config/ApplicationSettings.xml"); //Initializing the objects var executionLog = new ExecutionLog(); var loginHelper = new LoginHelper(GetWebDriver()); var office_ContactsHelper = new Office_ContactsHelper(GetWebDriver()); username = oXMLData.getData("settings/Credentials", "username_office"); password = oXMLData.getData("settings/Credentials", "password"); // Variable var FName = "Fname" + RandomNumber(1, 999); var LName = "Lname" + RandomNumber(1, 999); var CDBA = "Comp" + RandomNumber(99, 99999); String JIRA = ""; String Status = "Pass"; try { executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Login with valid credential Username"); Login(username[0], password[0]); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Verify Page title"); VerifyTitle("Dashboard"); Console.WriteLine("Redirected at Dashboard screen."); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Goto Contact"); VisitOffice("contacts"); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Verify title"); office_ContactsHelper.VerifyText("VerifyContact", "Contacts"); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Goto Create Contact"); VisitOffice("contacts/create"); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Click on Cancel Button"); office_ContactsHelper.ClickElement("Cancelbtn"); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Verify text on page."); office_ContactsHelper.VerifyText("VerifyContact", "Contacts"); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Redirect at create contacts page."); VisitOffice("contacts/create"); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Enter First Name"); office_ContactsHelper.TypeText("FirstNAME", FName); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Enter Last Name"); office_ContactsHelper.TypeText("LastName", LName); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Enter Company DBA Name"); office_ContactsHelper.TypeText("CompanyName", CDBA); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Select phone type"); office_ContactsHelper.Select("PhoneType1", "Work"); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Enter phone number."); office_ContactsHelper.TypeText("PhoneNumber1", "1222121211"); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Click on add phone."); office_ContactsHelper.ClickElement("AddPhone"); office_ContactsHelper.WaitForWorkAround(1000); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Select phone type."); office_ContactsHelper.Select("PhoneType2", "Home"); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Enter phone number."); office_ContactsHelper.TypeText("PhoneNumber2", "1222121211"); office_ContactsHelper.WaitForWorkAround(1000); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Click on radio button primary."); office_ContactsHelper.ClickElement("PrimaryRadio2"); office_ContactsHelper.WaitForWorkAround(1000); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Click on remove icon to remove phone."); office_ContactsHelper.ClickElement("RemovePhone"); office_ContactsHelper.WaitForWorkAround(1000); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Click on Save button."); office_ContactsHelper.ClickElement("SaveContactN"); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Verify alert for primary phone"); office_ContactsHelper.VerifyAlertText("please select a primary phone"); office_ContactsHelper.WaitForWorkAround(1000); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Accept alert message."); office_ContactsHelper.AcceptAlert(); executionLog.Log("ContactPrimaryPhoneAndExistingOverlay", "Verify that no exisitng contact overlay present."); Assert.IsFalse(office_ContactsHelper.IsElementPresent("ExistingContactOverlay")); } catch (Exception e) { executionLog.Log("Error", e.StackTrace); Status = "Fail"; String counter = executionLog.readLastLine("counter"); String Description = executionLog.GetAllTextFile("ContactPrimaryPhoneAndExistingOverlay"); String Error = executionLog.GetAllTextFile("Error"); Console.WriteLine(Error); if (counter == "") { counter = "0"; } bool result = loginHelper.CheckExstingIssue("ContactPrimaryPhoneAndExistingOverlay"); if (!result) { if (Int16.Parse(counter) < 5) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); loginHelper.CreateIssue("ContactPrimaryPhoneAndExistingOverlay", "Bug", "Medium", "Contacts page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error); string id = loginHelper.getIssueID("ContactPrimaryPhoneAndExistingOverlay"); TakeScreenshot("ContactPrimaryPhoneAndExistingOverlay"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\Contact.png"; loginHelper.AddAttachment(location, id); } } else { if (Int16.Parse(counter) < 5) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); TakeScreenshot("ContactPrimaryPhoneAndExistingOverlay"); string id = loginHelper.getIssueID("ContactPrimaryPhoneAndExistingOverlay"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\Contact.png"; loginHelper.AddAttachment(location, id); loginHelper.AddComment(loginHelper.getIssueID("ContactPrimaryPhoneAndExistingOverlay"), "This issue is still occurring"); } } JIRA = loginHelper.getIssueID("ContactPrimaryPhoneAndExistingOverlay"); executionLog.DeleteFile("Error"); throw; } finally { executionLog.DeleteFile("ContactPrimaryPhoneAndExistingOverlay"); executionLog.WriteInExcel("ContactPrimaryPhoneAndExistingOverlay", Status, JIRA, "Contact Management"); } }
public void verifyingContactValidationMessage() { string[] username = null; string[] password = null; var oXMLData = new XMLParse(); oXMLData.LoadXML("../../Config/ApplicationSettings.xml"); // Initializing the objects var executionLog = new ExecutionLog(); var loginHelper = new LoginHelper(GetWebDriver()); var office_ContactsHelper = new Office_ContactsHelper(GetWebDriver()); username = oXMLData.getData("settings/Credentials", "username_office"); password = oXMLData.getData("settings/Credentials", "password"); // Variable var FName = "Test" + RandomNumber(99, 99999); var LName = "Test" + RandomNumber(99, 99999); var CDBA = "NewComp" + RandomNumber(1, 99999); String JIRA = ""; String Status = "Pass"; try { executionLog.Log("VerifyingContactValidationMessage", "Login with valid credential Username"); Login(username[0], password[0]); executionLog.Log("VerifyingContactValidationMessage", "Verify Page title"); VerifyTitle("Dashboard"); Console.WriteLine("Redirected at Dashboard screen."); executionLog.Log("VerifyingContactValidationMessage", "Reditect at contact page."); VisitOffice("contacts"); executionLog.Log("VerifyingContactValidationMessage", "Verify title"); office_ContactsHelper.VerifyText("VerifyContact", "Contacts"); executionLog.Log("VerifyingContactValidationMessage", "Reditect at create contact page."); VisitOffice("contacts/create"); executionLog.Log("VerifyingContactValidationMessage", "First Name"); office_ContactsHelper.TypeText("FirstNAME", FName); executionLog.Log("VerifyingContactValidationMessage", "Last Name"); office_ContactsHelper.TypeText("LastName", LName); executionLog.Log("VerifyingContactValidationMessage", "Company DBA Name"); office_ContactsHelper.TypeText("CompanyName", CDBA); executionLog.Log("VerifyingContactValidationMessage", "Select Eadress type"); office_ContactsHelper.Select("EaddressType", "E-Mail"); executionLog.Log("VerifyingContactValidationMessage", "Enter Eadress"); office_ContactsHelper.TypeText("Eaddress", "*****@*****.**"); executionLog.Log("VerifyingContactValidationMessage", "Cliclk Add email button"); office_ContactsHelper.ClickElement("AddEmail"); executionLog.Log("VerifyingContactValidationMessage", "Select EAddress type"); office_ContactsHelper.Select("EaddressType2", "E-Mail"); executionLog.Log("VerifyingContactValidationMessage", "Enter eAddress"); office_ContactsHelper.TypeText("Eaddress2", "*****@*****.**"); executionLog.Log("VerifyingContactValidationMessage", "Select Second email as primary"); office_ContactsHelper.Click("//input[@name='data[ContactElectronicAddress][1][primary]']"); executionLog.Log("VerifyingContactValidationMessage", "Remove Second Email"); office_ContactsHelper.ClickElement("RemoveEmailIcon"); executionLog.Log("VerifyingContactValidationMessage", "Click on savw button"); office_ContactsHelper.ClickElement("SaveContactN"); office_ContactsHelper.WaitForWorkAround(4000); executionLog.Log("VerifyingContactValidationMessage", "Verify the validation message"); office_ContactsHelper.VerifyAlertText("please select a primary email"); executionLog.Log("VerifyingContactValidationMessage", "Accept alert"); office_ContactsHelper.AcceptAlert(); executionLog.Log("VerifyingContactValidationMessage", " Verify user is redirected to create page"); VerifyTitle("Create a Contact"); } catch (Exception e) { executionLog.Log("Error", e.StackTrace); Status = "Fail"; String counter = executionLog.readLastLine("counter"); String Description = executionLog.GetAllTextFile("VerifyingContactValidationMessage"); String Error = executionLog.GetAllTextFile("Error"); if (counter == "") { counter = "0"; } bool result = loginHelper.CheckExstingIssue("VerifyingContactValidationMessage"); if (!result) { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); loginHelper.CreateIssue("VerifyingContactValidationMessage", "Bug", "Medium", "Create Contact page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error); string id = loginHelper.getIssueID("VerifyingContactValidationMessage"); TakeScreenshot("VerifyingContactValidationMessage"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\VerifyingContactValidationMessage.png"; loginHelper.AddAttachment(location, id); } } else { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); TakeScreenshot("VerifyingContactValidationMessage"); string id = loginHelper.getIssueID("VerifyingContactValidationMessage"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\VerifyingContactValidationMessage.png"; loginHelper.AddAttachment(location, id); loginHelper.AddComment(loginHelper.getIssueID("VerifyingContactValidationMessage"), "This issue is still occurring"); } } JIRA = loginHelper.getIssueID("VerifyingContactValidationMessage"); // executionLog.DeleteFile("Error"); throw; } finally { executionLog.DeleteFile("VerifyingContactValidationMessage"); executionLog.WriteInExcel("VerifyingContactValidationMessage", Status, JIRA, "Contact Management"); } }