public void createTopicTickets() { 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 tickets_MasterDataHelper = new Tickets_MasterDataHelper(GetWebDriver()); // Variable var name = "Topic" + RandomNumber(1, 99); String JIRA = ""; String Status = "Pass"; try { executionLog.Log("CreateTopicTickets", "Login with valid username and password"); Login(username[0], password[0]); Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]); executionLog.Log("CreateTopicTickets", "Verify Page title"); VerifyTitle("Dashboard"); executionLog.Log("CreateTopicTickets", "Redirect To Ticket"); VisitOffice("tickets/masterdata/topic"); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("CreateTopicTickets", "Verify title"); VerifyTitle("Master Data"); executionLog.Log("CreateTopicTickets", " Click On Create"); tickets_MasterDataHelper.ClickElement("Create"); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("CreateTopicTickets", "Verify title"); VerifyTitle("Create"); executionLog.Log("CreateTopicTickets", "Enter Name"); tickets_MasterDataHelper.TypeText("Name", name); executionLog.Log("CreateTopicTickets", "cLICK on Save "); tickets_MasterDataHelper.ClickElement("Save"); tickets_MasterDataHelper.WaitForWorkAround(2000); executionLog.Log("CreateTopicTickets", "Wait for Confirmation"); tickets_MasterDataHelper.WaitForText("Masterdata created successfully", 10); executionLog.Log("CreateTopicTickets", "Click on delete item."); tickets_MasterDataHelper.ClickElement("DeleteItem"); tickets_MasterDataHelper.WaitForWorkAround(2000); executionLog.Log("CreateTopicTickets", "Click on category to be deleted"); tickets_MasterDataHelper.DeleteCategory(name); //tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("CreateTopicTickets", "Select value to be replace with"); tickets_MasterDataHelper.SelectByText("ReplaceWith", "Other"); executionLog.Log("CreateTopicTickets", "Confirm delete by clicking save."); tickets_MasterDataHelper.ClickElement("SaveDelete"); tickets_MasterDataHelper.AcceptAlert(); tickets_MasterDataHelper.WaitForWorkAround(3000); } catch (Exception e) { executionLog.Log("Error", e.StackTrace); Status = "Fail"; String counter = executionLog.readLastLine("counter"); String Description = executionLog.GetAllTextFile("CreateTopicTickets"); String Error = executionLog.GetAllTextFile("Error"); Console.WriteLine(Error); if (counter == "") { counter = "0"; } bool result = loginHelper.CheckExstingIssue("Create Topic Tickets"); if (!result) { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); loginHelper.CreateIssue("Create Topic Tickets", "Bug", "Medium", "Ticket page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error); string id = loginHelper.getIssueID("Create Topic Tickets"); TakeScreenshot("CreateTopicTickets"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\CreateTopicTickets.png"; loginHelper.AddAttachment(location, id); } } else { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); TakeScreenshot("CreateTopicTickets"); string id = loginHelper.getIssueID("Create Topic Tickets"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\CreateTopicTickets.png"; loginHelper.AddAttachment(location, id); loginHelper.AddComment(loginHelper.getIssueID("Create Topic Tickets"), "This issue is still occurring"); } } JIRA = loginHelper.getIssueID("Create Topic Tickets"); // executionLog.DeleteFile("Error"); throw; } finally { executionLog.DeleteFile("CreateTopicTickets"); executionLog.WriteInExcel("Create Topic Tickets", Status, JIRA, "Ticket Admin"); } }
public void verifyAdminTicketMasterDeleteConfirmation() { string[] username = null; string[] password = null; XMLParse 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 tickets_MasterDataHelper = new Tickets_MasterDataHelper(GetWebDriver()); // Random variables var Ticket = "Ticket" + RandomNumber(111, 9999); String JIRA = ""; String Status = "Pass"; try { executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Login with valid username and password"); Login(username[0], password[0]); Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Verify Page title"); VerifyTitle("Dashboard"); Console.WriteLine("Redirected at Dashboard screen."); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Redirect at ticket topic page."); VisitOffice("tickets/masterdata/category"); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on create button"); tickets_MasterDataHelper.ClickElement("Create"); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Enter topic name"); tickets_MasterDataHelper.TypeText("Name", Ticket); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on Save button."); tickets_MasterDataHelper.ClickElement("Save"); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Wait for creation success text."); tickets_MasterDataHelper.WaitForText("Masterdata created successfully", 10); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on delete item button."); tickets_MasterDataHelper.ClickElement("DeleteItem"); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Select topic to be deleted."); tickets_MasterDataHelper.SelectByText("Select", Ticket); //tickets_MasterDataHelper.WaitForWorkAround(4000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "select value to be replaced."); tickets_MasterDataHelper.SelectByText("ReplaceWith", "Billing"); //tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on save button and accept alert."); tickets_MasterDataHelper.ClickElement("SaveDelete"); tickets_MasterDataHelper.AcceptAlert(); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Wait for item deletion text."); tickets_MasterDataHelper.VerifyPageText("Category deleted successfully."); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Redirect at ticket topic page."); VisitOffice("tickets/masterdata/topic"); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on create button"); tickets_MasterDataHelper.ClickElement("Create"); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Enter topic name"); tickets_MasterDataHelper.TypeText("Name", Ticket); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on Save button."); tickets_MasterDataHelper.ClickElement("Save"); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Wait for creation success text."); tickets_MasterDataHelper.WaitForText("Masterdata created successfully", 10); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on delete item button."); tickets_MasterDataHelper.ClickElement("DeleteItem"); tickets_MasterDataHelper.WaitForWorkAround(2000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Select topic to be deleted."); tickets_MasterDataHelper.SelectByText("Select", Ticket); //tickets_MasterDataHelper.WaitForWorkAround(2000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "select value to be replaced."); tickets_MasterDataHelper.SelectByText("ReplaceWith", "Test"); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on save button and accept alert."); tickets_MasterDataHelper.ClickElement("SaveDelete"); tickets_MasterDataHelper.AcceptAlert(); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Wait for itm deletion text."); tickets_MasterDataHelper.WaitForText("Topic deleted successfully.", 10); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Redirect at ticket topic page."); VisitOffice("tickets/masterdata/status"); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on create button"); tickets_MasterDataHelper.ClickElement("Create"); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Enter topic name"); tickets_MasterDataHelper.TypeText("Name", Ticket); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on Save button."); tickets_MasterDataHelper.ClickElement("Save"); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Wait for creation success text."); tickets_MasterDataHelper.WaitForText("Masterdata created successfully", 10); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on delete item button."); tickets_MasterDataHelper.ClickElement("DeleteItem"); tickets_MasterDataHelper.WaitForWorkAround(2000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Select topic to be deleted."); tickets_MasterDataHelper.SelectByText("Select", Ticket); //tickets_MasterDataHelper.WaitForWorkAround(2000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "select value to be replaced."); tickets_MasterDataHelper.SelectByText("ReplaceWith", "New"); //tickets_MasterDataHelper.WaitForWorkAround(2000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on save button and accept alert."); tickets_MasterDataHelper.ClickElement("SaveDelete"); tickets_MasterDataHelper.AcceptAlert(); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Wait for itm deletion text."); tickets_MasterDataHelper.WaitForText("Status deleted successfully.", 10); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Redirect at ticket topic page."); VisitOffice("tickets/masterdata/priority"); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on create button"); tickets_MasterDataHelper.ClickElement("Create"); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Enter topic name"); tickets_MasterDataHelper.TypeText("Name", Ticket); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on Save button."); tickets_MasterDataHelper.ClickElement("Save"); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Wait for creation success text."); tickets_MasterDataHelper.WaitForText("Masterdata created successfully", 10); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on delete item button."); tickets_MasterDataHelper.ClickElement("DeleteItem"); tickets_MasterDataHelper.WaitForWorkAround(2000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Select topic to be deleted."); tickets_MasterDataHelper.SelectByText("Select", Ticket); //tickets_MasterDataHelper.WaitForWorkAround(2000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "select value to be replaced."); tickets_MasterDataHelper.SelectByText("ReplaceWith", "Medium"); //tickets_MasterDataHelper.WaitForWorkAround(2000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on save button and accept alert."); tickets_MasterDataHelper.ClickElement("SaveDelete"); tickets_MasterDataHelper.AcceptAlert(); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Wait for itm deletion text."); tickets_MasterDataHelper.WaitForText("Priority deleted successfully.", 10); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Redirect at ticket topic page."); VisitOffice("tickets/masterdata/resolution"); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on create button"); tickets_MasterDataHelper.ClickElement("Create"); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Enter topic name"); tickets_MasterDataHelper.TypeText("Name", Ticket); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on Save button."); tickets_MasterDataHelper.ClickElement("Save"); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Wait for creation success text."); tickets_MasterDataHelper.WaitForText("Masterdata created successfully", 10); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on delete item button."); tickets_MasterDataHelper.ClickElement("DeleteItem"); tickets_MasterDataHelper.WaitForWorkAround(2000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Select topic to be deleted."); tickets_MasterDataHelper.SelectByText("Select", Ticket); //tickets_MasterDataHelper.WaitForWorkAround(2000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "select value to be replaced."); tickets_MasterDataHelper.SelectByText("ReplaceWith", "Resolved"); //tickets_MasterDataHelper.WaitForWorkAround(2000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on save button and accept alert."); tickets_MasterDataHelper.ClickElement("SaveDelete"); tickets_MasterDataHelper.AcceptAlert(); tickets_MasterDataHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Wait for itm deletion text."); tickets_MasterDataHelper.WaitForText("Resolution deleted successfully.", 10); executionLog.Log("VerifyAdminTicketMasterDeleteConfirmation", "Click on Cancel button."); VisitOffice("logout"); } catch (Exception e) { executionLog.Log("Error", e.StackTrace); Status = "Fail"; String counter = executionLog.readLastLine("counter"); String Description = executionLog.GetAllTextFile("VerifyAdminTicketMasterDeleteConfirmation"); String Error = executionLog.GetAllTextFile("Error"); if (counter == "") { counter = "0"; } bool result = loginHelper.CheckExstingIssue("Verify Admin Ticket Master Delete Confirmation"); if (!result) { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); loginHelper.CreateIssue("Verify Admin Ticket Master Delete Confirmation", "Bug", "Medium", "Ticket Admin page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error); string id = loginHelper.getIssueID("Verify Admin Ticket Master Delete Confirmation"); TakeScreenshot("VerifyAdminTicketMasterDeleteConfirmation"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\VerifyAdminTicketMasterDeleteConfirmation.png"; loginHelper.AddAttachment(location, id); } } else { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); TakeScreenshot("VerifyAdminTicketMasterDeleteConfirmation"); string id = loginHelper.getIssueID("Verify Admin Ticket Master Delete Confirmation"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\VerifyAdminTicketMasterDeleteConfirmation.png"; loginHelper.AddAttachment(location, id); loginHelper.AddComment(loginHelper.getIssueID("Verify Admin Ticket Master Delete Confirmation"), "This issue is still occurring"); } } JIRA = loginHelper.getIssueID("Verify Admin Ticket Master Delete Confirmation"); // executionLog.DeleteFile("Error"); throw; } finally { executionLog.DeleteFile("VerifyAdminTicketMasterDeleteConfirmation"); executionLog.WriteInExcel("Verify Admin Ticket Master Delete Confirmation", Status, JIRA, "Admin Tickets"); } }