Example #1
0
        public void cloneEquipment()
        {
            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 eqiupment_EquipmentHelper = new Eqiupment_EquipmentHelper(GetWebDriver());

            // Variable
            var    name   = "Test" + GetRandomNumber();
            var    Id     = "12345" + GetRandomNumber();
            String JIRA   = "";
            String Status = "Pass";

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

                executionLog.Log("CloneEquipment", "Login with valid username and password");
                VerifyTitle("Dashboard");

                executionLog.Log("CloneEquipment", "Visit equipment page.");
                VisitOffice("equipment");

                executionLog.Log("CloneEquipment", "Verify page title.");
                VerifyTitle("Equipment");

                var Loc = "//table[@id='list1']/tbody/tr[2]";
                if (eqiupment_EquipmentHelper.IsElementPresent(Loc))
                {
                    executionLog.Log("CloneEquipment", "Click On Equipment");
                    eqiupment_EquipmentHelper.ClickElement("ClickOneQUIP");

                    executionLog.Log("CloneEquipment", "Click On Clone");
                    eqiupment_EquipmentHelper.ClickElement("ClickOnClone");
                    eqiupment_EquipmentHelper.WaitForWorkAround(2000);

                    executionLog.Log("CloneEquipment", "Verify Confirmation");
                    eqiupment_EquipmentHelper.VerifyPageText("Equipment is cloned successfully");

                    executionLog.Log("CloneEquipment", "Click on delete Clone");
                    eqiupment_EquipmentHelper.ClickElement("ClickDelClone");

                    executionLog.Log("CloneEquipment", "Accept alert message.");
                    eqiupment_EquipmentHelper.AcceptAlert();

                    executionLog.Log("CloneEquipment", "Wait for delete success message.");
                    eqiupment_EquipmentHelper.WaitForText("Equipment deleted successfully.", 30);
                }
                else
                {
                    executionLog.Log("CloneEquipment", " Click On Create");
                    VisitOffice("equipment/create");
                    eqiupment_EquipmentHelper.WaitForWorkAround(3000);

                    executionLog.Log("CloneEquipment", "Enter Equipment Name");
                    eqiupment_EquipmentHelper.TypeText("Name", "Clone Equipment");

                    executionLog.Log("CloneEquipment", "Select equipment type.");
                    eqiupment_EquipmentHelper.Select("Type", "Check Reader");

                    executionLog.Log("CloneEquipment", "Enter Equipment Id");
                    eqiupment_EquipmentHelper.TypeText("EquipmentId", Id);

                    executionLog.Log("CloneEquipment", "Enter Version");
                    eqiupment_EquipmentHelper.TypeText("Version", "Testing");

                    executionLog.Log("CloneEquipment", "Enter Description");
                    eqiupment_EquipmentHelper.TypeText("Description", "This is Testing Description");

                    executionLog.Log("CloneEquipment", " Click on Save button");
                    eqiupment_EquipmentHelper.ClickElement("Save");
                    eqiupment_EquipmentHelper.WaitForWorkAround(2000);

                    executionLog.Log("CloneEquipment", "Click On Equipment");
                    eqiupment_EquipmentHelper.ClickElement("FirstEquip");

                    executionLog.Log("CloneEquipment", "Click On Clone");
                    eqiupment_EquipmentHelper.ClickElement("ClickOnClone");

                    executionLog.Log("CloneEquipment", "Verify Equipment is cloned successfully");
                    eqiupment_EquipmentHelper.VerifyPageText("Equipment is cloned successfully");
                    eqiupment_EquipmentHelper.VerifyPageText("Clone of Equipment");

                    executionLog.Log("CloneEquipment", "Click on delete clone");
                    eqiupment_EquipmentHelper.ClickElement("ClickDelClone");

                    executionLog.Log("CloneEquipment", "Accept alert message.");
                    eqiupment_EquipmentHelper.AcceptAlert();

                    executionLog.Log("CloneEquipment", "Verify Equipment is deleted successfully");
                    eqiupment_EquipmentHelper.VerifyPageText("Equipment deleted successfully.");
                    eqiupment_EquipmentHelper.WaitForWorkAround(3000);
                }
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("CloneEquipment");
                String Error       = executionLog.GetAllTextFile("Error");
                Console.WriteLine(Error);
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Clone Equipment");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Clone Equipment", "Bug", "Medium", "Equipment page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Clone Equipment");
                        TakeScreenshot("CloneEquipment");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\CloneEquipment.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("CloneEquipment");
                        string id            = loginHelper.getIssueID("Clone Equipment");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\CloneEquipment.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Clone Equipment"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Clone Equipment");
                //  executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("CloneEquipment");
                executionLog.WriteInExcel("Clone Equipment", Status, JIRA, "Admin Equipments");
            }
        }
        public void equipmentManagement()
        {
            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 eqiupment_EquipmentHelper = new Eqiupment_EquipmentHelper(GetWebDriver());

            // Variable
            var    name   = "Test" + RandomNumber(1, 999);
            var    Id     = "123" + RandomNumber(1, 999);
            String JIRA   = "";
            String Status = "Pass";

            //try
            //{

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

            executionLog.Log("EquipmentManagement", "Verify Page title");
            VerifyTitle("Dashboard");

            executionLog.Log("EquipmentManagement", "Click On  Admin");
            VisitOffice("admin");

            executionLog.Log("EquipmentManagement", "Redirect To URL");
            VisitOffice("equipment");
            eqiupment_EquipmentHelper.WaitForWorkAround(3000);

            executionLog.Log("EquipmentManagement", "Verify title");
            VerifyTitle("Equipment");

            executionLog.Log("EquipmentManagement", " Click On Create");
            eqiupment_EquipmentHelper.Clickjs("Create");
            eqiupment_EquipmentHelper.WaitForWorkAround(3000);

            executionLog.Log("EquipmentManagement", "Verify title");
            VerifyTitle("Equipment Create");

            executionLog.Log("EquipmentManagement", " Click on Save button ");
            eqiupment_EquipmentHelper.Clickjs("Save");
            //eqiupment_EquipmentHelper.WaitForWorkAround(3000);

            executionLog.Log("EquipmentManagement", " Verify validation text on page.");
            eqiupment_EquipmentHelper.VerifyPageText("This field is required.");
            //eqiupment_EquipmentHelper.WaitForWorkAround(500);

            executionLog.Log("EquipmentManagement", "Enter Equipment Name");
            eqiupment_EquipmentHelper.TypeText("Name", name);
            //eqiupment_EquipmentHelper.WaitForWorkAround(500);

            executionLog.Log("EquipmentManagement", "Select Equipment type");
            eqiupment_EquipmentHelper.Select("Type", "Check Reader");
            //eqiupment_EquipmentHelper.WaitForWorkAround(500);

            executionLog.Log("EquipmentManagement", "Enter Equipment Id");
            eqiupment_EquipmentHelper.TypeText("EquipmentId", Id);
            //eqiupment_EquipmentHelper.WaitForWorkAround(500);

            executionLog.Log("EquipmentManagement", "Enter Version");
            eqiupment_EquipmentHelper.TypeText("Version", "6.0.1");
            //eqiupment_EquipmentHelper.WaitForWorkAround(500);

            executionLog.Log("EquipmentManagement", "Enter Description");
            eqiupment_EquipmentHelper.TypeText("Description", "This is Testing Description");
            //eqiupment_EquipmentHelper.WaitForWorkAround(500);

            executionLog.Log("EquipmentManagement", "Select first processor");
            eqiupment_EquipmentHelper.ClickElement("ApplicableProcessors1");

            executionLog.Log("EquipmentManagement", "Select second processor.");
            eqiupment_EquipmentHelper.ClickElement("ApplicableProcessors2");

            executionLog.Log("EquipmentManagement", " Click on Save button ");
            eqiupment_EquipmentHelper.ClickElement("Save");
            eqiupment_EquipmentHelper.WaitForWorkAround(3000);

            executionLog.Log("EquipmentManagement", " Wait for save equipment text ");
            eqiupment_EquipmentHelper.WaitForText("Equipment saved successfully", 10);

            executionLog.Log("EquipmentManagement", "Redirect To URL");
            VisitOffice("equipment");
            eqiupment_EquipmentHelper.WaitForWorkAround(4000);

            executionLog.Log("EquipmentManagement", "Verify title");
            VerifyTitle("Equipment");
            //eqiupment_EquipmentHelper.WaitForWorkAround(3000);

            executionLog.Log("EquipmentManagement", "Enter ID to search equipment.");
            eqiupment_EquipmentHelper.TypeText("SearchId", Id);
            eqiupment_EquipmentHelper.WaitForWorkAround(2000);

            executionLog.Log("EquipmentManagement", "Click on edit equipment.");
            eqiupment_EquipmentHelper.Clickjs("EditEquipment");
            eqiupment_EquipmentHelper.WaitForWorkAround(3000);

            executionLog.Log("EquipmentManagement", "Enter Version");
            eqiupment_EquipmentHelper.TypeText("Version", "");
            //eqiupment_EquipmentHelper.WaitForWorkAround(500);

            executionLog.Log("EquipmentManagement", " Click on Save button ");
            eqiupment_EquipmentHelper.ClickElement("Save");
            //eqiupment_EquipmentHelper.WaitForWorkAround(500);

            executionLog.Log("EquipmentManagement", " Verify version error text.");
            eqiupment_EquipmentHelper.VerifyText("VerifyVersionVal", "This field is required.");
            //eqiupment_EquipmentHelper.WaitForWorkAround(500);

            executionLog.Log("EquipmentManagement", "Enter Version");
            eqiupment_EquipmentHelper.TypeText("Version", "10.0.1");
            //eqiupment_EquipmentHelper.WaitForWorkAround(500);

            executionLog.Log("EquipmentManagement", "Click on Add version.");
            eqiupment_EquipmentHelper.ClickElement("ClickAddAnother");
            eqiupment_EquipmentHelper.WaitForWorkAround(1000);

            executionLog.Log("EquipmentManagement", "Enter Version");
            eqiupment_EquipmentHelper.TypeText("AddedVersion", "2");
            //eqiupment_EquipmentHelper.WaitForWorkAround(500);

            executionLog.Log("EquipmentManagement", " Click on Save button ");
            eqiupment_EquipmentHelper.ClickElement("Save");
            eqiupment_EquipmentHelper.WaitForWorkAround(4000);

            executionLog.Log("EquipmentManagement", "Enter ID to search equipment");
            eqiupment_EquipmentHelper.TypeText("SearchId", Id);
            eqiupment_EquipmentHelper.WaitForWorkAround(2000);

            executionLog.Log("EquipmentManagement", "Click On Equipment");
            eqiupment_EquipmentHelper.ClickElement("ClickOneQUIP");
            eqiupment_EquipmentHelper.WaitForWorkAround(3000);

            executionLog.Log("EquipmentManagement", "Click On Clone");
            eqiupment_EquipmentHelper.ClickElement("ClickOnClone");
            eqiupment_EquipmentHelper.WaitForWorkAround(2000);

            executionLog.Log("EquipmentManagement", "wait for success message.");
            eqiupment_EquipmentHelper.WaitForText("Equipment is cloned successfully", 20);

            executionLog.Log("EquipmentManagement", "Redirect To URL");
            VisitOffice("equipment");
            eqiupment_EquipmentHelper.WaitForWorkAround(3000);

            executionLog.Log("EquipmentManagement", "Verify title");
            VerifyTitle("Equipment");
            //eqiupment_EquipmentHelper.WaitForWorkAround(1000);

            executionLog.Log("EquipmentManagement", "Click On first chk box");
            eqiupment_EquipmentHelper.ClickElement("ClickOnFirstCheckBox");

            executionLog.Log("EquipmentManagement", "Click On Bulk Update");
            eqiupment_EquipmentHelper.Clickjs("BulkUpdate");
            eqiupment_EquipmentHelper.WaitForWorkAround(1000);

            executionLog.Log("EquipmentManagement", "Click to Change Status");
            eqiupment_EquipmentHelper.ClickElement("ChangeStatusBU");
            eqiupment_EquipmentHelper.WaitForWorkAround(2000);

            executionLog.Log("EquipmentManagement", "Select Status as active");
            eqiupment_EquipmentHelper.Select("SelectStatus", "1");
            //eqiupment_EquipmentHelper.WaitForWorkAround(2000);

            executionLog.Log("EquipmentManagement", "Click on Update button");
            eqiupment_EquipmentHelper.ClickElement("ClickOnSaveBulkPopUp");
            //eqiupment_EquipmentHelper.WaitForWorkAround(2000);

            executionLog.Log("EquipmentManagement", "Accept alert message.");
            eqiupment_EquipmentHelper.AcceptAlert();
            eqiupment_EquipmentHelper.WaitForWorkAround(2000);

            executionLog.Log("EquipmentManagement", "Wait for success message.");
            eqiupment_EquipmentHelper.WaitForText("1 Record(s) updated successfully", 10);

            executionLog.Log("EquipmentManagement", "Click on delete Icon");
            eqiupment_EquipmentHelper.ClickElement("ClickDelClone");
            eqiupment_EquipmentHelper.WaitForWorkAround(1000);

            executionLog.Log("EquipmentManagement", "Accept alert message.");
            eqiupment_EquipmentHelper.AcceptAlert();

            executionLog.Log("EquipmentManagement", "Wait for delete success message.");
            eqiupment_EquipmentHelper.WaitForText("Equipment deleted successfully.", 10);
            eqiupment_EquipmentHelper.WaitForWorkAround(2000);

            executionLog.Log("EquipmentManagement", "Enter ID to search equipment.");
            eqiupment_EquipmentHelper.TypeText("SearchId", Id);
            eqiupment_EquipmentHelper.WaitForWorkAround(2000);

            executionLog.Log("EquipmentManagement", "Click Delete Icon ");
            eqiupment_EquipmentHelper.Clickjs("DeleteEuipment");
            eqiupment_EquipmentHelper.WaitForWorkAround(1000);

            executionLog.Log("EquipmentManagement", "Accept alert message. ");
            eqiupment_EquipmentHelper.AcceptAlert();
            eqiupment_EquipmentHelper.WaitForWorkAround(2000);

            executionLog.Log("EquipmentManagement", "Wait for delete message. ");
            eqiupment_EquipmentHelper.WaitForText("Equipment deleted successfully", 10);

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

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


            // Variable
            var    FirstName = "Test" + GetRandomNumber();
            var    LastName  = "Tester" + GetRandomNumber();
            var    Number    = "12345678" + GetRandomNumber();
            String JIRA      = "";
            String Status    = "Pass";

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

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

                executionLog.Log("AdminEquipmentEquipmentURLChange", "Goto User Admin Product >> Product  ");
                VisitOffice("equipment");

                executionLog.Log("AdminEquipmentEquipmentURLChange", "Click On any Product >> Product");
                eqiupment_EquipmentHelper.ClickElement("ClickOneQUIP");
                eqiupment_EquipmentHelper.WaitForWorkAround(2000);

                executionLog.Log("AdminEquipmentEquipmentURLChange", "Change the url with the url number of another office");
                VisitOffice("equipment/view/616");
                eqiupment_EquipmentHelper.WaitForWorkAround(5000);

                executionLog.Log("AdminEquipmentEquipmentURLChange", "Verify Validation");
                eqiupment_EquipmentHelper.VerifyPageText("oops something went wrong");
                eqiupment_EquipmentHelper.WaitForWorkAround(2000);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

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