Skip to content

Commit

Permalink
Merge branch 'master' into Feature/MockDataGenerate
Browse files Browse the repository at this point in the history
  • Loading branch information
Maheshkale447 committed Jul 8, 2024
2 parents 96355b2 + a127a46 commit 04027b2
Show file tree
Hide file tree
Showing 30 changed files with 3,288 additions and 100 deletions.
1 change: 1 addition & 0 deletions Ginger/Ginger/Activities/ActivityPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ private void xEditBtn_Click(object sender, RoutedEventArgs e)
}
//create back up
mActivity.SaveBackup();
mActivity.StartTimer();
UpdateActivityViewMode(Ginger.General.eRIPageViewMode.Automation);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
#endregion

using Amdocs.Ginger.Common;
using Amdocs.Ginger.Repository;
using GingerCore.GeneralLib;
using GingerWPF.WizardLib;
using System;
Expand All @@ -33,10 +34,12 @@ public partial class PomDeltaElementCompareWizardPage : Page, IWizardPage
PomDeltaWizard mWizard;
PomDeltaViewPage mPomDeltaViewPage = null;
bool mFirstLearnWasDone = false;
ApplicationPOMModel pom;

public PomDeltaElementCompareWizardPage()
public PomDeltaElementCompareWizardPage(ApplicationPOMModel pom)
{
InitializeComponent();
this.pom = pom;
}

public void WizardEvent(WizardEventArgs WizardEventArgs)
Expand Down Expand Up @@ -64,6 +67,7 @@ private async void LearnDelta()
try
{
mWizard.ProcessStarted();
pom.StartTimer();
InitilizePomElementsMappingPage();//we recreating page as workaround for clearing grid filters
xReLearnButton.Visibility = Visibility.Collapsed;
xStopLoadButton.ButtonText = "Stop";
Expand All @@ -83,6 +87,7 @@ private async void LearnDelta()
xStopLoadButton.Visibility = Visibility.Collapsed;
xReLearnButton.Visibility = Visibility.Visible;
mWizard.ProcessEnded();
pom.StopTimer();
}
}
}
Expand All @@ -92,6 +97,7 @@ private void StopButtonClicked(object sender, RoutedEventArgs e)
xStopLoadButton.ButtonText = "Stopping...";
xStopLoadButton.IsEnabled = false;
mWizard.mPomDeltaUtils.StopLearning();
pom.StopTimer();
}

private void ReLearnButtonClicked(object sender, RoutedEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public PomDeltaWizard(ApplicationPOMModel pom, Agent agent)
mPomDeltaUtils = new PomDeltaUtils(pom, agent);

AddPage(Name: "Elements Update Settings", Title: "Elements Update Settings", SubTitle: "Elements Update Settings", Page: new PomDeltaSettingsWizardPage());
AddPage(Name: "Elements Compare", Title: "Elements Compare", SubTitle: "Elements Comparison with Latest Status", Page: new PomDeltaElementCompareWizardPage());
AddPage(Name: "Elements Compare", Title: "Elements Compare", SubTitle: "Elements Comparison with Latest Status", Page: new PomDeltaElementCompareWizardPage(pom));
AddPage(Name: "Elements Mapping", Title: "Elements Mapping", SubTitle: "Map deleted element with new element", Page: new PomDeltaDeletedElementMappingWizardPage());

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
#endregion

using Amdocs.Ginger.Common;
using Amdocs.Ginger.Repository;
using GingerCore.GeneralLib;
using GingerWPF.WizardLib;
using System;
Expand Down Expand Up @@ -68,8 +69,8 @@ public void WizardEvent(WizardEventArgs WizardEventArgs)
mPomAllElementsPage.mappedUIElementsPage.MainElementsGrid.ValidationRules.Add(ucGrid.eUcGridValidationRules.CantBeEmpty);

xReLearnButton.Visibility = Visibility.Visible;

Learn();

}
break;

Expand Down Expand Up @@ -106,6 +107,7 @@ private void StartTimer()

// Start the timer
timer.Start();
mWizard.mPomLearnUtils.StartLearningTime();
}

private void Timer_Tick(object sender, EventArgs e)
Expand All @@ -121,6 +123,7 @@ private void Timer_Tick(object sender, EventArgs e)
private void StopTimer()
{
timer.Stop();
mWizard.mPomLearnUtils.StopLearningTime();
}
private async void Learn()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ private async Task RefreshTreeContent()
AFTI.Path = AW.Path;
InitTree(AFTI);
break;
case AppWindow.eWindowType.SeleniumWebPage:
case AppWindow.eWindowType.WebPage:
HTMLPageTreeItem HPTI = new HTMLPageTreeItem();
HTMLElementInfo EI = new HTMLElementInfo();
EI.ElementTitle = AW.Title;
Expand Down
Binary file modified Ginger/GingerCore/DLLs/RQMExportStd.dll
Binary file not shown.
Binary file modified Ginger/GingerCore/DLLs/RQM_RepositoryStd.dll
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ limitations under the License.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using Amdocs.Ginger.Common;
using Amdocs.Ginger.Common.Enums;
using Amdocs.Ginger.Common.GeneralLib;
Expand All @@ -41,6 +42,7 @@ public ApplicationPOMModel()

public const int cLearnScreenWidth = 1000;
public const int cLearnScreenHeight = 1000;
private Stopwatch _stopwatch;

public static readonly List<ePlatformType> PomSupportedPlatforms = new List<ePlatformType>() { ePlatformType.Web, ePlatformType.Java, ePlatformType.Windows, ePlatformType.Mobile };

Expand All @@ -66,6 +68,50 @@ public ePageLoadFlowType PageLoadFlow
}
}

private TimeSpan mDevelopmentTime;
[IsSerializedForLocalRepository]
public TimeSpan DevelopmentTime
{
get
{
return mDevelopmentTime;
}
set
{
if(mDevelopmentTime != value)
{
mDevelopmentTime = value;
}
}
}
public void StartTimer()
{
if (_stopwatch == null)
{
_stopwatch = new Stopwatch();
}

if (!_stopwatch.IsRunning)
{
_stopwatch.Start();
}
else
{
_stopwatch.Restart();
}
}

public void StopTimer()
{
if (_stopwatch != null && _stopwatch.IsRunning)
{
_stopwatch.Stop();
TimeSpan elapsedTime = new TimeSpan(_stopwatch.Elapsed.Hours, _stopwatch.Elapsed.Minutes, _stopwatch.Elapsed.Seconds);
DevelopmentTime = DevelopmentTime.Add(elapsedTime);
_stopwatch.Reset();
}
}

[IsSerializedForLocalRepository]
public string PageURL //OperationName
{
Expand Down
31 changes: 25 additions & 6 deletions Ginger/GingerCoreCommon/Repository/BusinessFlowLib/Activity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private void Activity_OnDirtyStatusChanged(object sender, EventArgs e)
}
}


public override string ToString()
{
return ActivityName;
Expand Down Expand Up @@ -193,6 +193,12 @@ public void StopTimer()
}
}

public static void StopAndResetTimer(Activity act)
{
act.DevelopmentTime = TimeSpan.Zero;
act.StopTimer();
}

private bool mLinkedActive = true;
[IsSerializedForLocalRepository(true)]
public Boolean LinkedActive
Expand Down Expand Up @@ -230,7 +236,7 @@ public Boolean Active
}
if (mActive != value)
{
mActive = value;
mActive = value;
OnPropertyChanged(nameof(Active));
}
}
Expand Down Expand Up @@ -579,8 +585,8 @@ public ObservableList<Consumer> ConsumerApplications
{
mConsumerApplications = value;
OnPropertyChanged(nameof(ConsumerApplications));
}
}
}
}
}

[IsSerializedForLocalRepository]
Expand Down Expand Up @@ -913,6 +919,7 @@ public static Activity CopySharedRepositoryActivity(Activity srActivity, bool or
{
Activity copy = (Activity)srActivity.CreateInstance(originFromSharedRepository, setNewGUID: false);
copy.Guid = Guid.NewGuid();
StopAndResetTimer(copy);
List<KeyValuePair<Guid, Guid>> oldNewActionGuidList = [];
foreach (Act action in copy.Acts.Cast<Act>())
{
Expand All @@ -925,7 +932,7 @@ public static Activity CopySharedRepositoryActivity(Activity srActivity, bool or
variable.ParentGuid = variable.Guid;
variable.Guid = Guid.NewGuid();
}
foreach(FlowControl fc in copy.Acts.SelectMany(a => a.FlowControls))
foreach (FlowControl fc in copy.Acts.SelectMany(a => a.FlowControls))
{
Guid targetGuid = fc.GetGuidFromValue();
if (oldNewActionGuidList.Any(oldNew => oldNew.Key == targetGuid))
Expand All @@ -937,19 +944,31 @@ public static Activity CopySharedRepositoryActivity(Activity srActivity, bool or
return copy;
}

public override void UpdateInstance(RepositoryItemBase instance, string partToUpdate, RepositoryItemBase hostItem = null, object extraDetails = null)
public override void UpdateInstance(RepositoryItemBase instance, string partToUpdate, RepositoryItemBase hostItem = null, object extradetails=null)
{

Activity activityInstance = (Activity)instance;
//Create new instance of source
Activity newInstance = null;

if (activityInstance.Type == eSharedItemType.Link)
{

newInstance = CopySharedRepositoryActivity(this, originFromSharedRepository: true);
newInstance.Guid = activityInstance.Guid;
newInstance.ActivitiesGroupID = activityInstance.ActivitiesGroupID;
newInstance.Type = activityInstance.Type;
newInstance.Active = activityInstance.Active;

if(newInstance.Guid == this.Guid)
{
newInstance.DevelopmentTime = newInstance.DevelopmentTime.Add(this.DevelopmentTime);
}
else
{
newInstance.DevelopmentTime = activityInstance.DevelopmentTime;
}

if (hostItem != null)
{
//replace old instance object with new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,7 @@ private void LoadLinkedActivities()
copyItem.ActivitiesGroupID = this.Activities[i].ActivitiesGroupID;
copyItem.Type = this.Activities[i].Type;
copyItem.Active = this.Activities[i].Active;
copyItem.DevelopmentTime = this.Activities[i].DevelopmentTime;
this.Activities[i] = copyItem;
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ private bool IsLinkedItemExclusion(string memberName)
nameof(RepositoryItemBase.Guid) or
nameof(RepositoryItemBase.ParentGuid) or
"Type" or
"DevelopmentTime" or
"ActivitiesGroupID" or
"ActivityName" or
"Active" or
Expand Down
2 changes: 1 addition & 1 deletion Ginger/GingerCoreCommon/UIElement/AppWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public enum eWindowType
Windows,
PowerBuilder,
ASCFForm,
SeleniumWebPage,
WebPage,
InternalBrowserWebPageDocument,
JFrmae,
Appium,
Expand Down
3 changes: 3 additions & 0 deletions Ginger/GingerCoreCommon/UIElement/ElementInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,9 @@ public string OptionalValuesObjectsListAsString
}
}

public ElementInfo ParentElement { get; set; }
public IList<ElementInfo> ChildElements { get; } = [];

ObservableList<OptionalValue> IParentOptionalValuesObject.OptionalValuesList { get { return OptionalValuesObjectsList; } set { OptionalValuesObjectsList = value; } }

void IParentOptionalValuesObject.PropertyChangedEventHandler()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using System.Threading;
using System.Threading.Tasks;

namespace GingerCoreCommonTest
namespace GingerCoreCommonTest.DevelopmentTimeTest
{
[TestClass]
public class DevelopmentTimeForBFTest
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using amdocs.ginger.GingerCoreNET;
using Amdocs.Ginger.Common;
using Amdocs.Ginger.CoreNET.Application_Models;
using Amdocs.Ginger.Repository;
using Ginger.Repository;
using Ginger.Repository.ItemToRepositoryWizard;
using GingerCore;
using GingerCore.Variables;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace GingerCoreCommonTest.DevelopmentTimeTest
{
[TestClass]
public class DevelopmentTimePOMSRTest
{


[TestMethod]
public void CheckLearnPOMDevTime()
{
ApplicationPOMModel model = new ApplicationPOMModel();
model.Name = "Test";
model.Description = "Description";

PomLearnUtils pomLearn = new PomLearnUtils(model);
TimeSpan prevTime = TimeSpan.Zero;
pomLearn.StartLearningTime();
Thread.Sleep(1000);
pomLearn.StopLearningTime();

Assert.AreNotEqual(prevTime, model.DevelopmentTime);

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,23 @@ private string BitmapToBase64(Bitmap bImage)
}
}

public void StartLearningTime()
{
POM.StartTimer();
}
public void StopLearningTime()
{
POM.StopTimer();
}

public void StopLearning()
{
if (mAgent != null && ((AgentOperations)mAgent.AgentOperations).Driver != null)
{
((AgentOperations)mAgent.AgentOperations).Driver.StopProcess = true;
}

POM.StopTimer();
}

public void ClearStopLearning()
Expand Down Expand Up @@ -210,7 +221,6 @@ public async Task Learn()
LearnScreenShot();
POM.PageURL = ((DriverBase)((AgentOperations)Agent.AgentOperations).Driver).GetURL();
POM.Name = IWindowExplorerDriver.GetActiveWindow().Title;

// appending Specific frame title in POM name
if (!string.IsNullOrEmpty(SpecificFramePath))
{
Expand Down
Binary file modified Ginger/GingerCoreNET/DLLS/RQMExportStd.dll
Binary file not shown.
Binary file modified Ginger/GingerCoreNET/DLLS/RQM_RepositoryStd.dll
Binary file not shown.
Loading

0 comments on commit 04027b2

Please sign in to comment.