예제 #1
0
        public void SetGetTextBoxText()
        {
            // Arrange
            ActBrowserElement actBrowserElement = new ActBrowserElement()
            {
                ControlAction = ActBrowserElement.eControlAction.GotoURL, Value = "http://www.facebook.com"
            };
            ActUIElement setTextBoxAction = new ActUIElement()
            {
                ElementLocateBy = eLocateBy.ByID, ElementLocateValue = "u_0_e", ElementType = eElementType.TextBox, ElementAction = ActUIElement.eElementAction.SetText, Value = "hello"
            };
            ActUIElement getTextBoxAction = new ActUIElement()
            {
                ElementLocateBy = eLocateBy.ByID, ElementLocateValue = "u_0_e", ElementType = eElementType.TextBox, ElementAction = ActUIElement.eElementAction.GetText
            };

            // Act
            ExecuteOnPlugin.ExecutePlugInActionOnAgent(agent, actBrowserElement);

            setTextBoxAction.Value = "12345";
            ExecuteOnPlugin.ExecutePlugInActionOnAgent(agent, setTextBoxAction);
            ExecuteOnPlugin.ExecutePlugInActionOnAgent(agent, getTextBoxAction);


            // Assert
            Assert.IsTrue(string.IsNullOrEmpty(actBrowserElement.Error));
            Assert.IsTrue(string.IsNullOrEmpty(setTextBoxAction.Error));
            Assert.IsTrue(string.IsNullOrEmpty(getTextBoxAction.Error));
            Assert.AreEqual("Actual", getTextBoxAction.ReturnValues[0].Param);
            Assert.AreEqual("12345", getTextBoxAction.ReturnValues[0].Actual);
        }
예제 #2
0
        public void SetTextBoxTextx10()
        {
            // Arrange
            // ActUIElement actUIElement  // Until we will have ActUIElement in GingerCoreNEt we create a fake actions
            ActBrowserElement actBrowserElement = new ActBrowserElement()
            {
                ControlAction = ActBrowserElement.eControlAction.GotoURL, Value = "http://www.facebook.com"
            };

            ExecuteOnPlugin.ExecutePlugInActionOnAgent(agent, actBrowserElement);

            // Act
            ActUIElement actUIElementFake = new ActUIElement()
            {
                ElementLocateBy = eLocateBy.ByID, ElementLocateValue = "u_0_e", ElementType = eElementType.TextBox, ElementAction = ActUIElement.eElementAction.SetText
            };

            for (int i = 0; i < 10; i++)
            {
                actUIElementFake.Value = "#" + i;
                ExecuteOnPlugin.ExecutePlugInActionOnAgent(agent, actUIElementFake);
                Assert.IsTrue(string.IsNullOrEmpty(actUIElementFake.Error), "no Error #" + i);
            }

            // Assert
            Assert.IsTrue(string.IsNullOrEmpty(actBrowserElement.Error));
        }
        // [Timeout(60000)]
        public void SendActionToRemoteGrid()
        {
            // Arrange
            ActPlugIn actPlugin = new ActPlugIn()
            {
                ServiceId = "DummyService", ActionId = "A1"
            };

            //Act
            GingerNodeProxy.RemoteGridIP   = RemoteGridIP;   // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            GingerNodeProxy.RemoteGridPort = RemoteGridPort; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

            GingerNodeInfo gingerNodeInfo = new GingerNodeInfo()
            {
            };
            GingerNodeProxy gingerNodeProxy = new GingerNodeProxy(gingerNodeInfo, true);

            NewPayLoad actionPayLoad = ExecuteOnPlugin.CreateActionPayload(actPlugin);
            NewPayLoad actionResult  = gingerNodeProxy.RunAction(actionPayLoad);

            ExecuteOnPlugin.ParseActionResult(actionResult, actPlugin);

            //Assert
            Assert.AreEqual(RemoteGingerGrid.NodeList.Count, 2);
            Assert.AreEqual("A1 Result", actPlugin.ExInfo);
        }
예제 #4
0
        private void RunAction(ActPlugIn a1, GingerNodeProxy gNP1)
        {
            NewPayLoad a1Payload = ExecuteOnPlugin.CreateActionPayload(a1);
            NewPayLoad rc        = gNP1.RunAction(a1Payload);

            ExecuteOnPlugin.ParseActionResult(rc, a1);
        }
예제 #5
0
        public void GotoURL()
        {
            // Arrange
            ActBrowserElement actBrowserElementFake = new ActBrowserElement()
            {
                ControlAction = ActBrowserElement.eControlAction.GotoURL, Value = "http://www.facebook.com"
            };

            // Act
            ExecuteOnPlugin.ExecutePlugInActionOnAgent(agent, actBrowserElementFake);

            // Assert
            Assert.IsTrue(string.IsNullOrEmpty(actBrowserElementFake.Error));
        }
        public void StartAgentOnRemoteGingerGrid()
        {
            // Arrange
            Agent agent = new Agent();

            agent.AgentType = Agent.eAgentType.Service;
            agent.ServiceId = "SeleniumChromeService";
            agent.StartDriver();

            // ActPlugIn actPlugin = new ActPlugIn() { ServiceId = "SeleniumChromeService", ActionId = "StartDriver" };

            //Act
            //GingerNodeProxy.RemoteGridIP = "10.122.168.174";  // cmildev174
            //GingerNodeProxy.RemoteGridPort = 15001; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

            //GingerNodeInfo gingerNodeInfo = new GingerNodeInfo() { };
            //GingerNodeProxy gingerNodeProxy = new GingerNodeProxy(gingerNodeInfo, true);
            ActBrowserElement actBrowserElement = new ActBrowserElement();

            // actBrowserElement.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowserElement.InputValues.Add(new Amdocs.Ginger.Repository.ActInputValue()
            {
                Param = nameof(ActBrowserElement.ControlAction), Value = "GotoURL", ValueForDriver = "GotoURL"
            });
            actBrowserElement.ValueForDriver = "http://www.facebook.com";
            // agent.RunAction(actBrowserElement);

            ExecuteOnPlugin.ExecutePlugInActionOnAgent(agent, actBrowserElement);

            //NewPayLoad actionPayLoad = ExecuteOnPlugin.CreateActionPayload(actPlugin);
            //NewPayLoad actionResult = gingerNodeProxy.RunAction(actionPayLoad);
            //ExecuteOnPlugin.ParseActionResult(actionResult, actPlugin);

            //Assert
            Assert.AreEqual(RemoteGingerGrid.NodeList.Count, 2);
            // Assert.AreEqual("A1 Result", actPlugin.ExInfo);
        }
        public void SendActionToRemoteGridOnProcess()
        {
            // TODO: start the service batch + plugin to connect, for now we use manual bat file for testing

            // Arrange
            ActPlugIn actPlugin = new ActPlugIn()
            {
                ServiceId = "DummyService", ActionId = "Sum"
            };

            actPlugin.GetOrCreateInputParam("a").Value     = "4";
            actPlugin.GetOrCreateInputParam("a").ParamType = typeof(int);
            actPlugin.GetOrCreateInputParam("b").Value     = "3";
            actPlugin.GetOrCreateInputParam("b").ParamType = typeof(int);

            //Act
            GingerNodeProxy.RemoteGridIP   = RemoteGridIP; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            GingerNodeProxy.RemoteGridPort = 15555;        // RemoteGridPort; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

            GingerNodeInfo gingerNodeInfo = new GingerNodeInfo()
            {
            };
            GingerNodeProxy gingerNodeProxy = new GingerNodeProxy(gingerNodeInfo, true);

            NewPayLoad actionPayLoad = ExecuteOnPlugin.CreateActionPayload(actPlugin);

            for (int i = 0; i < 1000; i++)
            {
                NewPayLoad actionResult = gingerNodeProxy.RunAction(actionPayLoad);
                ExecuteOnPlugin.ParseActionResult(actionResult, actPlugin);
            }

            //Assert
            Assert.AreEqual(RemoteGingerGrid.NodeList.Count, 2);
            // Assert.AreEqual("A1 Result", actPlugin.ExInfo);
        }