Beispiel #1
0
        // Use for action which run on Agent - session
        public static void ExecutePlugInActionOnAgent(Agent agent, IActPluginExecution actPlugin)
        {
            NewPayLoad payload = GeneratePlatformActionPayload(actPlugin, agent);


            // Temp design !!!!!!!!!!!!!!!!!!
            ((Act)actPlugin).AddNewReturnParams = true;  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ???

            // Send the payload to the service
            NewPayLoad RC = agent.GingerNodeProxy.RunAction(payload);

            ParseActionResult(RC, (Act)actPlugin);
        }
Beispiel #2
0
        // Use for action which run on Agent - session
        public static void ExecutePlugInActionOnAgent(Agent agent, IActPluginExecution actPlugin)
        {
            NewPayLoad payload = GeneratePlatformActionPayload(actPlugin, agent);


            // Temp design !!!!!!!!!!!!!!!!!!
            ((Act)actPlugin).AddNewReturnParams = true;  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ???

            // Send the payload to the service
            NewPayLoad RC = agent.GingerNodeProxy.RunAction(payload);



            ParseActionResult(RC, (Act)actPlugin);


            if (actPlugin is IActPluginPostRun ActPluginPostRun)
            {
                ActPluginPostRun.ParseOutput();
            }
#warning get the follinging from platform in fo

            /*   IPlatformInfo Platforminfo = null;
             *
             * if(Platforminfo is IPlatformPluginPostRun PluginPostrun)
             * {
             *     PluginPostrun.PostExecute(agent, (Act)actPlugin);
             * }
             */

            if (agent.Platform == GingerCoreNET.SolutionRepositoryLib.RepositoryObjectsLib.PlatformsLib.ePlatformType.WebServices)
            {
                Webserviceplatforminfo Platfrominfo = new Webserviceplatforminfo();
                Platfrominfo.PostExecute(agent, (Act)actPlugin);
            }
        }
Beispiel #3
0
 public PlatformAction(IActPluginExecution Action, Dictionary <string, object> InputParameters)
 {
     ActionType  = Action.GetName();
     InputParams = InputParameters;
 }
Beispiel #4
0
 public PlatformAction(IActPluginExecution Action)
 {
     ActionType  = Action.GetName();
     InputParams = new Dictionary <string, object>();
 }
Beispiel #5
0
        static NewPayLoad GeneratePlatformActionPayload(IActPluginExecution ACT, Agent agent)
        {
            PlatformAction platformAction = ACT.GetAsPlatformAction();

            if (ACT is ActUIElement actUi)
            {
                if (actUi.ElementLocateBy == eLocateBy.POMElement)
                {
                    AddPOMLocators(ref platformAction, ref actUi, agent.ProjEnvironment, agent.BusinessFlow);
                }
            }

            // TODO: calculate VE ??!!

            NewPayLoad payload = new NewPayLoad("RunPlatformAction");

            payload.AddJSONValue <PlatformAction>(platformAction);
            payload.ClosePackage();

            // TODO: Process Valuefordriver!!!!

            return(payload);


            void AddPOMLocators(ref PlatformAction PlatformAction, ref ActUIElement UIElementAction, ProjEnvironment projEnvironment, BusinessFlow businessFlow)
            {
                Dictionary <string, string> Locators = new Dictionary <string, string>();


                List <string> Frames = new List <string>();

                string[]            pOMandElementGUIDs = UIElementAction.ElementLocateValue.ToString().Split('_');
                Guid                selectedPOMGUID    = new Guid(pOMandElementGUIDs[0]);
                ApplicationPOMModel currentPOM         = amdocs.ginger.GingerCoreNET.WorkSpace.Instance.SolutionRepository.GetRepositoryItemByGuid <ApplicationPOMModel>(selectedPOMGUID);

                if (currentPOM == null)
                {
                    UIElementAction.ExInfo = string.Format("Failed to find the mapped element Page Objects Model with GUID '{0}'", selectedPOMGUID.ToString());
                    return;
                }



                Guid        selectedPOMElementGUID = new Guid(pOMandElementGUIDs[1]);
                ElementInfo selectedPOMElement     = (ElementInfo)currentPOM.MappedUIElements.Where(z => z.Guid == selectedPOMElementGUID).FirstOrDefault();


                if (selectedPOMElement == null)
                {
                    UIElementAction.ExInfo = string.Format("Failed to find the mapped element with GUID '{0}' inside the Page Objects Model", selectedPOMElement.ToString());
                    return;
                }
                else
                {
                    List <NewPayLoad> switchframpayload = new List <NewPayLoad>();

                    if (selectedPOMElement.Path != null)
                    {
                        string[] spliter       = new string[] { "," };
                        string[] iframesPathes = selectedPOMElement.Path.Split(spliter, StringSplitOptions.RemoveEmptyEntries);
                        foreach (string iframePath in iframesPathes)
                        {
                            Frames.Add(iframePath);
                        }
                    }

                    PlatformAction.InputParams.Add("Frames", Frames);


                    //adding all locators from POM

                    foreach (ElementLocator locator in selectedPOMElement.Locators.Where(x => x.Active == true).ToList())
                    {
                        string locateValue;
                        if (locator.IsAutoLearned)
                        {
                            locateValue = locator.LocateValue;
                        }
                        else
                        {
                            ElementLocator             evaluatedLocator = locator.CreateInstance() as ElementLocator;
                            GingerCore.ValueExpression VE = new GingerCore.ValueExpression(projEnvironment, businessFlow);
                            locateValue = VE.Calculate(evaluatedLocator.LocateValue);
                        }
                        Locators.Add(locator.LocateBy.ToString(), locateValue);
                    }



                    if (PlatformAction.InputParams.ContainsKey("Locators"))
                    {
                        PlatformAction.InputParams["Locators"] = Locators;
                    }
                    else
                    {
                        PlatformAction.InputParams.Add("Locators", Locators);
                    }
                }
            }
        }