public void DrawObject() { ResetBusinessFlow(); Activity a1 = new Activity(); a1.Active = true; a1.TargetApplication = "WebApp"; mBF.Activities.Add(a1); ActGotoURL act1 = new ActGotoURL() { LocateBy = eLocateBy.NA, Value = "http://szimek.github.io/signature_pad/", Active = true }; // ActGotoURL act1 = new ActGotoURL() { LocateBy = eLocateBy.NA, Value = "https://www.youidraw.com/apps/painter/", Active = true }; a1.Acts.Add(act1); ActUIElement act3 = new ActUIElement(); act3.ElementLocateBy = eLocateBy.ByXPath; act3.GetOrCreateInputParam(ActUIElement.Fields.ElementLocateValue, "//*[@id='signature-pad']/div[1]/canvas"); // act3.GetOrCreateInputParam(ActUIElement.Fields.ElementLocateValue, "//*[@id='painter']"); act3.ElementAction = ActUIElement.eElementAction.DrawObject; act3.Active = true; a1.Acts.Add(act3); mGR.RunRunner(); Assert.AreEqual(mBF.RunStatus, eRunStatus.Passed); Assert.AreEqual(a1.Status, eRunStatus.Passed); Assert.AreEqual(act1.Status, eRunStatus.Passed); Assert.AreEqual(act3.Status, eRunStatus.Passed); }
public void ActionVariableDependancyTest_WithCreateInstance() { //Arrange Activity activity = new Activity(); VariableSelectionList selectionList = new VariableSelectionList(); selectionList.OptionalValuesList.Add(new OptionalValue("a")); selectionList.OptionalValuesList.Add(new OptionalValue("b")); VariableDependency vd = new VariableDependency(selectionList.Guid, selectionList.ItemName, selectionList.Value); ActGotoURL actGotoURL = new ActGotoURL(); actGotoURL.Description = "www.google.com"; actGotoURL.VariablesDependencies.Add(vd); ActDummy act2 = new ActDummy(); actGotoURL.Description = "www.google.com"; actGotoURL.VariablesDependencies.Add(vd); activity.Variables.Add(selectionList); activity.Acts.Add(actGotoURL); activity.Acts.Add(act2); //Act Activity copyActivity = (Activity)activity.CreateInstance(); //Assert Assert.AreEqual(copyActivity.Variables[0].Guid, copyActivity.Acts[0].VariablesDependencies[0].VariableGuid); }
public void DragAndDropJS() { ResetBusinessFlow(); Activity a1 = new Activity(); a1.Active = true; a1.TargetApplication = "WebApp"; mBF.Activities.Add(a1); ActGotoURL act1 = new ActGotoURL() { LocateBy = eLocateBy.NA, Value = "https://www.w3schools.com/html/html5_draganddrop.asp", Active = true }; a1.Acts.Add(act1); ActUIElement act2 = new ActUIElement(); act2.ElementLocateBy = eLocateBy.ByXPath; act2.GetOrCreateInputParam(ActUIElement.Fields.ElementLocateValue, "//*[@id='drag1']"); act2.ElementAction = ActUIElement.eElementAction.DragDrop; act2.GetOrCreateInputParam(ActUIElement.Fields.DragDropType, ActUIElement.eElementDragDropType.DragDropJS.ToString()); act2.TargetLocateBy = eLocateBy.ByXPath; act2.GetOrCreateInputParam(ActUIElement.Fields.TargetLocateValue, "//*[@id='div2']"); act2.Active = true; a1.Acts.Add(act2); mGR.RunRunner(); Assert.AreEqual(mBF.RunStatus, eRunStatus.Passed); Assert.AreEqual(a1.Status, eRunStatus.Passed); Assert.AreEqual(act1.Status, eRunStatus.Passed); Assert.AreEqual(act2.Status, eRunStatus.Passed); }
public void Test_CalculateActivityStatus_FailedAction_Then_Stop() { Activity a1 = new Activity(); a1.Active = true; mBF.Activities.Add(a1); //Arrange ActGotoURL act1 = new ActGotoURL() { LocateBy = eLocateBy.NA, Value = "https://ginger-automation.github.io/test.html", Active = true, Status = eRunStatus.Failed }; act1.Error = "Cannot go to URL"; a1.Acts.Add(act1); ActDummy act3 = new ActDummy() { Description = "A3", Active = true, Status = eRunStatus.Stopped }; a1.Acts.Add(act3); //act3.FlowControls.Add(new GingerCore.FlowControlLib.FlowControl() { Condition = "1=1", FlowControlAction = GingerCore.FlowControlLib.FlowControl.eFlowControlAction.StopRun, Active = true }); //Act mGR.CalculateActivityFinalStatus(a1); //Assert // since there is no failure we assume pass Assert.AreEqual(a1.Status, eRunStatus.Stopped, "a1.Status=eRunStatus.Stopped"); }
public void BizFlowSaveLoad() { //Arrange int ActivitiesToCreate = 5; //Act BusinessFlow BF = new BusinessFlow(); BF.Name = "Biz flow 1"; BF.Description = "Desc 1"; //BF.Status = BusinessFlow.eBusinessFlowStatus.Active; //TODOL do NOT write to XML if null or empty BF.Activities = new ObservableList <Activity>(); for (int i = 1; i <= ActivitiesToCreate; i++) { Activity a = new Activity(); a.ActivityName = "Activity number " + i; a.Description = "Desc - " + i; BF.Activities.Add(a); a.Status = eRunStatus.Passed; for (int j = 1; j <= 2; j++) { ActTextBox t = new ActTextBox(); t.Description = "Set text box " + j; t.LocateBy = eLocateBy.ByID; t.LocateValue = "ID" + j; a.Acts.Add(t); ActGotoURL g = new ActGotoURL(); g.Description = "goto URL " + j; g.LocateValue = "ID" + j; a.Acts.Add(g); } } VariableString v = new VariableString(); v.Name = "Var1"; v.Description = "VDesc 1"; BF.AddVariable(v); string FileName = TestResources.GetTempFile("bf1.xml"); BF.RepositorySerializer.SaveToFile(BF, FileName); // Assert NewRepositorySerializer newRepositorySerializer = new NewRepositorySerializer(); BusinessFlow BF2 = (BusinessFlow)newRepositorySerializer.DeserializeFromFile(typeof(BusinessFlow), FileName); Assert.AreEqual(BF2.Name, BF.Name); Assert.AreEqual(BF2.Description, BF.Description); Assert.AreEqual(BF2.Activities.Count, ActivitiesToCreate); Assert.AreEqual(BF2.Variables.Count, 1); //Validations }
public void BizFlowCheckIsDirtyTrue() { //Arrange int ActivitiesToCreate = 2; string TempFilepath = TestResources.GetTempFile("bfIsDirtyTrue.xml"); BusinessFlow BF = new BusinessFlow(); BF.Name = "Biz flow 1"; BF.Description = "Desc 1"; //BF.Status = BusinessFlow.eBusinessFlowStatus.Active; //TODOL do NOT write to XML if null or empty BF.Activities = new ObservableList <Activity>(); for (int i = 1; i <= ActivitiesToCreate; i++) { Activity a = new Activity(); a.ActivityName = "Activity number " + i; a.Description = "Desc - " + i; BF.Activities.Add(a); a.Status = eRunStatus.Passed; for (int j = 1; j <= 2; j++) { ActTextBox t = new ActTextBox(); t.Description = "Set text box " + j; t.LocateBy = eLocateBy.ByID; t.LocateValue = "ID" + j; a.Acts.Add(t); ActGotoURL g = new ActGotoURL(); g.Description = "goto URL " + j; g.LocateValue = "ID" + j; a.Acts.Add(g); } } VariableString v = new VariableString(); v.Name = "Var1"; v.Description = "VDesc 1"; BF.AddVariable(v); //Act BF.RepositorySerializer.SaveToFile(BF, TempFilepath); // Assert NewRepositorySerializer newRepositorySerializer = new NewRepositorySerializer(); BusinessFlow BF2 = (BusinessFlow)newRepositorySerializer.DeserializeFromFile(typeof(BusinessFlow), TempFilepath); BF2.StartDirtyTracking(); BF2.Description = "aaa"; Assert.IsTrue(BF2.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.Modified); }
public void BizFlowCheckIsDirtyTrue() { //Arrange int ActivitiesToCreate = 2; string TempFilepath = TestResources.GetTempFile("bfIsDirtyTrue.xml"); BusinessFlow BF = new BusinessFlow(); BF.Name = "Biz flow 1"; BF.Description = "Desc 1"; //BF.Status = BusinessFlow.eBusinessFlowStatus.Active; //TODOL do NOT write to XML if null or empty BF.Activities = new ObservableList <Activity>(); for (int i = 1; i <= ActivitiesToCreate; i++) { Activity a = new Activity(); a.ActivityName = "Activity number " + i; a.Description = "Desc - " + i; BF.Activities.Add(a); a.Status = eRunStatus.Passed; for (int j = 1; j <= 2; j++) { ActTextBox t = new ActTextBox(); t.Description = "Set text box " + j; t.LocateBy = eLocateBy.ByID; t.LocateValue = "ID" + j; a.Acts.Add(t); ActGotoURL g = new ActGotoURL(); g.Description = "goto URL " + j; g.LocateValue = "ID" + j; a.Acts.Add(g); } } VariableString v = new VariableString(); v.Name = "Var1"; v.Description = "VDesc 1"; BF.AddVariable(v); //Act BF.SaveToFile(TempFilepath); // Assert BusinessFlow BF2 = (BusinessFlow)RepositoryItem.LoadFromFile(typeof(BusinessFlow), TempFilepath); BF2.SaveBackup();//dirty now just indicate if backup exist BF2.Description = "aaa"; Assert.IsTrue(BF2.IsDirty); }
public void TestInitialize() { mDriver = new SeleniumDriver(SeleniumDriver.eBrowserType.Chrome);//having Firefox issue on CMI server mDriver.StartDriver(); ActGotoURL a = new ActGotoURL(); a.ValueForDriver = TestResources.GetTestResourcesFile(@"HTML\JSPayLoad.html"); mDriver.RunAction(a); mDriver.InjectGingerHTMLHelper(); }
public void CreateDuplicationAction() { //Arrange ActGotoURL actGotoURL = new ActGotoURL(); actGotoURL.Description = "www.google.com"; //Act ActGotoURL a2 = (ActGotoURL)actGotoURL.CreateCopy(); //Assert Assert.AreEqual(actGotoURL.Description, a2.Description); }
public void Activity_With_Action_Pass() { //Arrange //string ParamName = "p1"; //ActGotoURL act1 = new ActGotoURL() { LocateBy = Act.eLocatorType.NA, Value = "https://ginger-automation.github.io/test.html", Active = true }; //act1.AddOrUpdateReturnParam(ParamName, "378"); //act1.AddOrUpdateExpectedParam(ParamName, "37"); // failed due to regex ////Act //mGR.CalculateActionFinalStatus(act1); ////Assert //// since there is no failure we assume pass //Assert.AreEqual(act1.Status, eRunStatus.Fail, "act1.Status=eRunStatus.Fail"); //ActReturnValue RV = act1.GetReturnValue(ParamName); //Assert.AreEqual(RV.Status, ActReturnValue.eStatus.Fail, "RV.Status, ActReturnValue.eStatus.Fail"); Activity a1 = new Activity(); a1.Active = true; 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); mGR.RunRunner(); Assert.AreEqual(a1.Status, eRunStatus.Passed, "a1.Status=eRunStatus.Passed"); }
private void GotoURL(ActGotoURL act) { string sURL = act.ValueForDriver.ToLower(); if (sURL.StartsWith("www")) { sURL = "http://" + act.ValueForDriver; } else { sURL = act.ValueForDriver; } Driver.Navigate().GoToUrl(sURL); }
public void Simple_Act() { //Arrange ActGotoURL act1 = new ActGotoURL() { LocateBy = eLocateBy.NA, Value = "https://ginger-automation.github.io/test.html", Active = true }; //Act mGR.CalculateActionFinalStatus(act1); //Assert // since there is no failure we assume pass Assert.AreEqual(act1.Status, eRunStatus.Passed, "act1.Status=eRunStatus.Passed"); }
public void GoToPageURL() { if (mWinExplorer == null) { Reporter.ToUser(eUserMsgKey.POMAgentIsNotRunning); return; } ActGotoURL act = new ActGotoURL() { LocateBy = eLocateBy.NA, Value = mPOM.PageURL, ValueForDriver = mPOM.PageURL, Active = true }; mAgent.Driver.RunAction(act); }
public void LoadCommonFunctionMapping(object sender, RoutedEventArgs e) { //TODO: remove when save/load is working temp for testing only CommonFunctionMapping CFM1 = new CommonFunctionMapping(); ActGenElement a = new ActGenElement() { Description = "Click Web Element - {Param0}" }; CFM1.Function_Name = "ClickWebElement"; CFM1.TargetAction = a; mCommonFunctionConvertor.CommonFunctionMappingList.Add(CFM1); CommonFunctionMapping CFM2 = new CommonFunctionMapping(); ActGotoURL a2 = new ActGotoURL() { Description = "Goto URL - {Param1}" }; CFM2.Function_Name = "GotoURL"; CFM2.TargetAction = a2; mCommonFunctionConvertor.CommonFunctionMappingList.Add(CFM2); CommonFunctionMapping CFM3 = new CommonFunctionMapping(); ActGenElement a3 = new ActGenElement(); a3.Description = "General Web Element - WebEditTxt"; a3.LocateBy = eLocateBy.ByName; a3.LocateValue = "{OR ObjName={Param1} PropName=_path}"; CFM3.Function_Name = "WebEditTxtChange"; CFM3.TargetAction = a3; mCommonFunctionConvertor.CommonFunctionMappingList.Add(CFM3); CommonFunctionMapping CFM4 = new CommonFunctionMapping(); ActGenElement a4 = new ActGenElement(); a4.Description = "General Web Element - WebButtonClick"; a4.LocateBy = eLocateBy.ByName; a4.LocateValue = "{OR ObjName={Param1} PropName=name}"; CFM4.Function_Name = "WebButtonClick"; CFM4.TargetAction = a4; mCommonFunctionConvertor.CommonFunctionMappingList.Add(CFM4); //temp TODO: fix me to select file // Use load after repo is fixed CommonFunctionMappingUCGrid.DataSourceList = mCommonFunctionConvertor.CommonFunctionMappingList; }
public void GoToPageURL() { if (mWinExplorer == null) { Reporter.ToUser(eUserMsgKey.POMAgentIsNotRunning); return; } string calculatedValue = ValueExpression.Calculate(null, null, mPOM.PageURL, null); ActGotoURL act = new ActGotoURL() { LocateBy = eLocateBy.NA, Value = calculatedValue, ValueForDriver = calculatedValue, Active = true }; mAgent.Driver.RunAction(act); }
public void ActivitiesClearBackup() { //Arrange BusinessFlow BF = new BusinessFlow(); string FileName = TestResources.GetTempFile("activityClearBackup.xml"); BF.Name = "Businessflow1"; BF.Description = "Test Clear Backup"; BF.Activities = new ObservableList <Activity>(); Activity a = new Activity() { ActivityName = "Activity 1", Description = "Desciption -1", Status = eRunStatus.Passed }; BF.Activities.Add(a); ActTextBox t = new ActTextBox() { Description = "Set text box ", LocateBy = eLocateBy.ByID, LocateValue = "ID" }; a.Acts.Add(t); //Act BF.RepositorySerializer.SaveToFile(BF, FileName); a.SaveBackup(); ActGotoURL g = new ActGotoURL() { Description = "goto URL ", LocateValue = "ID" }; a.Acts.Add(g); BF.RepositorySerializer.SaveToFile(BF, FileName); a.SaveBackup(); a.RestoreFromBackup(); NewRepositorySerializer newRepositorySerializer = new NewRepositorySerializer(); BusinessFlow BF2 = (BusinessFlow)newRepositorySerializer.DeserializeFromFile(typeof(BusinessFlow), FileName); BF2.SaveBackup(); //dirty now just indicate if backup exist BF2.Description = "aaa"; // Assert Assert.AreEqual(BF2.Activities[0].Acts.Count, BF.Activities[0].Acts.Count); }
public void SpeedTest() { //Arrange ResetBusinessFlow(); Activity a0 = new Activity(); a0.Active = true; ActGotoURL act1 = new ActGotoURL() { LocateBy = eLocateBy.NA, Value = "https://ginger-automation.github.io/test.html", Active = true }; a0.Acts.Add(act1); mBF.Activities.Add(a0); Activity a1 = new Activity(); a1.Active = true; mBF.Activities.Add(a1); for (int i = 1; i < 10; i++) { 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); } mGR.RunRunner(); //Assert Assert.AreEqual(mBF.RunStatus, eRunStatus.Passed, "mBF.RunStatus"); Assert.AreEqual(mBF.Activities.Count(), (from x in mBF.Activities where x.Status == eRunStatus.Passed select x).Count(), "All activities should Passed"); Assert.IsTrue(a1.Elapsed < 10000, "a1.Elapsed Time less than 10000 ms"); }
public void SimpleActWithError() { //Arrange ActGotoURL act1 = new ActGotoURL() { LocateBy = eLocateBy.NA, Value = "https://ginger-automation.github.io/test.html", Active = true }; act1.Error = "Cannot go to URL"; mGR.PrepActionValueExpression(act1); //Act mGR.CalculateActionFinalStatus(act1); //Assert // since there is no failure we assume pass Assert.AreEqual(act1.Status, eRunStatus.Failed, "act1.Status=eRunStatus.Failed"); }
public void ActivitiesClearBackup() { //Arrange BusinessFlow BF = new BusinessFlow(); BF.Name = "Businessflow1"; BF.Description = "Test Clear Backup"; BF.Activities = new ObservableList <Activity>(); Activity a = new Activity(); a.ActivityName = "Activity 1"; a.Description = "Desciption -1"; BF.Activities.Add(a); a.Status = eRunStatus.Passed; ActTextBox t = new ActTextBox(); t.Description = "Set text box "; t.LocateBy = eLocateBy.ByID; t.LocateValue = "ID"; a.Acts.Add(t); //Act BF.SaveToFile(@"c:\temp\activityClearBackup.xml"); a.SaveBackup(); ActGotoURL g = new ActGotoURL(); g.Description = "goto URL "; g.LocateValue = "ID"; a.Acts.Add(g); BF.SaveToFile(@"c:\temp\activityClearBackup.xml"); a.SaveBackup(); a.RestoreFromBackup(); BusinessFlow BF2 = (BusinessFlow)RepositoryItem.LoadFromFile(typeof(BusinessFlow), @"c:\temp\activityClearBackup.xml"); BF2.SaveBackup();//dirty now just indicate if backup exist BF2.Description = "aaa"; // Assert Assert.AreEqual(BF2.Activities[0].Acts.Count, BF.Activities[0].Acts.Count); }
public void DragAndDropSelenium() { // Arrange ResetBusinessFlow(); Activity a1 = new Activity(); a1.Active = true; a1.TargetApplication = "WebApp"; mBF.Activities.Add(a1); ActGotoURL act1 = new ActGotoURL() { LocateBy = eLocateBy.NA, Value = "https://demos.telerik.com/kendo-ui/dragdrop/index", Active = true }; a1.Acts.Add(act1); ActUIElement act3 = new ActUIElement(); act3.ElementLocateBy = eLocateBy.ByXPath; // act2.LocateValue act3.GetOrCreateInputParam(ActUIElement.Fields.ElementLocateValue, "//*[@id='draggable']"); act3.ElementAction = ActUIElement.eElementAction.DragDrop; act3.GetOrCreateInputParam(ActUIElement.Fields.DragDropType, ActUIElement.eElementDragDropType.DragDropSelenium.ToString()); act3.TargetLocateBy = eLocateBy.ByXPath; act3.GetOrCreateInputParam(ActUIElement.Fields.TargetLocateValue, "//*[@id='droptarget']"); act3.Active = true; a1.Acts.Add(act3); // Act mGR.RunRunner(); //Assert Assert.AreEqual(mBF.RunStatus, eRunStatus.Passed); Assert.AreEqual(a1.Status, eRunStatus.Passed); Assert.AreEqual(act1.Status, eRunStatus.Passed); Assert.AreEqual(act3.Status, eRunStatus.Passed); }
private void GoToPage(string calculatedValue) { Act act = null; switch (mAppPlatform) { case ePlatformType.Web: case ePlatformType.Mobile: act = new ActGotoURL() { LocateBy = eLocateBy.NA, Value = calculatedValue, ValueForDriver = calculatedValue, Active = true }; break; case ePlatformType.Java: act = new ActSwitchWindow { LocateBy = eLocateBy.ByTitle, Value = calculatedValue, ValueForDriver = calculatedValue, Active = true, WaitTime = 5 }; break; case ePlatformType.Windows: act = new ActSwitchWindow { LocateBy = eLocateBy.ByTitle, LocateValue = calculatedValue, LocateValueCalculated = calculatedValue, Active = true, WaitTime = 5 }; break; } if (act != null) { ((AgentOperations)mAgent.AgentOperations).Driver.RunAction(act); if (act.Status == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed && act.Error.Contains("not support")) { Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "Navigating to Native Application not supported"); } else if (!string.IsNullOrEmpty(act.Error)) { Reporter.ToUser(eUserMsgKey.StaticErrorMessage, act.Error); } } }
public void Activity_With_Action_Fail_And_RunOption_Continue() { Activity a1 = new Activity(); a1.Active = true; a1.ActionRunOption = Activity.eActionRunOption.ContinueActionsRunOnFailure; 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); //Intentionally put incorrect locate Value ActTextBox act2 = new ActTextBox() { LocateBy = eLocateBy.ByID, LocateValue = "UserName1", 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); mGR.RunRunner(); Assert.AreEqual(a1.Status, eRunStatus.Failed, "a1.Status=eRunStatus.Failed"); Assert.AreEqual(act1.Status, eRunStatus.Passed, "act1.Status=eRunStatus.Passed"); Assert.AreEqual(act2.Status, eRunStatus.Failed, "act1.Status=eRunStatus.Failed"); Assert.AreEqual(act3.Status, eRunStatus.Passed, "act1.Status=eRunStatus.Passed"); }
public void Test_CalculateActivityStatus_Failed_Action() { Activity a1 = new Activity(); a1.Active = true; mBF.Activities.Add(a1); //Arrange ActGotoURL act1 = new ActGotoURL() { LocateBy = eLocateBy.NA, Value = "https://ginger-automation.github.io/test.html", Active = true, Status = eRunStatus.Failed }; act1.Error = "Cannot go to URL"; a1.Acts.Add(act1); //Act mGR.CalculateActivityFinalStatus(a1); //Assert // since there is no failure we assume pass Assert.AreEqual(a1.Status, eRunStatus.Failed, "a1.Status=eRunStatus.Failed"); }
public void ActionClearBackup() { //Arrange BusinessFlow BF = new BusinessFlow(); BF.Name = "Businessflow1"; BF.Description = "Test Clear Backup"; BF.Activities = new ObservableList <Activity>(); Activity a = new Activity(); a.ActivityName = "Activity 1"; a.Description = "Desciption -1"; BF.Activities.Add(a); a.Status = eRunStatus.Passed; ActGotoURL g = new ActGotoURL(); g.Description = "goto URL "; g.LocateValue = "ID"; a.Acts.Add(g); string TempFilepath = TestResources.GetTempFile("actionClearBackup.xml"); //Act BF.RepositorySerializer.SaveToFile(BF, TempFilepath); a.SaveBackup(); g.LocateValue = "ID1"; BF.RepositorySerializer.SaveToFile(BF, TempFilepath); a.SaveBackup(); a.RestoreFromBackup(); NewRepositorySerializer newRepositorySerializer = new NewRepositorySerializer(); BusinessFlow BF2 = (BusinessFlow)newRepositorySerializer.DeserializeFromFile(typeof(BusinessFlow), TempFilepath); BF2.SaveBackup();//dirty now just indicate if backup exist BF2.Description = "aaa"; // Assert Assert.AreEqual(BF2.Activities[0].Acts[0].LocateValue, BF.Activities[0].Acts[0].LocateValue); }
public void TestVariableResetIssue() { //This was a tricky bug not repro every time. // the issue was when seeting Biz flow for Agent a reset vars happened. //Arrange ResetBusinessFlow(); Activity a1 = new Activity(); a1.Active = true; 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); // Not happening with dummy //ActDummy act1 = new ActDummy(); //a1.Acts.Add(act1); VariableString v1 = (VariableString)mBF.GetVariable("v1"); v1.Value = "123"; //Act mGR.RunRunner(); //Assert Assert.AreEqual(mBF.RunStatus, eRunStatus.Passed); Assert.AreEqual(a1.Status, eRunStatus.Passed); Assert.AreEqual(v1.Value, "123"); // <<< the importnat part as with this defect it turned to "1" - initial val }
public void Simple_Act_ReturnValue_Not_As_Expected() { //Arrange string ParamName = "p1"; ActGotoURL act1 = new ActGotoURL() { LocateBy = eLocateBy.NA, Value = "https://ginger-automation.github.io/test.html", Active = true }; act1.AddNewReturnParams = true; act1.AddOrUpdateReturnParamActual(ParamName, "378"); act1.AddOrUpdateReturnParamExpected(ParamName, "37"); // failed due to regex //Act mGR.CalculateActionFinalStatus(act1); //Assert // since there is no failure we assume pass Assert.AreEqual(act1.Status, eRunStatus.Failed, "act1.Status=eRunStatus.Failed"); ActReturnValue RV = act1.GetReturnValue(ParamName); Assert.AreEqual(RV.Status, ActReturnValue.eStatus.Failed, "RV.Status, ActReturnValue.eStatus.Failed"); }
public void FlowcontrolTest_WithActivityCreateInstance() { //Arrange Activity activity = new Activity(); ActGotoURL actGotoURL = new ActGotoURL(); actGotoURL.Description = "Launch"; ActDummy act2 = new ActDummy(); act2.Description = "WaitForApp"; FlowControl flowControl = new FlowControl(); flowControl.Active = true; flowControl.Condition = "1=1"; flowControl.FlowControlAction = eFlowControlAction.GoToAction; flowControl.Value = act2.Guid + flowControl.GUID_NAME_SEPERATOR + act2.ItemName; actGotoURL.FlowControls.Add(flowControl); activity.Acts.Add(actGotoURL); activity.Acts.Add(act2); act2.Description = "WaitForApp_Copy"; //Act Activity copyActivity = (Activity)activity.CreateInstance(); Guid newGuidOfAct2 = copyActivity.Acts.Where(x => x.ItemName == "WaitForApp_Copy").FirstOrDefault().Guid; //Assert Assert.AreEqual(copyActivity.Acts[0].FlowControls[0].GetGuidFromValue(), newGuidOfAct2); }
private void GoToPage(string calculatedValue) { Act act = null; switch (mAppPlatform) { case ePlatformType.Web: act = new ActGotoURL() { LocateBy = eLocateBy.NA, Value = calculatedValue, ValueForDriver = calculatedValue, Active = true }; break; case ePlatformType.Java: act = new ActSwitchWindow { LocateBy = eLocateBy.ByTitle, Value = calculatedValue, ValueForDriver = calculatedValue, Active = true }; break; } if (act != null) { mAgent.Driver.RunAction(act); } }
public void DoDragAndDropByOffSet() { ResetBusinessFlow(); Activity a1 = new Activity(); a1.Active = true; a1.TargetApplication = "WebApp"; mBF.Activities.Add(a1); ActGotoURL act1 = new ActGotoURL() { LocateBy = eLocateBy.NA, Value = "https://demos.telerik.com/kendo-ui/dragdrop/index", Active = true }; a1.Acts.Add(act1); ActUIElement act3 = new ActUIElement(); act3.ElementLocateBy = eLocateBy.ByXPath; act3.GetOrCreateInputParam(ActUIElement.Fields.ElementLocateValue, "//*[@id='draggable']"); act3.ElementAction = ActUIElement.eElementAction.DragDrop; act3.TargetLocateBy = eLocateBy.ByXY; // act3.GetOrCreateInputParam(ActUIElement.Fields.TargetLocateValue, "1102,463"); act3.GetOrCreateInputParam(ActUIElement.Fields.XCoordinate, "1102"); act3.GetOrCreateInputParam(ActUIElement.Fields.XCoordinate, "463"); act3.Active = true; a1.Acts.Add(act3); mGR.RunRunner(); Assert.AreEqual(mBF.RunStatus, eRunStatus.Passed); Assert.AreEqual(a1.Status, eRunStatus.Passed); Assert.AreEqual(act1.Status, eRunStatus.Passed); Assert.AreEqual(act3.Status, eRunStatus.Passed); }
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"); }