Example #1
0
        //Method for upload .bex enviroment into especific enviroment
        public static void EnvironmentAction(string indexPro, string indexEnv, string actionType)
        {
            try
            {
                Clog Clog = new Clog();

                Thread.Sleep(500); //wait set variables

                if (indexPro != "There aren't project")
                {
                    Thread.Sleep(5000);
                    //utils.WaitTimeForElement(PageObjectRun.ButtonCreateProject(), Cconf.Instance.userTimeWait, Cconf.Instance.elemenType[1]);
                    string idProject = Convert.ToString(indexPro);

                    if (indexEnv != "There aren't environment")
                    {
                        string idEnviroment = Convert.ToString(indexEnv);
                        string NewUrl;
                        switch (actionType)
                        {
                        case "loadbex":

                            utils.ClickTwoElements(PageObjectRun.ElementSelectProject(), PageObjectRun.ElementSelectEnviroment(), PageObjectRun.SelectMenuEnviroment(), Cconf.Instance.elemenType[1], idProject, idEnviroment);
                            AutoItX3 autoIt = new AutoItX3();
                            autoIt.WinActivate("File Upload");
                            autoIt.ControlGetFocus("File Upload");
                            Thread.Sleep(500);
                            autoIt.Send(Cconf.Instance.ListEnviromentsLoadBex[0, 1]);
                            Thread.Sleep(2000);     //wait write path .bex
                            autoIt.Send("{ENTER}");
                            Thread.Sleep(1000);     //come back run cloud
                            utils.Click(PageObjectRun.ButtonloadBex(), Cconf.Instance.elemenType[1]);
                            utils.WaitTimeForElement(PageObjectRun.LoadCreatedEnvironment(), Cconf.Instance.userTimeWait, Cconf.Instance.elemenType[1]);
                            string Waiting = utils.GetMessagesTwoVariables(PageObjectRun.ElementSelectProject(), PageObjectRun.ElementSelectEnviroment(), PageObjectRun.SelectStatusEnviroment(), Cconf.Instance.elemenType[1], null, idProject, idEnviroment);


                            while (Waiting == "Applying")
                            {
                                utils.writeLog("{0} upload package... \n", Waiting);
                                Waiting = utils.GetMessagesTwoVariables(PageObjectRun.ElementSelectProject(), PageObjectRun.ElementSelectEnviroment(), PageObjectRun.SelectStatusEnviroment(), Cconf.Instance.elemenType[1], null, idProject, idEnviroment);
                                Thread.Sleep(5000);    //wait to write log
                            }

                            if (Waiting == "Active")
                            {
                                utils.writeLog("The package has been upload successfully with state: {0} \n\n\n", Waiting);
                                utils.WaitTimeForElement(PageObjectRun.ButtonCloseAlert(), Cconf.Instance.userTimeWait, Cconf.Instance.elemenType[1]);
                                utils.Click(PageObjectRun.ButtonCloseAlert(), Cconf.Instance.elemenType[1]);
                                break;
                            }
                            else
                            {
                                utils.writeLog("\n----Can't upload package state: {0} ----\n\n", Waiting);
                                break;
                            }

                        case "delete":
                            utils.ClickTwoElements(PageObjectRun.ElementSelectProject(), PageObjectRun.ElementSelectEnviroment(), PageObjectRun.SelectTrashEnviroment(), Cconf.Instance.elemenType[1], idProject, idEnviroment);

                            utils.WaitTimeForElement(PageObjectRun.SetTextTrashEviroment(), Cconf.Instance.userTimeWait, Cconf.Instance.elemenType[1]);
                            utils.EnterText(PageObjectRun.SetTextTrashEviroment(), Cconf.Instance.ListEnviroments[0, 1], Cconf.Instance.elemenType[1]);
                            utils.ClickCheck(PageObjectRun.SetCheckTrashEnviroment(), Cconf.Instance.elemenType[1]);

                            utils.WaitTimeForElement(PageObjectRun.ButtonDelete(), Cconf.Instance.userTimeWait, Cconf.Instance.elemenType[1]);
                            utils.Click(PageObjectRun.ButtonDelete(), Cconf.Instance.elemenType[1]);
                            break;

                        case "run":
                            NewUrl = utils.GetMessagesTwoVariables(PageObjectRun.ElementSelectProject(), PageObjectRun.ElementSelectEnviroment(), PageObjectRun.GetUrlEnviroment(), Cconf.Instance.elemenType[1], "href", idProject, idEnviroment);
                            utils.ClickTwoElements(PageObjectRun.ElementSelectProject(), PageObjectRun.ElementSelectEnviroment(), PageObjectRun.ClickButtonRunEnviroment(), Cconf.Instance.elemenType[1], idProject, idEnviroment);
                            CopenBrowser.driver.SwitchTo().Window(CopenBrowser.driver.WindowHandles.Last());
                            utils.WaitTimeForElement(PageObjectEngine.LoginButton(), Cconf.Instance.userTimeWait, Cconf.Instance.elemenType[0]);
                            utils.EnterText(PageObjectEngine.UserText(), Cconf.Instance.ListEnviromentsLoadBex[0, 2], Cconf.Instance.elemenType[0]);
                            utils.EnterText(PageObjectEngine.PasswordText(), Cconf.Instance.ListEnviromentsLoadBex[0, 3], Cconf.Instance.elemenType[0]);
                            utils.Click(PageObjectEngine.LoginButton(), Cconf.Instance.elemenType[0]);
                            utils.WaitTimeForElement(PageObjectEngine.bizagiLogo(), Cconf.Instance.userTimeWait, Cconf.Instance.elemenType[1]);
                            utils.assertElementImage(Cconf.Instance.scenaryLogoEngine, PageObjectEngine.bizagiLogo(), Cconf.Instance.elemenType[1], Cconf.Instance.copyLogoEngine);
                            CengineCloud.NewCase(CengineCloud.SearchCase(Cconf.Instance.ListEnviromentsLoadBex[0, 4]));
                            CengineCloud.LogoutEngine();
                            CopenBrowser.driver.Close();
                            CopenBrowser.driver.SwitchTo().Window(CopenBrowser.driver.WindowHandles.Last());
                            break;

                        case "reset":

                            utils.ClickTwoElements(PageObjectRun.ElementSelectProject(), PageObjectRun.ElementSelectEnviroment(), PageObjectRun.MenuEnvironment(), Cconf.Instance.elemenType[1], idProject, idEnviroment);
                            utils.Click(PageObjectRun.SelectResetEnvironment(), Cconf.Instance.elemenType[1]);
                            utils.WaitTimeForElement(PageObjectRun.textReset(), Cconf.Instance.userTimeWait, Cconf.Instance.elemenType[1]);
                            utils.ClickCheck(PageObjectRun.SetCheckTrashEnviroment(), Cconf.Instance.elemenType[1]);
                            utils.WaitTimeForElement(PageObjectRun.ButtonDelete(), Cconf.Instance.userTimeWait, Cconf.Instance.elemenType[1]);
                            utils.Click(PageObjectRun.ButtonDelete(), Cconf.Instance.elemenType[1]);
                            utils.WaitTimeForElement(PageObjectRun.LoadCreatedEnvironment(), Cconf.Instance.userTimeWait, Cconf.Instance.elemenType[1]);
                            string reseting = utils.GetMessagesTwoVariables(PageObjectRun.ElementSelectProject(), PageObjectRun.ElementSelectEnviroment(), PageObjectRun.StatusEnviroment(), Cconf.Instance.elemenType[1], null, idProject, idEnviroment);

                            Thread.Sleep(1000);
                            reseting = utils.GetMessagesTwoVariables(PageObjectRun.ElementSelectProject(), PageObjectRun.ElementSelectEnviroment(), PageObjectRun.StatusEnviroment(), Cconf.Instance.elemenType[1], null, idProject, idEnviroment);

                            while (reseting == "Resetting IIS")
                            {
                                utils.writeLog("{0} Environment... \n", reseting);
                                reseting = utils.GetMessagesTwoVariables(PageObjectRun.ElementSelectProject(), PageObjectRun.ElementSelectEnviroment(), PageObjectRun.StatusEnviroment(), Cconf.Instance.elemenType[1], null, idProject, idEnviroment);
                                Thread.Sleep(5000);     // wait for validate environment status
                            }

                            if (reseting == "Active")
                            {
                                utils.writeLog("\nThe environment was reseted correctly", null);
                            }
                            else
                            {
                                utils.writeLog("\n----Can't reset environment state is {0}----\n\n", reseting);
                            }

                            NewUrl = utils.GetMessagesTwoVariables(PageObjectRun.ElementSelectProject(), PageObjectRun.ElementSelectEnviroment(), PageObjectRun.GetUrlEnviroment(), Cconf.Instance.elemenType[1], "href", idProject, idEnviroment);
                            utils.ClickTwoElements(PageObjectRun.ElementSelectProject(), PageObjectRun.ElementSelectEnviroment(), PageObjectRun.ClickButtonRunEnviroment(), Cconf.Instance.elemenType[1], idProject, idEnviroment);
                            CopenBrowser.driver.SwitchTo().Window(CopenBrowser.driver.WindowHandles.Last());
                            utils.WaitTimeForElement(PageObjectEngine.LoginButton(), Cconf.Instance.userTimeWait, Cconf.Instance.elemenType[0]);
                            utils.EnterText(PageObjectEngine.UserText(), Cconf.Instance.ListEnviromentsLoadBex[0, 2], Cconf.Instance.elemenType[0]);
                            utils.EnterText(PageObjectEngine.PasswordText(), Cconf.Instance.ListEnviromentsLoadBex[0, 3], Cconf.Instance.elemenType[0]);
                            utils.Click(PageObjectEngine.LoginButton(), Cconf.Instance.elemenType[0]);
                            utils.WaitTimeForElement(PageObjectEngine.bizagiLogo(), Cconf.Instance.userTimeWait, Cconf.Instance.elemenType[1]);
                            utils.assertElementImage(Cconf.Instance.scenaryLogoEngine, PageObjectEngine.bizagiLogo(), Cconf.Instance.elemenType[1], Cconf.Instance.copyLogoEngine);
                            CengineCloud.NewCase(CengineCloud.SearchCase(Cconf.Instance.ListEnviromentsLoadBex[0, 4]));
                            CengineCloud.LogoutEngine();
                            CopenBrowser.driver.Close();
                            CopenBrowser.driver.SwitchTo().Window(CopenBrowser.driver.WindowHandles.Last());
                            break;

                        case "monitor":
                            utils.ClickTwoElements(PageObjectRun.ElementSelectProject(), PageObjectRun.ElementSelectEnviroment(), PageObjectRun.activityMonitor(), Cconf.Instance.elemenType[1], idProject, idEnviroment);
                            utils.WaitTimeForElement(PageObjectRun.buttonCloseMonitor(), Cconf.Instance.userTimeWait, Cconf.Instance.elemenType[1]);

                            utils.Click(PageObjectRun.buttonCloseMonitor(), Cconf.Instance.elemenType[1]);



                            break;

                        default:
                            utils.writeLog("\n----There aren't option to environment----", null);
                            break;
                        }
                    }
                    else
                    {
                        utils.writeLog("\n----Enviroment not found----", null);
                    }
                }
                else
                {
                    utils.writeLog("\n----Project not found----", null);
                }
            }
            catch (Exception ErrorM)
            {
                utils.writeLog("{0}", ErrorM.Message);
            }
        }
        public static void NewCase(int casenumber)
        {
            int Case = casenumber;

            if (Case != -1)
            {
                string idCase = Case.ToString();
                Thread.Sleep(500);
                utils.WaitTimeForElementVar(PageObjectEngine.SelectProcessMC(), Cconf.Instance.userTimeWait, Cconf.Instance.elemenType[1], idCase);
                utils.ClickOneVariable(PageObjectEngine.SelectProcessMC(), Cconf.Instance.elemenType[1], idCase);
                utils.WaitTimeForElement(PageObjectEngine.CaseImageProfile(), Cconf.Instance.userTimeWait, Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                utils.Click(PageObjectEngine.CaseImageProfile(), Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                utils.Click(PageObjectEngine.SearchElementCaseImage(), Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                AutoItX3 autoIt = new AutoItX3();
                autoIt.WinActivate("File Upload");
                autoIt.ControlGetFocus("File Upload");
                Thread.Sleep(1000);
                autoIt.Send(Cconf.Instance.ListValuesCase[0, 0]); //Ruta del archivo
                Thread.Sleep(2000);
                autoIt.Send("{ENTER}");
                Thread.Sleep(1000);
                utils.Click(PageObjectEngine.ButtonUploadFile(), Cconf.Instance.elemenType[2]);
                Thread.Sleep(4000);
                utils.EnterText(PageObjectEngine.CaseNameProfile(), Cconf.Instance.ListValuesCase[0, 1], Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                utils.EnterText(PageObjectEngine.CaseAdressProfile(), Cconf.Instance.ListValuesCase[0, 2], Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                utils.EnterText(PageObjectEngine.CasePhoneProfile(), Cconf.Instance.ListValuesCase[0, 3], Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                utils.EnterText(PageObjectEngine.CaseMoneyProfile(), Cconf.Instance.ListValuesCase[0, 4], Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                utils.Click(PageObjectEngine.CaseUploadProfile(), Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                utils.Click(PageObjectEngine.SearchElementCaseUpload(), Cconf.Instance.elemenType[2]);
                autoIt.WinActivate("File Upload");
                autoIt.ControlGetFocus("File Upload");
                Thread.Sleep(1000);
                autoIt.Send(Cconf.Instance.ListValuesCase[0, 5]);
                Thread.Sleep(2000);
                autoIt.Send("{ENTER}");
                Thread.Sleep(1000);
                utils.Click(PageObjectEngine.ButtonUploadFile(), Cconf.Instance.elemenType[2]);
                Thread.Sleep(4000);

                //Collection

                utils.EnterText(PageObjectEngine.CaseAdressCollection(), Cconf.Instance.ListValuesCase[0, 6], Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                utils.Click(PageObjectEngine.CaseImageCollection(), Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                utils.Click(PageObjectEngine.SearchElementCollectionImage(), Cconf.Instance.elemenType[2]);
                Thread.Sleep(2000);
                autoIt.WinActivate("File Upload");
                autoIt.ControlGetFocus("File Upload");
                Thread.Sleep(1000);
                autoIt.Send(Cconf.Instance.ListValuesCase[0, 7]); // Ruta del archivo
                Thread.Sleep(2000);
                autoIt.Send("{ENTER}");
                Thread.Sleep(2000);
                utils.Click(PageObjectEngine.ButtonUploadFile(), Cconf.Instance.elemenType[2]);
                Thread.Sleep(4000);
                utils.EnterText(PageObjectEngine.CaseMoneyCollection(), Cconf.Instance.ListValuesCase[0, 8], Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                utils.EnterText(PageObjectEngine.CaseNameCollection(), Cconf.Instance.ListValuesCase[0, 9], Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                utils.EnterText(PageObjectEngine.CasePhoneCollection(), Cconf.Instance.ListValuesCase[0, 10], Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                utils.Click(PageObjectEngine.CaseDateCollection(), Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                utils.Click(PageObjectEngine.DateTime(), Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                utils.Click(PageObjectEngine.CaseUploadCollection(), Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                utils.Click(PageObjectEngine.SearchElementCaseUpload(), Cconf.Instance.elemenType[2]);
                Thread.Sleep(2000);
                autoIt.WinActivate("File Upload");
                autoIt.ControlGetFocus("File Upload");
                Thread.Sleep(1000);
                autoIt.Send(Cconf.Instance.ListValuesCase[0, 11]);
                Thread.Sleep(2000);
                autoIt.Send("{ENTER}");
                Thread.Sleep(1000);
                utils.Click(PageObjectEngine.ButtonUploadFile(), Cconf.Instance.elemenType[2]);
                Thread.Sleep(4000);
                utils.Click(PageObjectEngine.CaseBolleanCollection(), Cconf.Instance.elemenType[2]);
                Thread.Sleep(500);
                utils.Click(PageObjectEngine.SaveCase(), Cconf.Instance.elemenType[2]);
                Thread.Sleep(4000);
                utils.Click(PageObjectEngine.NextCase(), Cconf.Instance.elemenType[2]);
                Thread.Sleep(1000);
            }
            else
            {
                utils.writeLog("There aren't csse with this name", null);
            }
        }
Example #3
0
        public string GetfocusText(string apptitle)
        {
            return(_robot.ControlGetFocus(apptitle));

            Sleep(500);
        }