Example #1
0
        private void AddActSubmit(ActSubmit act)
        {
            string s = GetDriverfindElem(act.LocateBy, act.LocateValue);

            s += ".Submit();";
            WriteLine(s);
        }
Example #2
0
        public void SCM_Login()
        {
            //Arrange

            ResetBusinessFlow();

            // mGR.SetSpeed(1);

            Activity a1 = new Activity();

            a1.Active            = true;
            a1.TargetApplication = "SCM";
            mBF.Activities.Add(a1);

            ActGotoURL act1 = new ActGotoURL()
            {
                LocateBy = eLocateBy.NA, Value = "https://ginger-automation.github.io/test.html", Active = true
            };

            a1.Acts.Add(act1);

            ActTextBox act2 = new ActTextBox()
            {
                LocateBy = eLocateBy.ByID, LocateValue = "UserName", Value = "Yaron", TextBoxAction = ActTextBox.eTextBoxAction.SetValue, Active = true
            };

            a1.Acts.Add(act2);

            ActTextBox act3 = new ActTextBox()
            {
                LocateBy = eLocateBy.ByID, LocateValue = "Password", Value = "123456", TextBoxAction = ActTextBox.eTextBoxAction.SetValue, Active = true
            };

            a1.Acts.Add(act3);

            ActSubmit act4 = new ActSubmit()
            {
                LocateBy = eLocateBy.ByValue, LocateValue = "Log in", Active = true
            };

            a1.Acts.Add(act4);

            VariableString v1 = (VariableString)mBF.GetVariable("v1");

            v1.Value = "123";

            //Act
            mGR.RunRunner();
            // mGR.CurrentBusinessFlow = mBF;
            // mGR.RunActivity(a1);

            //Assert
            Assert.AreEqual(mBF.RunStatus, eRunStatus.Passed);
            Assert.AreEqual(a1.Status, eRunStatus.Passed);
            Assert.AreEqual(act1.Status, eRunStatus.Passed);
            Assert.AreEqual(act2.Status, eRunStatus.Passed);
            Assert.AreEqual(act3.Status, eRunStatus.Passed);
            Assert.AreEqual(act4.Status, eRunStatus.Passed);

            Assert.AreEqual(v1.Value, "123");
        }
Example #3
0
        public static HTMLReportPage GetSampleReportPage(string Xaml)
        {
            BusinessFlow BF1 = new BusinessFlow()
            {
                Name = "BF1 - Create Customer", Description = "Create any type of customer: Business/Residential..."
            };

            BF1.Active     = true;
            BF1.RunStatus  = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed;
            BF1.Activities = new ObservableList <Activity>();
            BF1.Elapsed    = 2364;

            //Activity 1
            Activity a1 = new Activity()
            {
                ActivityName = "Launch Application & Login", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed
            };

            BF1.Activities.Add(a1);

            ActGotoURL act1 = new ActGotoURL()
            {
                Description = "Goto URL www.abcd.com", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed, Elapsed = 3124
            };

            a1.Acts.Add(act1);

            ActReturnValue ARV1 = new ActReturnValue();

            ARV1.Param    = "RC";
            ARV1.Expected = "123";
            ARV1.Actual   = "123";
            ARV1.Status   = ActReturnValue.eStatus.Passed;
            act1.ReturnValues.Add(ARV1);
            ActTextBox act2 = new ActTextBox()
            {
                Description = "Enter User ID", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed, Elapsed = 230
            };
            // Add sample screen shot
            Bitmap tempBmp = new Bitmap(Ginger.Properties.Resources.ScreenShot1);

            act2.ScreenShots.Add(GingerCore.General.BitmapImageToFile(tempBmp));

            a1.Acts.Add(act2);

            ActTextBox act3 = new ActTextBox()
            {
                Description = "Enter Password", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed, Elapsed = 112
            };

            a1.Acts.Add(act3);

            ActSubmit act4 = new ActSubmit()
            {
                Description = "Click Submit Button", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed, Elapsed = 1282
            };

            a1.Acts.Add(act4);

            //Activity 2
            Activity a2 = new Activity()
            {
                ActivityName = "Create New customer", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed
            };

            BF1.Activities.Add(a2);

            ActTextBox acta21 = new ActTextBox()
            {
                Description = "Enter First Name", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed, Elapsed = 325
            };

            a2.Acts.Add(acta21);

            ActTextBox acta22 = new ActTextBox()
            {
                Description = "Enter Last Name", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed, Elapsed = 302
            };

            a2.Acts.Add(acta22);

            ActTextBox acta23 = new ActTextBox()
            {
                Description = "Enter City", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed, Elapsed = 820, Error = "Error: Element not found by ID 'City'", ExInfo = "Cannot find element"
            };

            a2.Acts.Add(acta23);

            ActSubmit acta24 = new ActSubmit()
            {
                Description = "Click Create Button", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Pending
            };

            a2.Acts.Add(acta24);

            //Add Variables
            BF1.Variables = new ObservableList <VariableBase>();

            VariableString v1 = new VariableString()
            {
                Name = "FirstName", Value = "David Smith"
            };

            BF1.Variables.Add(v1);

            VariableRandomNumber v2 = new VariableRandomNumber()
            {
                Name = "Random 1", Min = 1, Max = 100, Value = "55"
            };

            BF1.Variables.Add(v2);

            //Add a few simple BFs
            BusinessFlow BF2 = new BusinessFlow()
            {
                Name = "BF2 - Customer Order Product", Description = "", Active = true
            };

            BF2.Activities = new ObservableList <Activity>();
            BF2.RunStatus  = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;
            BF2.Elapsed    = 1249;

            ProjEnvironment env = new ProjEnvironment()
            {
                Name = "Env1"
            };
            //TODO: add more env info

            //cretae dummy GR, GMR
            RunsetExecutor GMR = new RunsetExecutor();

            GingerRunner GR = new GingerRunner();

            GR.BusinessFlows.Add(BF1);
            GR.BusinessFlows.Add(BF2);
            GR.CurrentSolution = WorkSpace.UserProfile.Solution;
            GMR.Runners.Add(GR);

            ReportInfo     RI = new ReportInfo(env, GMR);
            HTMLReportPage RP = new HTMLReportPage(RI, Xaml);

            return(RP);
        }