public void opportunitiesValidateForExe() { string[] username = null; string[] password = null; var oXMLData = new XMLParse(); oXMLData.LoadXML("../../Config/ApplicationSettings.xml"); username = oXMLData.getData("settings/Credentials", "username_office"); password = oXMLData.getData("settings/Credentials", "password"); // Initializing the objects var executionLog = new ExecutionLog(); var loginHelper = new LoginHelper(GetWebDriver()); var office_OpportunitiesHelper = new Office_OpportunitiesHelper(GetWebDriver()); // Variable var DocName = "Test Exe" + GetRandomNumber(); var fileUpl = GetPathToFile() + "chrome.exe"; String JIRA = ""; String Status = "Pass"; try { executionLog.Log("OpportunitiesValidateForExe", "Login with valid username and password"); Login(username[0], password[0]); Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]); executionLog.Log("OpportunitiesValidateForExe", "Verify Page title"); VerifyTitle("Dashboard"); Console.WriteLine("Redirected at Dashboard screen."); executionLog.Log("OpportunitiesValidateForExe", "Redirect To URL"); VisitOffice("opportunities"); office_OpportunitiesHelper.WaitForWorkAround(5000); executionLog.Log("OpportunitiesValidateForExe", "Click On Task Edit"); office_OpportunitiesHelper.ClickElement("ClickOnTaskEdit"); office_OpportunitiesHelper.WaitForWorkAround(1000); executionLog.Log("OpportunitiesValidateForExe", "Click On Add Document"); office_OpportunitiesHelper.ClickElement("ClickOnAddDocument"); office_OpportunitiesHelper.WaitForWorkAround(1000); executionLog.Log("OpportunitiesValidateForExe", "Enter Document Name"); office_OpportunitiesHelper.TypeText("EnterDocumentName", DocName); executionLog.Log("OpportunitiesValidateForExe", "Browse Doc"); office_OpportunitiesHelper.Upload("BrowseDoc", fileUpl); office_OpportunitiesHelper.WaitForWorkAround(3000); executionLog.Log("OpportunitiesValidateForExe", "Click Save Of Doc PopUp"); office_OpportunitiesHelper.ClickDisplayed("//a[text()='Save']"); office_OpportunitiesHelper.WaitForWorkAround(1000); executionLog.Log("OpportunitiesValidateForExe", "Wait for validation mesage."); office_OpportunitiesHelper.WaitForText("This field is required.", 10); office_OpportunitiesHelper.WaitForWorkAround(3000); } catch (Exception e) { executionLog.Log("Error", e.StackTrace); Status = "Fail"; String counter = executionLog.readLastLine("counter"); String Description = executionLog.GetAllTextFile("OpportunitiesValidateForExe"); String Error = executionLog.GetAllTextFile("Error"); Console.WriteLine(Error); if (counter == "") { counter = "0"; } bool result = loginHelper.CheckExstingIssue("Opportunities Validate For Exe"); if (!result) { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); loginHelper.CreateIssue("Opportunities Validate For Exe", "Bug", "Medium", "Opportunities page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error); string id = loginHelper.getIssueID("Opportunities Validate For Exe"); TakeScreenshot("OpportunitiesValidateForExe"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\OpportunitiesValidateForExe.png"; loginHelper.AddAttachment(location, id); } } else { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); TakeScreenshot("OpportunitiesValidateForExe"); string id = loginHelper.getIssueID("Opportunities Validate For Exe"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\OpportunitiesValidateForExe.png"; loginHelper.AddAttachment(location, id); loginHelper.AddComment(loginHelper.getIssueID("Opportunities Validate For Exe"), "This issue is still occurring"); } } JIRA = loginHelper.getIssueID("Opportunities Validate For Exe"); // executionLog.DeleteFile("Error"); throw; } finally { executionLog.DeleteFile("OpportunitiesValidateForExe"); executionLog.WriteInExcel("Opportunities Validate For Exe", Status, JIRA, "Opportunities Management"); } }
public void bulkUpdateSalesManagerForOpportunities() { string[] username = null; string[] password = null; var oXMLData = new XMLParse(); oXMLData.LoadXML("../../Config/ApplicationSettings.xml"); username = oXMLData.getData("settings/Credentials", "username_office"); password = oXMLData.getData("settings/Credentials", "password"); // Initializing the objects var executionLog = new ExecutionLog(); var loginHelper = new LoginHelper(GetWebDriver()); var office_OpportunitiesHelper = new Office_OpportunitiesHelper(GetWebDriver()); // Variable var FirstName = "Test" + GetRandomNumber(); var LastName = "Tester" + GetRandomNumber(); var Number = "12345678" + GetRandomNumber(); String JIRA = ""; String Status = "Pass"; try { executionLog.Log("BulkUpdateSalesManagerForOpportunities", "Login with valid username and password"); Login(username[0], password[0]); Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]); executionLog.Log("BulkUpdateSalesManagerForOpportunities", "Verify Page title"); VerifyTitle("Dashboard"); office_OpportunitiesHelper.WaitForWorkAround(2000); executionLog.Log("BulkUpdateSalesManagerForOpportunities", "Visit opportunities page."); VisitOffice("opportunities"); office_OpportunitiesHelper.WaitForWorkAround(2000); executionLog.Log("BulkUpdateSalesManagerForOpportunities", "Verify page title.."); VerifyTitle("Opportunities"); office_OpportunitiesHelper.WaitForWorkAround(2000); executionLog.Log("BulkUpdateSalesManagerForOpportunities", "Click On first Check Box"); office_OpportunitiesHelper.ClickElement("CheckboxOpportunity"); office_OpportunitiesHelper.WaitForWorkAround(2000); executionLog.Log("BulkUpdateSalesManagerForOpportunities", "Click On Bulk Update"); office_OpportunitiesHelper.ClickElement("ClickOnBulkUpdate"); office_OpportunitiesHelper.WaitForWorkAround(2000); executionLog.Log("BulkUpdateSalesManagerForOpportunities", "Change Sale Manager"); office_OpportunitiesHelper.ClickElement("ChangeSaleManager"); office_OpportunitiesHelper.WaitForWorkAround(2000); executionLog.Log("BulkUpdateSalesManagerForOpportunities", "Select Sales Manager"); office_OpportunitiesHelper.SelectDropDownByText("//*[@id='OpportunitySalesManagerUpdateSalesManagerId']", "Howard Tang"); office_OpportunitiesHelper.WaitForWorkAround(2000); executionLog.Log("BulkUpdateSalesManagerForOpportunities", "Click on Update button"); office_OpportunitiesHelper.ClickDisplayed("//button[text()='Update']"); office_OpportunitiesHelper.WaitForWorkAround(2000); executionLog.Log("BulkUpdateSalesManagerForOpportunities", "Accept alert message."); office_OpportunitiesHelper.AcceptAlert(); office_OpportunitiesHelper.WaitForWorkAround(2000); executionLog.Log("BulkUpdateSalesManagerForOpportunities", "Wait for success message."); office_OpportunitiesHelper.WaitForText("records updated successfully", 30); } catch (Exception e) { executionLog.Log("Error", e.StackTrace); Status = "Fail"; String counter = executionLog.readLastLine("counter"); String Description = executionLog.GetAllTextFile("BulkUpdateSalesManagerForOpportunities"); String Error = executionLog.GetAllTextFile("Error"); Console.WriteLine(Error); if (counter == "") { counter = "0"; } bool result = loginHelper.CheckExstingIssue("Bulk Update Sales Manager For Opportunities"); if (!result) { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); loginHelper.CreateIssue("Bulk Update Sales Manager For Opportunities", "Bug", "Medium", "Opportunities page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error); string id = loginHelper.getIssueID("Bulk Update Sales Manager For Opportunities"); TakeScreenshot("BulkUpdateSalesManagerForOpportunities"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\BulkUpdateSalesManagerForOpportunities.png"; loginHelper.AddAttachment(location, id); } } else { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); TakeScreenshot("BulkUpdateSalesManagerForOpportunities"); string id = loginHelper.getIssueID("Bulk Update Sales Manager For Opportunities"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\BulkUpdateSalesManagerForOpportunities.png"; loginHelper.AddAttachment(location, id); loginHelper.AddComment(loginHelper.getIssueID("Bulk Update Sales Manager For Opportunities"), "This issue is still occurring"); } } JIRA = loginHelper.getIssueID("Bulk Update Sales Manager For Opportunities"); // executionLog.DeleteFile("Error"); throw; } finally { executionLog.DeleteFile("BulkUpdateSalesManagerForOpportunities"); executionLog.WriteInExcel("Bulk Update Sales Manager For Opportunities", Status, JIRA, "Opportunities Management"); } }