Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix/Empty POM adding with Activity target application #3877

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading