Exemplo n.º 1
0
        public void dashboard()
        {
            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 dashBoard_CreateDashboardHelper = new DashBoard_CreateDashboardHelper(GetWebDriver());

            username = oXMLData.getData("settings/Credentials", "username_office");
            password = oXMLData.getData("settings/Credentials", "password");

            // Variable
            var    DashBoard = "Dash" + RandomNumber(99, 99999);
            var    LName     = "Test" + RandomNumber(99, 99999);
            var    CDBA      = "New" + RandomNumber(99, 99999);
            String JIRA      = "";
            String Status    = "Pass";

            try
            {
                executionLog.Log("Dashboard", "Login with valid credential  Username");
                Login(username[0], password[0]);

                executionLog.Log("Dashboard", "Verify Page title");
                VerifyTitle("Dashboard");
                Console.WriteLine("Redirected at Dashboard screen.");

                executionLog.Log("Dashboard", "Goto Create Dashboard");
                VisitOffice("dashboards/create");

                executionLog.Log("Dashboard", "Enter Dashboard Name");
                dashBoard_CreateDashboardHelper.TypeText("EnterDashboardName", DashBoard);

                executionLog.Log("Dashboard", "Click on Report Dashlest");
                dashBoard_CreateDashboardHelper.ClickElement("ClientReportDashlest");
                dashBoard_CreateDashboardHelper.WaitForWorkAround(1000);

                executionLog.Log("Dashboard", "Click Next Button");
                dashBoard_CreateDashboardHelper.ClickElement("ClickNextButton");
                dashBoard_CreateDashboardHelper.WaitForWorkAround(3000);

                executionLog.Log("Dashboard", "Save Dashboard");
                dashBoard_CreateDashboardHelper.ClickElement("ClickDashboardSaveBtn");
                dashBoard_CreateDashboardHelper.WaitForWorkAround(3000);

                executionLog.Log("Dashboard", "Goto Dashboard");
                VisitOffice("dashboards");

                executionLog.Log("Dashboard", "Search Name");
                dashBoard_CreateDashboardHelper.TypeText("SearchDeshboard", DashBoard);
                dashBoard_CreateDashboardHelper.selectOwner("//*[@name='owner']");
                dashBoard_CreateDashboardHelper.WaitForWorkAround(3000);

                executionLog.Log("Dashboard", "Click on Edit Dashboard");
                dashBoard_CreateDashboardHelper.ClickElement("ClickOnEditDashboard");
                dashBoard_CreateDashboardHelper.WaitForWorkAround(1000);

                executionLog.Log("Dashboard", "Click on Cancel button.");
                dashBoard_CreateDashboardHelper.ClickElement("ClickCancelDasEdit");
                dashBoard_CreateDashboardHelper.WaitForWorkAround(1000);

                executionLog.Log("Dashboard", "Dashboard Verify");
                dashBoard_CreateDashboardHelper.VerifyText("VerifyTextDeshboard", "Dashboards");
                dashBoard_CreateDashboardHelper.WaitForWorkAround(1000);

                executionLog.Log("Dashboard", "Goto Dashbord");
                VisitOffice("dashboards");

                executionLog.Log("Dashboard", "Search Dashboard");
                dashBoard_CreateDashboardHelper.TypeText("SearchDeshboard", DashBoard);
                dashBoard_CreateDashboardHelper.selectOwner("//*[@name='owner']");
                dashBoard_CreateDashboardHelper.WaitForWorkAround(3000);

                executionLog.Log("Dashboard", "Click on Edit");
                dashBoard_CreateDashboardHelper.ClickElement("ClickOnEditDashboard");
                dashBoard_CreateDashboardHelper.WaitForWorkAround(1000);

                executionLog.Log("Dashboard", "Click on Next");
                dashBoard_CreateDashboardHelper.ClickElement("ClickNextButton");
                dashBoard_CreateDashboardHelper.WaitForWorkAround(3000);

                executionLog.Log("Dashboard", "Click  on Save Dashboard");
                dashBoard_CreateDashboardHelper.ClickElement("ClickDashboardSaveBtn");
                dashBoard_CreateDashboardHelper.WaitForWorkAround(3000);

                executionLog.Log("Dashboard", "Goto Dashboard");
                VisitOffice("dashboards");

                executionLog.Log("Dashboard", "Search Dashboard");
                dashBoard_CreateDashboardHelper.TypeText("SearchDeshboard", DashBoard);
                dashBoard_CreateDashboardHelper.selectOwner("//*[@name='owner']");
                dashBoard_CreateDashboardHelper.WaitForWorkAround(3000);

                executionLog.Log("Dashboard", "Delete Dashboard");
                dashBoard_CreateDashboardHelper.ClickElement("ClickDeleteDashboard");
                dashBoard_CreateDashboardHelper.AcceptAlert();

                executionLog.Log("Dashboard", "Wait for confirmation.");
                dashBoard_CreateDashboardHelper.WaitForText("Dashboard deleted successfully.", 10);

                executionLog.Log("Dashboard", "Goto Dashbord");
                VisitOffice("dashboards");

                executionLog.Log("Dashboard", "Click on dashboard.");
                dashBoard_CreateDashboardHelper.ClickElement("ClickOnDashBoard");
                dashBoard_CreateDashboardHelper.WaitForWorkAround(1000);

                executionLog.Log("Dashboard", "Click on Edit Icon");
                dashBoard_CreateDashboardHelper.ClickElement("ClickEditDashboardButton");
                dashBoard_CreateDashboardHelper.WaitForWorkAround(1000);

                executionLog.Log("Dashboard", "Click on Next");
                dashBoard_CreateDashboardHelper.ClickElement("ClickNextButton");
                dashBoard_CreateDashboardHelper.WaitForWorkAround(3000);

                executionLog.Log("Dashboard", "Save Dashboard");
                dashBoard_CreateDashboardHelper.ClickElement("ClickDashboardSaveBtn");
                dashBoard_CreateDashboardHelper.WaitForWorkAround(3000);
            }



            catch
            (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("Dashboard");
                String Error       = executionLog.GetAllTextFile("Error");
                Console.WriteLine(Error);
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Dashboard");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Dashboard", "Bug", "Medium", "Dashboard page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Dashboard");
                        TakeScreenshot("Dashboard");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\Dashboard.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("Dashboard");
                        string id            = loginHelper.getIssueID("Dashboard");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\Dashboard.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Dashboard"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Dashboard");
                // executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("Dashboard");
                executionLog.WriteInExcel("Dashboard", Status, JIRA, "Office Reports&DashBoards");
            }
        }
Exemplo n.º 2
0
        public void createDashboardNext()
        {
            string[] username = null;
            string[] password = null;
            string[] log      = null;
            var      oXMLData = new XMLParse();

            oXMLData.LoadXML("../../Config/ApplicationSettings.xml");

            username = oXMLData.getData("settings/Credentials", "username_office");
            password = oXMLData.getData("settings/Credentials", "password");
            log      = oXMLData.getData("settings/URL", "logout");

            // Initializing the objects
            var    executionLog = new ExecutionLog();
            var    loginHelper  = new LoginHelper(GetWebDriver());
            var    dashBoard_CreateDashboardHelper = new DashBoard_CreateDashboardHelper(GetWebDriver());
            String JIRA   = "";
            String Status = "Pass";

            try
            {
                executionLog.Log("CreateDashboardNext", "Login with valid username and password");
                Login(username[0], password[0]);
                Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]);

                executionLog.Log("CreateDashboardNext", "Verify Page title");
                VerifyTitle("Dashboard");
                Console.WriteLine("Redirected at Dashboard screen.");

                executionLog.Log("CreateDashboardNext", "Go to Create Dashboard page");
                VisitOffice("dashboards/create");

                executionLog.Log("CreateDashboardNext", "Verify title");
                VerifyTitle("Dashboards");

                executionLog.Log("CreateDashboardNext", "Click on Next button");
                dashBoard_CreateDashboardHelper.ClickElement("Next");

                executionLog.Log("CreateDashboardNext", "Accept alert message.");
                dashBoard_CreateDashboardHelper.AcceptAlert();

                executionLog.Log("CreateDashboardNext", "Wait for alert message.");
                dashBoard_CreateDashboardHelper.WaitForText("This field is required.", 10);

                executionLog.Log("CreateDashboardNext", "Log out from the application");
                VisitOffice("logout");
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("CreateDashboardNext");
                String Error       = executionLog.GetAllTextFile("Error");
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Create Dashboard Next");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Create Dashboard Next", "Bug", "Medium", "User page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Create Dashboard Next");
                        TakeScreenshot("CreateDashboardNext");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\CreateDashboardNext.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("CreateDashboardNext");
                        string id            = loginHelper.getIssueID("Create Dashboard Next");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\CreateDashboardNext.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Create Dashboard Next"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Create Dashboard Next");
                //     executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("CreateDashboardNext");
                executionLog.WriteInExcel("Create Dashboard Next", Status, JIRA, "Dashboards");
            }
        }
Exemplo n.º 3
0
        public void editOfficeDetail()
        {
            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 office_Admin_DashboardHelper = new DashBoard_CreateDashboardHelper(GetWebDriver());

            String JIRA   = "";
            String Status = "Pass";

            try
            {
                executionLog.Log("EditOfficeDetail", "Login with valid username and password");
                Login(username[0], password[0]);
                Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]);

                executionLog.Log("EditOfficeDetail", "Verify Page title");
                VerifyTitle("Dashboard");
                Console.WriteLine("Redirected at Dashboard screen.");

                executionLog.Log("EditOfficeDetail", "Visit admin page");
                VisitOffice("admin");
                office_Admin_DashboardHelper.WaitForWorkAround(1000);

                executionLog.Log("EditOfficeDetail", "Click on Edit Office details button");
                office_Admin_DashboardHelper.ClickElement("ClickOnEditOfficeCode");
                office_Admin_DashboardHelper.WaitForWorkAround(1000);

                executionLog.Log("EditOfficeDetail", "Click on Save button");
                office_Admin_DashboardHelper.ClickElement("SaveDashboard");

                executionLog.Log("EditOfficeDetail", "Verify Confirmation");
                office_Admin_DashboardHelper.WaitForText("Office codes updated successfully.", 10);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("EditOfficeDetail");
                String Error       = executionLog.GetAllTextFile("Error");
                Console.WriteLine(Error);
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Edit Office Detail");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Client Addresses", "Bug", "Medium", "Client page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Edit Office Detail");
                        TakeScreenshot("EditOfficeDetail");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\EditOfficeDetail.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("EditOfficeDetail");
                        string id            = loginHelper.getIssueID("Edit Office Detail");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\ClientAddresses.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Edit Office Detail"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Edit Office Detail");
                //    executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("EditOfficeDetail");
                executionLog.WriteInExcel("Edit Office Detail", Status, JIRA, "Client Management");
            }
        }