public void officeUserExportToCSV() { string[] username1 = null; string[] password1 = null; var oXMLData = new XMLParse(); oXMLData.LoadXML("../../Config/ApplicationSettings.xml"); // Initializing the objects var executionLog = new ExecutionLog(); var loginHelper = new LoginHelper(GetWebDriver()); var corpOffices_UsersHelper = new CorpOffices_UsersHelper(GetWebDriver()); username1 = oXMLData.getData("settings/Credentials", "username_corp"); password1 = oXMLData.getData("settings/Credentials", "password"); String JIRA = ""; String Status = "Pass"; try { executionLog.Log("OfficeUserExportToCSV", "Login with valid username and password"); Login(username1[0], password1[0]); executionLog.Log("OfficeUserExportToCSV", "Verify Page title"); VerifyTitle("Dashboard"); Console.WriteLine("Redirected at Dashboard screen."); executionLog.Log("OfficeUserExportToCSV", "Redirect to Office"); VisitCorp("allusers"); executionLog.Log("OfficeUserExportToCSV", "Verify Page title"); VerifyTitle("All Users"); executionLog.Log("OfficeUserExportToCSV", "Click on Export"); corpOffices_UsersHelper.ClickElement("ClickOnExport"); corpOffices_UsersHelper.WaitForWorkAround(2000); executionLog.Log("OfficeUserExportToCSV", "Click on Export TO CSV"); corpOffices_UsersHelper.ClickElement("ExportToCSV"); } catch (Exception e) { executionLog.Log("Error", e.StackTrace); Status = "Fail"; String counter = executionLog.readLastLine("counter"); String Description = executionLog.GetAllTextFile("OfficeUserExportToCSV"); String Error = executionLog.GetAllTextFile("Error"); Console.WriteLine(Error); if (counter == "") { counter = "0"; } bool result = loginHelper.CheckExstingIssue("Office User Export To CSV"); if (!result) { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); loginHelper.CreateIssue("Office User Export To CSV", "Bug", "Medium", "All User page", "QA", "Log in as: " + username1[0] + " / " + password1[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error); string id = loginHelper.getIssueID("Office User Export To CSV"); TakeScreenshot("OfficeUserExportToCSV"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\OfficeUserExportToCSV.png"; loginHelper.AddAttachment(location, id); } } else { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); TakeScreenshot("OfficeUserExportToCSV"); string id = loginHelper.getIssueID("Office User Export To CSV"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\OfficeUserExportToCSV.png"; loginHelper.AddAttachment(location, id); loginHelper.AddComment(loginHelper.getIssueID("Office User Export To CSV"), "This issue is still occurring"); } } JIRA = loginHelper.getIssueID("Office User Export To CSV"); // executionLog.DeleteFile("Error"); throw; } finally { executionLog.DeleteFile("OfficeUserExportToCSV"); executionLog.WriteInExcel("Office User Export To CSV", Status, JIRA, "Corp Office"); } }
public void allUserPageInCorp() { string[] username = null; string[] password = null; var oXMLData = new XMLParse(); oXMLData.LoadXML("../../Config/ApplicationSettings.xml"); username = oXMLData.getData("settings/Credentials", "username_corp"); password = oXMLData.getData("settings/Credentials", "password"); // Initializing the objects var executionLog = new ExecutionLog(); var loginHelper = new LoginHelper(GetWebDriver()); var corpOffices_UsersHelper = new CorpOffices_UsersHelper(GetWebDriver()); // Variable random var name = "TESTCLIENT" + RandomNumber(1, 999); String JIRA = ""; String Status = "Pass"; try { executionLog.Log("AllUserPageInCorp", "Login with valid username and password"); Login(username[0], password[0]); executionLog.Log("AllUserPageInCorp", "Verify Page title"); VerifyTitle("Dashboard"); executionLog.Log("AllUserPageInCorp", "Redirect at all users page."); VisitCorp("allusers"); executionLog.Log("AllUserPageInCorp", "Select User Type"); corpOffices_UsersHelper.Select("UserType", "Employee"); corpOffices_UsersHelper.WaitForWorkAround(3000); executionLog.Log("AllUserPageInCorp", "Select User Type"); corpOffices_UsersHelper.Select("UserType", "1099 Sales Agent"); corpOffices_UsersHelper.WaitForWorkAround(3000); executionLog.Log("AllUserPageInCorp", "Select User Type"); corpOffices_UsersHelper.Select("UserType", "Client"); corpOffices_UsersHelper.WaitForWorkAround(3000); executionLog.Log("AllUserPageInCorp", "Select User Type"); corpOffices_UsersHelper.Select("UserType", "Partner"); corpOffices_UsersHelper.WaitForWorkAround(3000); } catch (Exception e) { executionLog.Log("Error", e.StackTrace); Status = "Fail"; String counter = executionLog.readLastLine("counter"); String Description = executionLog.GetAllTextFile("AllUserPageInCorp"); String Error = executionLog.GetAllTextFile("Error"); if (counter == "") { counter = "0"; } bool result = loginHelper.CheckExstingIssue("All User Page In Corp"); if (!result) { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); loginHelper.CreateIssue("All User Page In Corp", "Bug", "Medium", "All User page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error); string id = loginHelper.getIssueID("All User Page In Corp"); TakeScreenshot("AllUserPageInCorp"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\AllUserPageInCorp.png"; loginHelper.AddAttachment(location, id); } } else { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); TakeScreenshot("AllUserPageInCorp"); string id = loginHelper.getIssueID("All User Page In Corp"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\AllUserPageInCorp.png"; loginHelper.AddAttachment(location, id); loginHelper.AddComment(loginHelper.getIssueID("All User Page In Corp"), "This issue is still occurring"); } } JIRA = loginHelper.getIssueID("All User Page In Corp"); // executionLog.DeleteFile("Error"); throw; } finally { executionLog.DeleteFile("AllUserPageInCorp"); executionLog.WriteInExcel("All User Page In Corp", Status, JIRA, "Corp Users"); } }