Example #1
0
        public void SwitchToDefaultFrame()
        {
            //Arrange
            ActBrowserElement actBrowser = new ActBrowserElement();

            actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString());
            actBrowser.GetOrCreateInputParam("Value", "http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_frame_cols");
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.Current.ToString());

            ActBrowserElement actBrowser1 = new ActBrowserElement();

            actBrowser1.ControlAction = ActBrowserElement.eControlAction.SwitchToDefaultFrame;

            ActBrowserElement actBrowser2 = new ActBrowserElement();

            actBrowser2.ControlAction = ActBrowserElement.eControlAction.SwitchFrame;
            actBrowser2.LocateBy      = Amdocs.Ginger.Common.UIElement.eLocateBy.ByXPath;
            actBrowser2.LocateValue   = "//*[@id='iframeResult']";

            //Act
            mGR.RunAction(actBrowser, false);
            mGR.RunAction(actBrowser1, false);
            mGR.RunAction(actBrowser2, false);

            //Assert
            Assert.AreEqual(eRunStatus.Passed, actBrowser2.Status, "Action Status");
        }
Example #2
0
        public void SwitchWindowAction()
        {
            ActBrowserElement actBrowser = new ActBrowserElement();

            actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString());
            actBrowser.GetOrCreateInputParam("Value", "https://www.google.co.in/?gws_rd=ssl");
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.Current.ToString());

            ActSwitchWindow actSwitchWindow = new ActSwitchWindow();

            actSwitchWindow.LocateBy    = Amdocs.Ginger.Common.UIElement.eLocateBy.ByTitle;
            actSwitchWindow.LocateValue = "Google";
            actSwitchWindow.GetOrCreateInputParam(ActSwitchWindow.Fields.WaitTime, "10");

            ActBrowserElement actBrowser1 = new ActBrowserElement();

            actBrowser1.ControlAction      = ActBrowserElement.eControlAction.GetWindowTitle;
            actBrowser1.AddNewReturnParams = true;

            //Act
            mGR.RunAction(actBrowser, false);
            mGR.RunAction(actSwitchWindow, false);
            mGR.RunAction(actBrowser1, false);

            //Assert
            Assert.AreEqual(eRunStatus.Passed, actSwitchWindow.Status, "Action Status");
            Assert.AreEqual("Google", actBrowser1.ReturnValues[0].Actual);
        }
Example #3
0
        public void CloseAll()
        {
            //Arrange
            ActBrowserElement actBrowser = new ActBrowserElement();

            actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString());
            actBrowser.GetOrCreateInputParam("Value", "www.gmail.com");
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.NewTab.ToString());

            ActBrowserElement actBrowser1 = new ActBrowserElement();

            actBrowser1.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser1.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString());
            actBrowser1.GetOrCreateInputParam("Value", "https://opensource-demo.orangehrmlive.com/");
            actBrowser1.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.NewTab.ToString());

            ActBrowserElement actBrowser2 = new ActBrowserElement();

            actBrowser2.ControlAction = ActBrowserElement.eControlAction.CloseAll;

            //Act
            mGR.RunAction(actBrowser, false);
            mGR.RunAction(actBrowser1, false);
            mGR.RunAction(actBrowser2, false);

            //Assert
            Assert.AreEqual(eRunStatus.Passed, actBrowser2.Status, "Action Status");

            //Validation
            ActBrowserElement actGetPageURL = ValidatePageURL();

            Assert.AreEqual(eRunStatus.Failed, actGetPageURL.Status, "Action Status");
        }
Example #4
0
        public void NevigateBack()
        {
            //Arrange
            ActBrowserElement actBrowser = new ActBrowserElement();

            actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString());
            actBrowser.GetOrCreateInputParam("Value", "https://opensource-demo.orangehrmlive.com/");
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.Current.ToString());

            ActBrowserElement actBrowser1 = new ActBrowserElement();

            actBrowser1.ControlAction = ActBrowserElement.eControlAction.NavigateBack;

            ActBrowserElement actBrowser2 = new ActBrowserElement();

            actBrowser2.ControlAction      = ActBrowserElement.eControlAction.GetWindowTitle;
            actBrowser2.AddNewReturnParams = true;

            //Act
            mGR.RunAction(actBrowser, false);
            mGR.RunAction(actBrowser1, false);
            mGR.RunAction(actBrowser2, false);

            //Assert
            Assert.AreEqual(eRunStatus.Passed, actBrowser2.Status, "Action Status");
            Assert.AreNotEqual("OrangeHRM", actBrowser2.ReturnValues[0].Actual);
        }
Example #5
0
        public void SmartSyncAction()
        {
            //Arrange
            ActBrowserElement actBrowser = new ActBrowserElement();

            actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString());
            actBrowser.GetOrCreateInputParam("Value", TestResources.GetTestResourcesFile("TestForm.htm"));
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.Current.ToString());

            ActUIElement actUIElement = new ActUIElement();

            actUIElement.ElementLocateBy    = Amdocs.Ginger.Common.UIElement.eLocateBy.ByID;
            actUIElement.ElementLocateValue = "hyperLinkHover";
            actUIElement.ElementType        = Amdocs.Ginger.Common.UIElement.eElementType.HyperLink;
            actUIElement.ElementAction      = GingerCore.Actions.Common.ActUIElement.eElementAction.Click;

            ActSmartSync actSmartSync = new ActSmartSync();

            actSmartSync.LocateBy        = Amdocs.Ginger.Common.UIElement.eLocateBy.ByID;
            actSmartSync.LocateValue     = "txtBox_Google";
            actSmartSync.SmartSyncAction = GingerCore.Actions.ActSmartSync.eSmartSyncAction.WaitUntilDisapear;

            //Act
            mGR.RunAction(actBrowser, false);
            mGR.RunAction(actUIElement, false);
            mGR.RunAction(actSmartSync, false);

            //Assert
            Assert.AreEqual(eRunStatus.Passed, actSmartSync.Status, "Action Status");
        }
Example #6
0
        public void TwoWebElementsDistances()
        {
            //Arrange
            ActBrowserElement actBrowser = new ActBrowserElement();

            actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString());
            actBrowser.GetOrCreateInputParam("Value", TestResources.GetTestResourcesFile("TestForm.htm"));
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.Current.ToString());

            ActPWL actPWL = new ActPWL();

            actPWL.LocateBy     = Amdocs.Ginger.Common.UIElement.eLocateBy.ByID;
            actPWL.LocateValue  = "Btn_Click";
            actPWL.PWLAction    = GingerCore.Actions.ActPWL.ePWLAction.GetHDistanceRight2Left;
            actPWL.OLocateBy    = Amdocs.Ginger.Common.UIElement.eLocateBy.ByID;
            actPWL.OLocateValue = "ddLst";

            ActGenElement actGenElement = new ActGenElement();

            actGenElement.GenElementAction = GingerCore.Actions.ActGenElement.eGenElementAction.RunJavaScript;
            actGenElement.GetOrCreateInputParam("Value", "document.getElementById('Btn_Click').getBoundingClientRect().top");
            actGenElement.AddNewReturnParams = true;

            //Act
            mGR.RunAction(actBrowser, false);
            mGR.RunAction(actPWL, false);
            mGR.RunAction(actGenElement, false);

            //Assert
            Assert.AreEqual(eRunStatus.Passed, actGenElement.Status, "Action Status");
            Assert.AreEqual("8", actGenElement.ReturnValues[0].Actual);
        }
Example #7
0
        public void GetBrowserLogTest()
        {
            //arrange
            ActBrowserElement actBrowser = new ActBrowserElement()
            {
                Active = true
            };

            actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser.GetOrCreateInputParam("Value", "www.facebook.com");

            mGR.CurrentBusinessFlow.CurrentActivity.Acts.Add(actBrowser);

            ActBrowserElement actBrowser2 = new ActBrowserElement()
            {
                Active = true, AddNewReturnParams = true
            };

            actBrowser2.ControlAction = ActBrowserElement.eControlAction.GetBrowserLog;
            mGR.CurrentBusinessFlow.CurrentActivity.Acts.Add(actBrowser2);

            //act
            mGR.RunActivity(mGR.CurrentBusinessFlow.CurrentActivity);

            //assert
            Assert.AreNotEqual(0, actBrowser2.ReturnValues.Count);
            Assert.AreEqual(true, actBrowser2.ReturnValues.FirstOrDefault().FileName.Contains("www.facebook.com"));
        }
        public ActBrowserElementEditPage(ActBrowserElement act)
        {
            InitializeComponent();
            mAct = act;

            if (act.Platform == ePlatformType.NA)
            {
                act.Platform = GetActionPlatform();
            }
            mPlatform = PlatformInfoBase.GetPlatformImpl(act.Platform);

            List <ActBrowserElement.eControlAction> supportedControlActions = mPlatform.GetPlatformBrowserControlOperations();

            //validate operation is valid
            if (supportedControlActions.Contains(mAct.ControlAction) == false)
            {
                mAct.ControlAction = supportedControlActions[0];
            }

            //bind controls
            GingerCore.General.FillComboFromEnumObj(xControlActionComboBox, mAct.ControlAction, supportedControlActions.Cast <object>().ToList());
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xControlActionComboBox, ComboBox.SelectedValueProperty, mAct, ActBrowserElement.Fields.ControlAction);

            ValueUC.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam("Value"));
            xLocateValueVE.BindControl(Context.GetAsContext(mAct.Context), mAct, Act.Fields.LocateValue);
            xGotoURLTypeRadioButton.Init(typeof(ActBrowserElement.eGotoURLType), xGotoURLTypeRadioButtonPnl, mAct.GetOrCreateInputParam(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.Current.ToString()));
            xURLSrcRadioButton.Init(typeof(ActBrowserElement.eURLSrc), xURLSrcRadioButtonPnl, mAct.GetOrCreateInputParam(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString()), URLSrcRadioButton_Clicked);
            xElementLocateByComboBox.BindControl(mAct, Act.Fields.LocateBy);
            xImplicitWaitVE.BindControl(Context.GetAsContext(mAct.Context), mAct, ActBrowserElement.Fields.ImplicitWait);

            SetVisibleControlsForAction();
        }
Example #9
0
        public void WaitTillPageLoaded()
        {
            //Arrange
            ActBrowserElement actBrowser = new ActBrowserElement();

            actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString());
            actBrowser.GetOrCreateInputParam("Value", "https://ginger.amdocs.com/");
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.Current.ToString());

            ActBrowserElement actBrowser1 = new ActBrowserElement();

            actBrowser1.ControlAction = ActBrowserElement.eControlAction.CheckPageLoaded;

            ActBrowserElement actBrowser2 = new ActBrowserElement();

            actBrowser2.ControlAction      = ActBrowserElement.eControlAction.GetWindowTitle;
            actBrowser2.AddNewReturnParams = true;

            //Act
            mGR.RunAction(actBrowser, false);
            mGR.RunAction(actBrowser1, false);
            mGR.RunAction(actBrowser2, false);

            //Assert
            Assert.AreEqual(eRunStatus.Passed, actBrowser2.Status, "Action Status");
            Assert.AreEqual("Ginger By Amdocs", actBrowser2.ReturnValues[0].Actual);
        }
Example #10
0
        public ActBrowserElementEditPage(ActBrowserElement act)
        {
            InitializeComponent();
            mAct = act;

            if (act.Platform == ePlatformType.NA)
            {
                act.Platform = GetActivityPlatform();
            }
            mPlatform = PlatformInfoBase.GetPlatformImpl(act.Platform);

            List <ActBrowserElement.eControlAction> supportedControlActions = mPlatform.GetPlatformBrowserControlOperations();

            //bind controls
            App.FillComboFromEnumVal(xControlActionComboBox, mAct.ControlAction, supportedControlActions.Cast <object>().ToList());
            App.ObjFieldBinding(xControlActionComboBox, ComboBox.SelectedValueProperty, mAct, ActBrowserElement.Fields.ControlAction);

            ValueUC.Init(mAct.GetOrCreateInputParam("Value"));
            xLocateValueVE.BindControl(mAct, Act.Fields.LocateValue);
            xGotoURLTypeRadioButton.Init(typeof(ActBrowserElement.eGotoURLType), xGotoURLTypeRadioButtonPnl, mAct.GetOrCreateInputParam(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.Current.ToString()));
            xElementLocateByComboBox.BindControl(mAct, Act.Fields.LocateBy);
            xImplicitWaitVE.BindControl(mAct, ActBrowserElement.Fields.ImplicitWait);

            SetVisibleControlsForAction();
        }
Example #11
0
        public void SwitchToParentFrame()
        {
            //Arrange
            ActBrowserElement actBrowser = new ActBrowserElement();

            actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString());
            actBrowser.GetOrCreateInputParam("Value", "http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_frame_cols");
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.Current.ToString());

            ActBrowserElement actBrowser1 = new ActBrowserElement();

            actBrowser1.ControlAction = ActBrowserElement.eControlAction.SwitchToParentFrame;

            ActBrowserElement actBrowser2 = new ActBrowserElement();

            actBrowser2.ControlAction = ActBrowserElement.eControlAction.SwitchToParentFrame;

            ActBrowserElement actBrowser3 = new ActBrowserElement();

            actBrowser3.ControlAction = ActBrowserElement.eControlAction.SwitchFrame;
            actBrowser3.LocateBy      = Amdocs.Ginger.Common.UIElement.eLocateBy.ByXPath;
            actBrowser3.LocateValue   = "//*[@id='iframeResult']";

            ActBrowserElement actBrowser4 = new ActBrowserElement();

            actBrowser4.ControlAction = ActBrowserElement.eControlAction.SwitchFrame;
            actBrowser4.LocateBy      = Amdocs.Ginger.Common.UIElement.eLocateBy.ByXPath;
            actBrowser4.LocateValue   = "/html/frameset/frame[2]";

            ActUIElement actUIElement = new ActUIElement();

            actUIElement.ElementLocateBy    = Amdocs.Ginger.Common.UIElement.eLocateBy.ByXPath;
            actUIElement.ElementLocateValue = "/html/body/h3";
            actUIElement.ElementType        = Amdocs.Ginger.Common.UIElement.eElementType.Label;
            actUIElement.ElementAction      = GingerCore.Actions.Common.ActUIElement.eElementAction.GetValue;
            actUIElement.AddNewReturnParams = true;

            //Act
            mGR.RunAction(actBrowser, false);
            mGR.RunAction(actBrowser1, false);
            mGR.RunAction(actBrowser2, false);
            mGR.RunAction(actBrowser3, false);
            mGR.RunAction(actBrowser4, false);
            mGR.RunAction(actUIElement, false);

            //Assert
            Assert.AreEqual(eRunStatus.Passed, actUIElement.Status, "Action Status");
            Assert.AreEqual("Frame B", actUIElement.ReturnValues[0].Actual);
        }
Example #12
0
        public ActBrowserElementEditPage(ActBrowserElement act)
        {
            InitializeComponent();
            mAct = act;

            //TODO: use .Fields
            App.FillComboFromEnumVal(ControlActionComboBox, mAct.ControlAction);
            App.ObjFieldBinding(ControlActionComboBox, ComboBox.SelectedValueProperty, mAct, ActBrowserElement.Fields.ControlAction);
            ValueUC.Init(mAct.GetOrCreateInputParam("Value"));
            LocateValueVE.BindControl(mAct, Act.Fields.LocateValue);
            GotoURLTypeRadioButton.Init(typeof(ActBrowserElement.eGotoURLType), GotoURLRadioButton, mAct.GetOrCreateInputParam(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.Current.ToString()));
            ElementLocateByComboBox.BindControl(mAct, Act.Fields.LocateBy);
            ImplicitWaitVE.BindControl(mAct, ActBrowserElement.Fields.ImplicitWait);
            SetVisibleControlsForAction();
        }
Example #13
0
        public void OpenURLInNewTab()
        {
            //Arrange
            ActBrowserElement actBrowser = new ActBrowserElement();

            actBrowser.ControlAction = ActBrowserElement.eControlAction.OpenURLNewTab;
            actBrowser.GetOrCreateInputParam("Value", "www.gmail.com");

            //Act
            mGR.RunAction(actBrowser, false);

            //Assert
            Assert.AreEqual(eRunStatus.Passed, actBrowser.Status, "Action Status");

            //validate using getpageurl
            ActBrowserElement actGetPageURL = ValidatePageURL();

            Assert.AreEqual(eRunStatus.Passed, actGetPageURL.Status, "Action Status");
        }
Example #14
0
        public void MaximizeWindow()
        {
            //Arrange
            ActBrowserElement actBrowser = new ActBrowserElement();

            actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString());
            actBrowser.GetOrCreateInputParam("Value", "www.gmail.com");
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.NewWindow.ToString());
            ActBrowserElement actBrowser1 = new ActBrowserElement();

            actBrowser1.ControlAction = ActBrowserElement.eControlAction.Maximize;

            //Act
            mGR.RunAction(actBrowser, false);
            mGR.RunAction(actBrowser1, false);

            //Assert
            Assert.AreEqual(eRunStatus.Passed, actBrowser1.Status, "Action Status");
        }
Example #15
0
        public void GotoURLWithNewWindow()
        {
            //Arrange
            ActBrowserElement actBrowser = new ActBrowserElement();

            actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString());
            actBrowser.GetOrCreateInputParam("Value", "www.gmail.com");
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.NewWindow.ToString());

            //Act
            mGR.RunAction(actBrowser, false);

            //Assert
            Assert.AreEqual(eRunStatus.Passed, actBrowser.Status, "Action Status");

            //validate using getpageurl
            ActBrowserElement actGetPageURL = ValidatePageURL();

            Assert.AreEqual(eRunStatus.Passed, actGetPageURL.Status, "Action Status");
        }
Example #16
0
        public void SwitchWindowByIndex()
        {
            //Arrange
            ActBrowserElement actBrowser = new ActBrowserElement();

            actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString());
            actBrowser.GetOrCreateInputParam("Value", "www.google.com");
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.Current.ToString());

            ActBrowserElement actBrowser1 = new ActBrowserElement();

            actBrowser1.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser1.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString());
            actBrowser1.GetOrCreateInputParam("Value", "www.gmail.com");
            actBrowser1.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.NewTab.ToString());

            ActBrowserElement actBrowser2 = new ActBrowserElement();

            actBrowser2.ControlAction = ActBrowserElement.eControlAction.SwitchWindow;
            actBrowser2.LocateBy      = Amdocs.Ginger.Common.UIElement.eLocateBy.ByIndex;
            actBrowser2.LocateValue   = "1";

            //validation
            ActBrowserElement actBrowser3 = new ActBrowserElement();

            actBrowser3.ControlAction      = ActBrowserElement.eControlAction.GetWindowTitle;
            actBrowser3.AddNewReturnParams = true;

            //Act
            mGR.RunAction(actBrowser, false);
            mGR.RunAction(actBrowser1, false);
            mGR.RunAction(actBrowser2, false);
            mGR.RunAction(actBrowser3, false);

            //Assert
            Assert.AreEqual(eRunStatus.Passed, actBrowser2.Status, "Action Status");
            Assert.IsTrue(actBrowser3.ReturnValues[0].Actual.Contains("Gmail"), "Gmail");
        }
Example #17
0
        public void InjectJavaScript()
        {
            //Arrange
            ActBrowserElement actBrowser = new ActBrowserElement();

            actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString());
            actBrowser.GetOrCreateInputParam("Value", "www.google.com");
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.NewWindow.ToString());

            ActBrowserElement actBrowser1 = new ActBrowserElement();

            actBrowser1.ControlAction = ActBrowserElement.eControlAction.InjectJS;
            actBrowser1.GetOrCreateInputParam("Value", "document.getElementById('hplogo');");
            actBrowser1.AddNewReturnParams = true;

            //Act
            mGR.RunAction(actBrowser, false);
            mGR.RunAction(actBrowser1, false);

            //Assert
            Assert.AreEqual(eRunStatus.Passed, actBrowser1.Status, "Action Status");
            Assert.AreEqual(0, actBrowser1.ReturnValues.Count);
        }
Example #18
0
        public void CloseTabExceptByTitle()
        {
            //Arrange
            ActBrowserElement actBrowser = new ActBrowserElement();

            actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString());
            actBrowser.GetOrCreateInputParam("Value", "www.gmail.com");
            actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.NewTab.ToString());

            ActBrowserElement actBrowser1 = new ActBrowserElement();

            actBrowser1.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser1.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString());
            actBrowser1.GetOrCreateInputParam("Value", "https://opensource-demo.orangehrmlive.com/");
            actBrowser1.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.NewTab.ToString());

            ActBrowserElement actBrowser2 = new ActBrowserElement();

            actBrowser2.ControlAction = ActBrowserElement.eControlAction.CloseTabExcept;
            actBrowser2.LocateBy      = Amdocs.Ginger.Common.UIElement.eLocateBy.ByTitle;
            actBrowser2.LocateValue   = "OrangeHRM";

            //Act
            mGR.RunAction(actBrowser, false);
            mGR.RunAction(actBrowser1, false);
            mGR.RunAction(actBrowser2, false);

            //Assert
            Assert.AreEqual(eRunStatus.Passed, actBrowser2.Status, "Action Status");

            //validate using getpageurl
            ActBrowserElement actGetPageURL = ValidatePageURL();

            Assert.AreEqual(eRunStatus.Passed, actGetPageURL.Status, "Action Status");
        }
Example #19
0
        public void SetUserAgentTest()
        {
            //arrange
            Activity activity = new Activity();

            mBF.Activities.Add(activity);
            mBF.CurrentActivity = activity;

            Platform p = new Platform();

            p.PlatformType = ePlatformType.Web;
            mBF.TargetApplications.Add(new TargetApplication()
            {
                AppName = "DeviceEmulationUserAgent"
            });
            mBF.CurrentActivity.TargetApplication = "DeviceEmulationUserAgent";

            var mDriver = new SeleniumDriver(GingerCore.Drivers.SeleniumDriver.eBrowserType.Chrome);

            mDriver.AutoDetect        = true;
            mDriver.HttpServerTimeOut = 60;
            //Set Browser User Agent
            mDriver.BrowserUserAgent = "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1";
            mDriver.BrowserHeight    = "960";
            mDriver.BrowserWidth     = "600";

            mDriver.StartDriver();

            Agent agent = new Agent();

            agent.Active     = true;
            agent.Driver     = mDriver;
            agent.DriverType = Agent.eDriverType.SeleniumChrome;
            mGR.SolutionAgents.Add(agent);

            ApplicationAgent AA = new ApplicationAgent();

            AA.AppName = "DeviceEmulationUserAgent";
            AA.Agent   = agent;

            mGR.ApplicationAgents.Add(AA);
            mGR.CurrentBusinessFlow = mBF;
            mGR.CurrentBusinessFlow.CurrentActivity = activity;

            mGR.SetCurrentActivityAgent();

            ActBrowserElement actBrowser = new ActBrowserElement();

            actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser.GetOrCreateInputParam("Value", "http://www.google.com");
            actBrowser.Active = true;
            activity.Acts.Add(actBrowser);

            //act

            //get user agent string
            ActBrowserElement actBrowser2 = new ActBrowserElement();

            actBrowser2.ControlAction = ActBrowserElement.eControlAction.RunJavaScript;
            actBrowser2.GetOrCreateInputParam("Value", "navigator.userAgent");
            actBrowser2.Active             = true;
            actBrowser2.AddNewReturnParams = true;
            activity.Acts.Add(actBrowser2);

            mGR.RunActivity(activity);

            //assert
            Assert.AreEqual(true, actBrowser2.ReturnValues.FirstOrDefault().Actual.Contains("iPad"));
        }
Example #20
0
        public void SetEmulationDeviceNameTest()
        {
            //arrange
            Activity activity = new Activity();

            mBF.Activities.Add(activity);
            mBF.CurrentActivity = activity;

            Platform p = new Platform();

            p.PlatformType = ePlatformType.Web;
            mBF.TargetApplications.Add(new TargetApplication()
            {
                AppName = "DeviceEmulation"
            });
            mBF.CurrentActivity.TargetApplication = "DeviceEmulation";

            var mDriver = new SeleniumDriver(GingerCore.Drivers.SeleniumDriver.eBrowserType.Chrome);

            mDriver.AutoDetect        = true;
            mDriver.HttpServerTimeOut = 60;
            //Set emulation device name
            mDriver.EmulationDeviceName = "iPad";
            mDriver.StartDriver();

            Agent agent = new Agent();

            agent.Active     = true;
            agent.Driver     = mDriver;
            agent.DriverType = Agent.eDriverType.SeleniumChrome;
            mGR.SolutionAgents.Add(agent);

            ApplicationAgent AA = new ApplicationAgent();

            AA.AppName = "DeviceEmulation";
            AA.Agent   = agent;

            mGR.ApplicationAgents.Add(AA);
            mGR.CurrentBusinessFlow = mBF;
            mGR.CurrentBusinessFlow.CurrentActivity = activity;

            mGR.SetCurrentActivityAgent();

            ActBrowserElement actBrowser = new ActBrowserElement();

            actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL;
            actBrowser.GetOrCreateInputParam("Value", "http://www.google.com");
            actBrowser.Active = true;
            activity.Acts.Add(actBrowser);

            //act
            ActBrowserElement actBrowser2 = new ActBrowserElement();

            actBrowser2.ControlAction = ActBrowserElement.eControlAction.RunJavaScript;
            actBrowser2.GetOrCreateInputParam("Value", "navigator.userAgent");
            actBrowser2.Active             = true;
            actBrowser2.AddNewReturnParams = true;
            activity.Acts.Add(actBrowser2);

            mGR.RunActivity(activity);

            //assert
            Assert.AreEqual(true, actBrowser2.ReturnValues.FirstOrDefault().Actual.Contains("iPad"));
        }