コード例 #1
0
        public void setFieldToNumeric()
        {
            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
            ExecutionLog executionLog         = new ExecutionLog();
            LoginHelper  loginHelper          = new LoginHelper(GetWebDriver());
            var          validate             = new AdminSetFormatFieldsHelper(GetWebDriver());
            var          office_ClientsHelper = new Office_ClientsHelper(GetWebDriver());

            //Random Variable
            String JIRA    = "";
            String Status  = "Pass";
            var    DBAName = "DBA@Company" + RandomNumber(1, 999);

            try
            {
                executionLog.Log("AdminSetValidationNumeric", "Login");
                Login(username[0], password[0]);

                //executionLog.Log("AdminSetValidationNumeric", "WaitForWorkAround");
                //validate.WaitForWorkAround(4000);

                executionLog.Log("AdminSetValidationNumeric", "Verify Dashboard");
                VerifyTitle("Dashboard");

                //executionLog.Log("AdminSetValidationNumeric", "Visit admin");
                //VisitOffice("admin");
                //validate.WaitForWorkAround(2000);

                VisitOffice("fields");
                validate.WaitForWorkAround(3000);

                executionLog.Log("AdminSetValidationNumeric", "Select the client module");
                validate.SelectByText("Module", "Clients");
                validate.WaitForWorkAround(2000);

                executionLog.Log("AdminSetValidationNumeric", "Select Processor as First Data North");
                validate.SelectByText("Processor", "First Data North");
                validate.WaitForWorkAround(2000);

                executionLog.Log("AdminSetValidationNumeric", "Select Tab as Contacts");
                validate.SelectByText("Tab", "Contacts");
                validate.WaitForWorkAround(2000);

                executionLog.Log("AdminSetValidationNumeric", "Select Section as Contacts");
                validate.SelectByText("Section", "Contacts");
                validate.WaitForWorkAround(2000);

                executionLog.Log("AdminSetValidationNumeric", "Click Search Element");
                validate.ClickElement("Search");
                validate.WaitForWorkAround(3000);

                executionLog.Log("AdminSetValidationNumeric", "Type title Text");
                validate.TypeText("filter", "Title");
                validate.WaitForWorkAround(3000);

                executionLog.Log("AdminSetValidationNumeric", "Click TitleField Element");
                validate.ClickJs("ContactTitle");
                validate.WaitForWorkAround(4000);

                executionLog.Log("AdminSetValidationNumeric", "Click ApplyDataTypeValidation Element");
                validate.checkAndClick("ProcApplyDataTypeValidation");
                validate.WaitForWorkAround(2000);

                executionLog.Log("AdminSetValidationNumeric", "Select data type as phone.");
                validate.SelectByText("ProcFieldDataType", "Numeric");

                executionLog.Log("AdminSetValidationNumeric", "Click SaveFieldManager Element");
                validate.ClickElement("SaveFieldManager");
                validate.WaitForWorkAround(3000);

                executionLog.Log("AdminSetValidationNumeric", "Redirect at Create Client");
                VisitOffice("clients/create");
                validate.WaitForWorkAround(3000);

                executionLog.Log("AdminSetValidationNumeric", "Select Processor");
                office_ClientsHelper.SelectByText("CreateProc", "First Data North");

                executionLog.Log("AdminSetValidationNumeric", "Enter Client Dba Name");
                office_ClientsHelper.TypeText("ClientDBAName", DBAName);

                executionLog.Log("AdminSetValidationNumeric", "Select client status");
                office_ClientsHelper.SelectByText("ClientStatus", "New");

                executionLog.Log("AdminSetValidationNumeric", "Select Client Res[onsibility.");
                office_ClientsHelper.SelectByText("ClientResponsibility", "Howard Tang");

                executionLog.Log("AdminSetValidationNumeric", "Click on next button");
                office_ClientsHelper.ClickElement("Next");
                office_ClientsHelper.WaitForWorkAround(2000);

                executionLog.Log("AdminSetValidationNumeric", "Wait for confirmation message.");
                office_ClientsHelper.WaitForText("Client saved successfully. ", 10);

                executionLog.Log("AdminSetValidationNumeric", "Click On Contact Tab Clinet");
                office_ClientsHelper.ClickElement("ContactDetails");
                office_ClientsHelper.WaitForWorkAround(3000);

                executionLog.Log("AdminSetValidationNumeric", "Enter character");
                validate.TypeText("Title", "abcdef");

                executionLog.Log("AdminSetValidationNumeric", "Click Save");
                validate.ClickForce("Save");
                office_ClientsHelper.WaitForWorkAround(2000);

                executionLog.Log("AdminSetValidationNumeric", "Verify page text");
                validate.VerifyPageText("Please enter only digits.");

                executionLog.Log("AdminSetValidationNumeric", "Redirect To clients page. ");
                VisitOffice("clients");
                office_ClientsHelper.WaitForWorkAround(3000);

                executionLog.Log("AdminSetValidationNumeric", "Enter Company Name");
                office_ClientsHelper.TypeText("SearchClient", DBAName);
                office_ClientsHelper.WaitForWorkAround(2000);

                executionLog.Log("AdminSetValidationNumeric", "Select client by check box");
                office_ClientsHelper.ClickForce("ClickOn1stOpp");
                office_ClientsHelper.WaitForWorkAround(2000);

                executionLog.Log("AdminSetValidationNumeric", "Click on delete client");
                office_ClientsHelper.ClickElement("DeleteClient");

                executionLog.Log("AdminSetValidationNumeric", "Accept alert message.");
                office_ClientsHelper.AcceptAlert();

                executionLog.Log("AdminSetValidationNumeric", "Wait for success message.");
                office_ClientsHelper.WaitForText("1 records deleted successfully", 10);

                executionLog.Log("AdminSetValidationNumeric", "Redirect To client recycle bin page. ");
                VisitOffice("clients/recyclebin");
                office_ClientsHelper.WaitForWorkAround(3000);

                executionLog.Log("AdminSetValidationNumeric", "Enter Company Name");
                office_ClientsHelper.TypeText("SearchClient", DBAName);
                office_ClientsHelper.WaitForWorkAround(3000);

                executionLog.Log("AdminSetValidationNumeric", "Click on delete client");
                office_ClientsHelper.ClickElement("DeleteRbin");

                executionLog.Log("AdminSetValidationNumeric", "Accept alert message.");
                office_ClientsHelper.AcceptAlert();

                executionLog.Log("AdminSetValidationNumeric", "Wait for success message.");
                office_ClientsHelper.WaitForText("Client Permanently Deleted.", 10);

                VisitOffice("fields");
                validate.WaitForWorkAround(3000);

                executionLog.Log("AdminSetValidationNumeric", "Select the client module");
                validate.SelectByText("Module", "Clients");
                validate.WaitForWorkAround(2000);

                executionLog.Log("AdminSetValidationNumeric", "Select Processor as First Data North");
                validate.SelectByText("Processor", "First Data North");
                validate.WaitForWorkAround(2000);

                executionLog.Log("AdminSetValidationNumeric", "Select Tab as Contacts");
                validate.SelectByText("Tab", "Contacts");
                validate.WaitForWorkAround(2000);

                executionLog.Log("AdminSetValidationNumeric", "Select Section as Contacts");
                validate.SelectByText("Section", "Contacts");
                validate.WaitForWorkAround(2000);

                executionLog.Log("AdminSetValidationNumeric", "Click Search Element");
                validate.ClickElement("Search");
                validate.WaitForWorkAround(3000);

                executionLog.Log("AdminSetValidationNumeric", "Type title Text");
                validate.TypeText("filter", "Title");
                validate.WaitForWorkAround(3000);

                executionLog.Log("AdminSetValidationNumeric", "Click TitleField Element");
                validate.ClickJs("ContactTitle");
                validate.WaitForWorkAround(4000);

                executionLog.Log("AdminSetValidationNumeric", "Click ApplyDataTypeValidation Element");
                validate.checkAndClick("ProcApplyDataTypeValidation");
                validate.WaitForWorkAround(2000);

                executionLog.Log("AdminSetValidationNumeric", "Click SaveFieldManager Element");
                validate.ClickElement("SaveFieldManager");
                validate.WaitForWorkAround(3000);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("AdminSetValidationNumeric");
                String Error       = executionLog.GetAllTextFile("Error");
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Admin Set Validation Numeric");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Admin Set Validation Numeric", "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("Admin Set Validation Numeric");
                        TakeScreenshot("AdminSetValidationNumeric");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\AdminSetValidationNumeric.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("AdminSetValidationNumeric");
                        string id            = loginHelper.getIssueID("Admin Set Validation Numeric");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\AdminSetValidationNumeric.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Admin Set Validation Numeric"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Admin Set Validation Numeric");
                //    executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("AdminSetValidationNumeric");
                executionLog.WriteInExcel("Admin Set Validation Numeric", Status, JIRA, "Partner Portal");
            }
        }
コード例 #2
0
        public void setFieldToMandatory()
        {
            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 mandatory    = new AdminSetFormatFieldsHelper(GetWebDriver());

            //Random Variable
            String JIRA   = "";
            String Status = "Pass";

            try
            {
                //Logging in

                executionLog.Log("AdminSetFieldAsMandatory", "Login");
                Login(username[0], password[0]);

                executionLog.Log("AdminSetFieldAsMandatory", "VerifyTitle");
                VerifyTitle("Dashboard");

                executionLog.Log("OfficeMainFieldRelationships", " Testing A Client");
                VisitOffice("clients");
                mandatory.WaitForWorkAround(3000);

                executionLog.Log("AdminSetFieldAsMandatory", "ClickElement FirstClient");
                mandatory.ClickElement("FirstClient");
                mandatory.WaitForWorkAround(2000);

                //executionLog.Log("AdminSetFieldAsMandatory", "Hover CompanyDetails");
                //mandatory.MouseHover("CompanyDetails");

                executionLog.Log("AdminSetFieldAsMandatory", "ClickElement CompanyDetails");
                mandatory.ClickElement("CompanyDetails");
                mandatory.WaitForWorkAround(3000);

                // Verifying the field exists that will be changed

                executionLog.Log("AdminSetFieldAsMandatory", "Wait for element FederalTaxID");
                mandatory.ElementVisible("FederalTaxID");
                mandatory.WaitForWorkAround(4000);

                // Going to admin office

                executionLog.Log("AdminSetFieldAsMandatory", "VisitOffice admin ");
                VisitOffice("admin");
                mandatory.WaitForWorkAround(4000);

                // Accessing field in field dictionary

                VisitOffice("fields");
                mandatory.WaitForWorkAround(3000);

                mandatory.SelectByText("Module", "Clients");
                mandatory.WaitForWorkAround(2000);

                executionLog.Log("AdminSetFieldAsMandatory", "ClickElement Search ");
                mandatory.ClickElement("Search");
                mandatory.WaitForWorkAround(3000);

                executionLog.Log("AdminSetFieldAsMandatory", "filter Federal Tax ID ");
                mandatory.TypeText("filter", "Federal Tax");
                mandatory.WaitForWorkAround(3000);

                executionLog.Log("AdminSetFieldAsMandatory", "ClickElement FederalTax");
                mandatory.ClickElement("FederalTax");
                mandatory.WaitForWorkAround(3000);

                executionLog.Log("AdminSetFieldAsMandatory", "ClickElement MandatoryCheckBox");
                mandatory.ClickElement("MandatoryCheckBox");
                mandatory.WaitForWorkAround(3000);

                executionLog.Log("AdminSetFieldAsMandatory", "ClickElement SaveFieldManager");
                mandatory.ClickJs("SaveFieldManager");
                mandatory.WaitForWorkAround(3000);

                // Now we will test the mandatory field.

                executionLog.Log("AdminSetFieldAsMandatory", "VisitOffice clients");
                VisitOffice("clients");
                mandatory.WaitForWorkAround(3000);

                executionLog.Log("AdminSetFieldAsMandatory", "ClickElement");
                mandatory.ClickElement("FirstClient");
                mandatory.WaitForWorkAround(3000);

                executionLog.Log("AdminSetFieldAsMandatory", "Hover Over CompanyDetails");
                mandatory.MouseHover("CompanyDetails");
                mandatory.WaitForWorkAround(4000);

                executionLog.Log("AdminSetFieldAsMandatory", " ClickElement CompanyDetails");
                mandatory.ClickElement("CompanyDetails");
                mandatory.WaitForWorkAround(2000);

                // Testing field by trying to save data

                executionLog.Log("AdminSetFieldAsMandatory", "TypeText 555555555");
                mandatory.TypeText("FerderalTaxField", "555555555");
                mandatory.WaitForWorkAround(4000);

                executionLog.Log("AdminSetFieldAsMandatory", " Click Save Element");
                mandatory.ClickForce("Save");
                mandatory.WaitForWorkAround(2000);

                //Logging in

                executionLog.Log("AdminSetFieldAsMandatory", "Visit clients Office ");
                VisitOffice("clients");
                mandatory.WaitForWorkAround(3000);

                executionLog.Log("AdminSetFieldAsMandatory", "Click First Client Element");
                mandatory.ClickElement("FirstClient");
                mandatory.WaitForWorkAround(2000);

                executionLog.Log("AdminSetFieldAsMandatory", "Hover Over CompanyDetails");
                mandatory.MouseHover("CompanyDetails");

                executionLog.Log("AdminSetFieldAsMandatory", "Click CompanyDetails Element");
                mandatory.ClickElement("CompanyDetails");
                mandatory.WaitForWorkAround(5000);

                // Verifying the field exists that will be changed

                executionLog.Log("AdminSetFieldAsMandatory", "Check if FederalTaxID visible");
                mandatory.ElementVisible("FederalTax");
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("AdminSetFieldAsMandatory");
                String Error       = executionLog.GetAllTextFile("Error");
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Admin Set Field As Mandatory");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Admin Set Field As Mandatory", "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("Admin Set Field As Mandatory");
                        TakeScreenshot("AdminSetFieldAsMandatory");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\AdminSetFieldAsMandatory.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("AdminSetFieldAsMandatory");
                        string id            = loginHelper.getIssueID("Admin Set Field As Mandatory");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\AdminSetFieldAsMandatory.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Admin Set Field As Mandatory"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Admin Set Field As Mandatory");
                //   executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("AdminSetFieldAsMandatory");
                executionLog.WriteInExcel("Admin Set Field As Mandatory", Status, JIRA, "Partner Portal");
            }
        }