Skip to content

Commit

Permalink
Merge pull request #3877 from Ginger-Automation/BugFix/POM_TargetAppl…
Browse files Browse the repository at this point in the history
…ication_Issue

Bug fix/Empty POM adding with Activity target application
  • Loading branch information
Maheshkale447 authored Aug 26, 2024
2 parents 0c237dd + 73d05f0 commit e09c3f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ limitations under the License.
using GingerCore;
using GingerCore.Drivers;
using GingerCore.GeneralLib;
using GingerCoreNET.SolutionRepositoryLib.RepositoryObjectsLib.PlatformsLib;
using GingerWPF.UserControlsLib.UCTreeView;
using System;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;

Expand Down Expand Up @@ -110,7 +112,8 @@ public POMNavPage(Context context)

private void ConfigurePOMPage()
{
ApplicationPOMsTreeItem mPOMsRoot = new ApplicationPOMsTreeItem(WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder<ApplicationPOMModel>());
ApplicationPlatform? activityAppPlatform = WorkSpace.Instance.Solution.ApplicationPlatforms.FirstOrDefault(ap => string.Equals(ap.AppName, mContext.Activity.TargetApplication));
ApplicationPOMsTreeItem mPOMsRoot = new ApplicationPOMsTreeItem(WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder<ApplicationPOMModel>(), activityAppPlatform);
mItemTypeRootNode = mPOMsRoot;
mPOMPage = new SingleItemTreeViewSelectionPage("Page Object Models", eImageType.ApplicationPOMModel, mItemTypeRootNode, SingleItemTreeViewSelectionPage.eItemSelectionType.Multi, true,
new Tuple<string, string>(nameof(ApplicationPOMModel.TargetApplicationKey) + "." + nameof(ApplicationPOMModel.TargetApplicationKey.ItemName), mContext.Activity.TargetApplication),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ public class ApplicationPOMsTreeItem : NewTreeViewItemBase, ITreeViewItem
public RepositoryFolder<ApplicationPOMModel> mPOMModelFolder;
private POMModelsPage mPOMModelsPage;
private ObservableList<ApplicationPOMModel> mChildPoms = null;
private ApplicationPlatform? _applicationPlatform;

public ApplicationPOMsTreeItem(RepositoryFolder<ApplicationPOMModel> POMModelFolder)
{
mPOMModelFolder = POMModelFolder;
}

public ApplicationPOMsTreeItem(RepositoryFolder<ApplicationPOMModel> POMModelFolder, ApplicationPlatform? applicationPlatform) : this(POMModelFolder)
{
_applicationPlatform = applicationPlatform;
}
Object ITreeViewItem.NodeObject()
{
return mPOMModelFolder;
Expand Down Expand Up @@ -150,7 +155,11 @@ internal void AddEmptyPOM(object sender, RoutedEventArgs e)
if (GingerCore.General.GetInputWithValidation("Add Page Object Model", "Page Object Model Name:", ref NewPOMName, null, false, emptyPOM))
{
ObservableList<ApplicationPlatform> TargetApplications = GingerCore.General.ConvertListToObservableList(WorkSpace.Instance.Solution.ApplicationPlatforms.Where(x => ApplicationPOMModel.PomSupportedPlatforms.Contains(x.Platform)).ToList());
if (TargetApplications != null && TargetApplications.Count > 0)
if (_applicationPlatform != null)
{
emptyPOM.TargetApplicationKey = _applicationPlatform.Key;
}
else if (TargetApplications != null && TargetApplications.Count > 0)
{
emptyPOM.TargetApplicationKey = TargetApplications[0].Key;
}
Expand Down

0 comments on commit e09c3f6

Please sign in to comment.