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

POM Element Category Pop up msg #4006

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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 @@ -385,7 +385,7 @@ private void SetElementsGridView()

WeakEventManager<DataGrid, SelectionChangedEventArgs>.AddHandler(source: xMainElementsGrid.grdMain, eventName: nameof(DataGrid.SelectionChanged), handler: Grid_SelectionChanged);

xMainElementsGrid.AddToolbarTool(eImageType.Category, toolTip:"Set missing Categories for selected Elements", new RoutedEventHandler(SetMissingCategoriesForSelectedElements));
xMainElementsGrid.AddToolbarTool(eImageType.Category, toolTip: "Set missing Categories for selected Elements", new RoutedEventHandler(SetMissingCategoriesForSelectedElements));
}

/// <summary>
Expand Down Expand Up @@ -623,7 +623,7 @@ private void SetLocatorsGridView()
xElementDetails.xLocatorsGrid.AddToolbarTool(eImageType.Run, "Test All Elements Locators", new RoutedEventHandler(TestAllElementsLocators));
xElementDetails.xLocatorsGrid.btnAdd.AddHandler(System.Windows.Controls.Button.ClickEvent, new RoutedEventHandler(AddLocatorButtonClicked));
xElementDetails.xLocatorsGrid.SetbtnDeleteHandler(new RoutedEventHandler(DeleteLocatorClicked));
WeakEventManager<DataGrid, DataGridPreparingCellForEditEventArgs>.AddHandler(source: xElementDetails.xLocatorsGrid.grdMain, eventName: nameof(DataGrid.PreparingCellForEdit), handler: LocatorsGrid_PreparingCellForEdit);
WeakEventManager<DataGrid, DataGridPreparingCellForEditEventArgs>.AddHandler(source: xElementDetails.xLocatorsGrid.grdMain, eventName: nameof(DataGrid.PreparingCellForEdit), handler: LocatorsGrid_PreparingCellForEdit);

xElementDetails.xLocatorsGrid.PasteItemEvent += PasteLocatorEvent;
}
Expand All @@ -646,7 +646,7 @@ private List<string> GetPossibleCategoriesAsString()
ePlatformType mAppPlatform = WorkSpace.Instance.Solution.GetTargetApplicationPlatform(mPOM.TargetApplicationKey);
List<ePomElementCategory> categoriesList = PlatformInfoBase.GetPlatformImpl(mAppPlatform).GetPlatformPOMElementCategories();

List<string> categories = new List<string>();
List<string> categories = [];
foreach (ePomElementCategory category in categoriesList)
{
categories.Add(category.ToString());
Expand Down Expand Up @@ -1066,14 +1066,14 @@ private void TestAllElementsLocators(object sender, RoutedEventArgs e)
}

private void SetMissingCategoriesForSelectedElements(object sender, RoutedEventArgs e)
{
{
if (xMainElementsGrid.Grid.SelectedItems.Count == 0)
{
Reporter.ToUser(eUserMsgKey.StaticWarnMessage, "Please select elements to set missing categories.");
return;
}

//get the Category to set
bool isCategoryUpdated = false;
string selectedCategory = "";
if (InputBoxWindow.OpenDialog("Set Missing Categories", "Select Category to set:", ref selectedCategory, GetPossibleCategoriesAsString()))
{
Expand All @@ -1084,9 +1084,22 @@ private void SetMissingCategoriesForSelectedElements(object sender, RoutedEventA
Reporter.ToStatus(eStatusMsgKey.StaticStatusProcess, null, "setting all missing categories for selected elements...");
foreach (ElementInfo element in xMainElementsGrid.Grid.SelectedItems)
{
SetMissingCategoriesForElement(element, (ePomElementCategory)Enum.Parse(typeof(ePomElementCategory), selectedCategory));
if (element.Properties.All(y => y.Category == null) && element.Locators.All(y => y.Category == null))
{
SetMissingCategoriesForElement(element, (ePomElementCategory)Enum.Parse(typeof(ePomElementCategory), selectedCategory));
isCategoryUpdated = true;
}

}
if (isCategoryUpdated)
{
Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "Missing categories updated successfully.");
}
Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "All missing categories were set successfully.");
else
{
Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "No missing categoriess found.");
}

}
catch (Exception ex)
{
Expand Down
Loading