Skip to content

Single pom for android and i os#3733

Merged
Maheshkale447 merged 33 commits into
masterfrom
Single-POM-For-Android-And-iOS
Jun 24, 2024
Merged

Single pom for android and i os#3733
Maheshkale447 merged 33 commits into
masterfrom
Single-POM-For-Android-And-iOS

Conversation

@MeniKadosh1

@MeniKadosh1 MeniKadosh1 commented Jun 3, 2024

Copy link
Copy Markdown
Contributor

Thank you for your contribution.
Before submitting this PR, please make sure:

  • PR description and commit message should describe the changes done in this PR
  • Verify the PR is pointing to correct branch i.e. Release or Beta branch if the code fix is for specific release , else point it to master
  • Latest Code from master or specific release branch is merged to your branch
  • No unwanted\commented\junk code is included
  • No new warning upon build solution
  • Code Summary\Comments are added to my code which explains what my code is doing
  • Existing unit test cases are passed
  • New Unit tests are added for your development
  • Sanity Tests are successfully executed for New and Existing Functionality
  • Verify that changes are compatible with all relevant browsers and platforms.
  • After creating pull request there should not be any conflicts
  • Resolve all Codacy comments
  • Builds and checks are passed before PR is sent for review
  • Resolve code review comments
  • Update the Help Library document to match any feature changes

Summary by CodeRabbit

  • New Features

    • Improved element mapping in delta wizards to handle various statuses and new elements.
    • Added new columns and category fields in multiple grid views.
    • Introduced element merging functionality in the POM model.
  • Enhancements

    • Updated the POM category handling across different drivers to better manage element categorization.
  • Bug Fixes

    • Adjusted element locator and property handling for better accuracy.
  • Version Updates

    • Updated assembly and package version to 24.3.1.0.

@coderabbitai

coderabbitai Bot commented Jun 3, 2024

Copy link
Copy Markdown
Contributor

Warning

Review failed

The pull request is closed.

Walkthrough

The changes across several files introduce new properties, methods, and modifications to existing classes and interfaces, primarily focusing on handling deleted elements, mapping them in the element grid views, and setting categories for locating elements. New features include handling POM categories, merging elements, and updating the control elements in different drivers and utility files.

Changes

Files Change Summary
Ginger/.../PomDeltaDeletedElementMappingWizardPage.xaml.cs Modified grid column headers, element status options, and handling of selected elements.
Ginger/.../PomDeltaMappingElementsComparePage.xaml.cs Added Category field in GridColView.
Ginger/.../PomDeltaViewPage.xaml.cs Constructor updated with additional parameter deltaViewElements; modifications to GridColView elements in multiple methods.
Ginger/.../PomNewAddedElementSelectionPage.xaml.cs Constructor updated to pass deltaElementInfos to PomDeltaViewPage.
Ginger/.../PomElementsPage.xaml.cs Added methods for merging elements, grid view setup modified to include ElementLocator.Category.
Ginger/.../LiveSpyPage.xaml.cs Included driver-related import and category setting logic for mSpyElement.
Ginger/.../WindowExplorerPage.xaml.cs Adjusted HighlightSelectedElement method to set locators and properties category.
Ginger/.../UCElementDetails.xaml.cs Added GridColView for Category field in ControlProperty and ElementLocator.
GingerCore/.../JavaDriver.cs Introduced PomCategory property and method to set POM category in visible controls.
GingerCore/.../MainFrameDriver.cs, GingerCore/.../PBDriver.cs, GingerCore/.../WindowsDriver.cs Overridden PomCategory property for specific conditions; adjusted visible controls setting.
GingerCoreCommon/GingerCoreCommon.csproj Assembly, file, and package version numbers updated to 24.3.1.0.
GingerCoreCommon/.../ApplicationPOMModel.cs Added enum ePomElementCategory, reordered class structure.
GingerCoreCommon/.../ControlProperty.cs Added Category property.
GingerCoreCommon/.../ElementInfo.cs Introduced method to set category for locators and properties.
GingerCoreCommon/.../ElementLocator.cs Added Category property with serialization.
GingerCoreNET/.../DeltaControlProperty.cs, .../DeltaElementInfo.cs, .../DeltaElementLocator.cs Introduced properties for element category and methods to handle mapping and merging elements accordingly.
GingerCoreNET/.../PomDeltaUtils.cs Added MergeElements method for element properties and locators.
GingerCoreNET/.../POMExecutionUtils.cs Updated GetCurrentPOMElementInfo to filter elements by category.
GingerCoreNET/.../GenericAppiumDriver.cs, .../SeleniumDriver.cs Added properties and adjusted methods to handle Appium sessions and POM categories.
GingerCoreNET/RunLib/DriverBase.cs Added PomCategory property; included driver-related namespace.

Poem

In the code, the changes bloom,
POM categories set the room.
Deleted elements find their way,
Merging smoothly, come what may.
Locators and properties align,
Ginger’s code, truly fine.
🐰🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

… wizard

-allowing to do manual merge on elements grid
- converting the categories to enum
- allowing to select category from drop list in locators page
- setting also LiveSpy and Explorer screen show pages to add the category
- configuring possible platforms on PlatformInfo classes
@MeniKadosh1
MeniKadosh1 marked this pull request as ready for review June 9, 2024 21:18
@MeniKadosh1
MeniKadosh1 requested a review from Maheshkale447 June 9, 2024 21:24
@MeniKadosh1
MeniKadosh1 changed the base branch from master to Releases/Beta June 9, 2024 21:26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 20

Outside diff range and nitpick comments (6)
Ginger/GingerCoreNET/Run/Platforms/PlatformsInfo/PowerBuilderPlatform.cs (1)

21-21: Consider removing the unused import Amdocs.Ginger.Repository if it's not needed in this file.

Ginger/GingerCoreNET/Run/Platforms/PlatformsInfo/PlatformInfoBase.cs (1)

23-23: Consider removing the unused import Amdocs.Ginger.Repository if it's not needed in this file.

Ginger/GingerCoreNET/Application Models/Execution/POM/POMExecutionUtils.cs (1)

Line range hint 72-113: The modifications to GetCurrentPOMElementInfo to handle categories are well-implemented. Consider adding unit tests to ensure the filtering logic works correctly and does not impact existing functionalities.

Would you like me to help in writing these unit tests?

Ginger/Ginger/UserControlsLib/UCElementDetails.xaml.cs (1)

246-246: Add XML documentation for the new Category property in ControlProperty.

Adding XML documentation will improve the maintainability and understandability of the code, especially for new developers or external contributors who might use this class.

Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (1)

303-306: Potential Issue with Property Assignment

The assignment mSeleniumDriver.PomCategory = this.PomCategory; directly after initializing mSeleniumDriver might be redundant if PomCategory is already being set in its constructor or elsewhere appropriately. Verify if this assignment is necessary or if it can be optimized away.

Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs (1)

4056-4064: The conditional handling of PomCategory based on isAppiumSession is correct. Consider adding a comment explaining why PomCategory is only considered in mobile flows.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 07ddffb and c3bc175.

Files selected for processing (31)
  • Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaDeletedElementMappingWizardPage.xaml.cs (6 hunks)
  • Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaMappingElementsComparePage.xaml.cs (1 hunks)
  • Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaViewPage.xaml.cs (4 hunks)
  • Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomNewAddedElementSelectionPage.xaml.cs (1 hunks)
  • Ginger/Ginger/ApplicationModelsLib/POMModels/PomElementsPage.xaml.cs (5 hunks)
  • Ginger/Ginger/AutomatePageLib/AddActionMenu/LiveSpy/LiveSpyPage.xaml.cs (3 hunks)
  • Ginger/Ginger/AutomatePageLib/AddActionMenu/WindowExplorer/Common/WindowExplorerPage.xaml.cs (1 hunks)
  • Ginger/Ginger/UserControlsLib/UCElementDetails.xaml.cs (2 hunks)
  • Ginger/GingerCore/Drivers/JavaDriverLib/JavaDriver.cs (2 hunks)
  • Ginger/GingerCore/Drivers/MainFrame/MainFrameDriver.cs (2 hunks)
  • Ginger/GingerCore/Drivers/PBDriver/PBDriver.cs (1 hunks)
  • Ginger/GingerCore/Drivers/WindowsLib/WindowsDriver.cs (2 hunks)
  • Ginger/GingerCoreCommon/GingerCoreCommon.csproj (1 hunks)
  • Ginger/GingerCoreCommon/Repository/ApplicationModelLib/POMModelLib/ApplicationPOMModel.cs (2 hunks)
  • Ginger/GingerCoreCommon/UIElement/ControlProperty.cs (2 hunks)
  • Ginger/GingerCoreCommon/UIElement/ElementInfo.cs (2 hunks)
  • Ginger/GingerCoreCommon/UIElement/ElementLocator.cs (2 hunks)
  • Ginger/GingerCoreNET/Application Models/Delta/PomDelta/DeltaControlProperty.cs (2 hunks)
  • Ginger/GingerCoreNET/Application Models/Delta/PomDelta/DeltaElementInfo.cs (2 hunks)
  • Ginger/GingerCoreNET/Application Models/Delta/PomDelta/DeltaElementLocator.cs (2 hunks)
  • Ginger/GingerCoreNET/Application Models/Delta/PomDelta/PomDeltaUtils.cs (1 hunks)
  • Ginger/GingerCoreNET/Application Models/Execution/POM/POMExecutionUtils.cs (2 hunks)
  • Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (7 hunks)
  • Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs (4 hunks)
  • Ginger/GingerCoreNET/Run/Platforms/PlatformsInfo/JavaPlatform.cs (2 hunks)
  • Ginger/GingerCoreNET/Run/Platforms/PlatformsInfo/MobilePlatform.cs (2 hunks)
  • Ginger/GingerCoreNET/Run/Platforms/PlatformsInfo/PlatformInfoBase.cs (2 hunks)
  • Ginger/GingerCoreNET/Run/Platforms/PlatformsInfo/PowerBuilderPlatform.cs (2 hunks)
  • Ginger/GingerCoreNET/Run/Platforms/PlatformsInfo/WebPlatformInfo.cs (2 hunks)
  • Ginger/GingerCoreNET/Run/Platforms/PlatformsInfo/WindowsPlatform.cs (2 hunks)
  • Ginger/GingerCoreNET/RunLib/DriverBase.cs (2 hunks)
Files skipped from review due to trivial changes (1)
  • Ginger/GingerCoreCommon/GingerCoreCommon.csproj
Additional context used
GitHub Check: Codacy Static Code Analysis
Ginger/GingerCoreNET/Application Models/Delta/PomDelta/DeltaElementInfo.cs

[failure] 119-119: Ginger/GingerCoreNET/Application Models/Delta/PomDelta/DeltaElementInfo.cs#L119
Add a 'default' clause to this 'switch' statement.

Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaDeletedElementMappingWizardPage.xaml.cs

[warning] 41-41: Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaDeletedElementMappingWizardPage.xaml.cs#L41
Remove this commented out code.


[notice] 61-61: Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaDeletedElementMappingWizardPage.xaml.cs#L61
Remove the unnecessary Boolean literal(s).


[warning] 76-76: Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaDeletedElementMappingWizardPage.xaml.cs#L76
Remove this commented out code.


[warning] 101-101: Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaDeletedElementMappingWizardPage.xaml.cs#L101
Remove this commented out code.


[warning] 105-105: Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaDeletedElementMappingWizardPage.xaml.cs#L105
Remove this commented out code.


[warning] 142-142: Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaDeletedElementMappingWizardPage.xaml.cs#L142
Remove this commented out code.


[warning] 166-166: Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaDeletedElementMappingWizardPage.xaml.cs#L166
Remove this commented out code.


[warning] 176-176: Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaDeletedElementMappingWizardPage.xaml.cs#L176
Remove this commented out code.

Ginger/GingerCoreNET/Application Models/Delta/PomDelta/PomDeltaUtils.cs

[notice] 778-778: Ginger/GingerCoreNET/Application Models/Delta/PomDelta/PomDeltaUtils.cs#L778
Remove the unnecessary Boolean literal(s).

Additional comments not posted (32)
Ginger/GingerCoreCommon/UIElement/ControlProperty.cs (1)

34-35: The addition of the Category property is well-implemented and follows the existing serialization pattern.

Ginger/GingerCoreNET/Application Models/Delta/PomDelta/DeltaControlProperty.cs (1)

39-39: The implementation of the Category property correctly delegates to the underlying ElementProperty, maintaining consistency and encapsulation.

Ginger/GingerCoreNET/Application Models/Delta/PomDelta/DeltaElementLocator.cs (1)

45-45: The implementation of the Category property correctly delegates to the underlying ElementLocator, maintaining consistency and encapsulation.

Ginger/GingerCoreNET/Application Models/Delta/PomDelta/DeltaElementInfo.cs (1)

91-107: The addition of the MappedElementInfoName property is well-implemented, enhancing the mapping capabilities of elements.

Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomNewAddedElementSelectionPage.xaml.cs (1)

52-52: Initialization of PomDeltaViewPage with delta elements is correctly implemented.

Ginger/GingerCoreCommon/UIElement/ElementLocator.cs (1)

63-69: Proper implementation of the Category property with serialization.

Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaMappingElementsComparePage.xaml.cs (1)

81-81: Addition of Category column in grid view is correctly implemented.

Ginger/GingerCoreNET/Run/Platforms/PlatformsInfo/MobilePlatform.cs (1)

165-172: Correct implementation of GetPlatformPOMElementCategories for mobile platforms.

Verification successful

Let's review the usage of GetPlatformPOMElementCategories in PomElementsPage.xaml.cs to ensure the categories are correctly handled.


Let's locate the correct path for PomElementsPage.xaml.cs and then review the usage of GetPlatformPOMElementCategories within it.


The method GetPlatformPOMElementCategories is used in the GetPossibleCategories method within PomElementsPage.xaml.cs. This method retrieves the platform-specific POM element categories and converts them into a list of ComboEnumItem objects, which are then returned.

This confirms that the categories returned by GetPlatformPOMElementCategories are correctly utilized to populate a list of possible categories for the platform.

  • Ginger/Ginger/ApplicationModelsLib/POMModels/PomElementsPage.xaml.cs:
    • GetPossibleCategories method uses GetPlatformPOMElementCategories to retrieve and convert platform-specific categories.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the categories returned by `GetPlatformPOMElementCategories` are used correctly across the platform.

# Test: Search for usage of `GetPlatformPOMElementCategories`.
rg --type cs $'GetPlatformPOMElementCategories'

Length of output: 1164



Script:

#!/bin/bash
# Description: Review the usage of GetPlatformPOMElementCategories in PomElementsPage.xaml.cs

# Extract the relevant lines from PomElementsPage.xaml.cs
rg --type cs --context 10 'GetPlatformPOMElementCategories' Ginger/ApplicationModelsLib/POMModels/PomElementsPage.xaml.cs

Length of output: 223



Script:

#!/bin/bash
# Locate the correct path for PomElementsPage.xaml.cs
fd PomElementsPage.xaml.cs

# Extract the relevant lines from the located file
fd PomElementsPage.xaml.cs --exec rg --type cs --context 10 'GetPlatformPOMElementCategories' {}

Length of output: 1369

Ginger/GingerCoreNET/Run/Platforms/PlatformsInfo/PowerBuilderPlatform.cs (1)

99-106: The method GetPlatformPOMElementCategories is well-documented and clearly returns a list of POM element categories specific to the PowerBuilder platform. This aligns with the PR's objective to enhance POM element management.

Ginger/GingerCoreCommon/Repository/ApplicationModelLib/POMModelLib/ApplicationPOMModel.cs (1)

31-34: The addition of the ePomElementCategory enum is a good practice for maintaining a clear categorization of POM elements across different platforms. This change supports the PR's goal of enhancing POM element management.

Ginger/GingerCoreNET/Run/Platforms/PlatformsInfo/PlatformInfoBase.cs (1)

103-110: The method GetPlatformPOMElementCategories is well-documented and clearly returns a list of POM element categories specific to the platform. This aligns with the PR's objective to enhance POM element management.

Ginger/GingerCoreNET/RunLib/DriverBase.cs (1)

241-241: The addition of PomCategory property is well-implemented and aligns with the PR's objectives to enhance POM element management.

Verification successful

The PomCategory property is properly overridden and used in multiple derived classes, indicating consistent and correct implementation.

  • Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs
  • Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs
  • Ginger/GingerCore/Drivers/WindowsLib/WindowsDriver.cs
  • Ginger/GingerCore/Drivers/PBDriver/PBDriver.cs
  • Ginger/GingerCore/Drivers/MainFrame/MainFrameDriver.cs
  • Ginger/GingerCore/Drivers/JavaDriverLib/JavaDriver.cs
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of `PomCategory` in derived classes.

# Test: Search for the usage of `PomCategory` in derived classes. Expect: Proper overriding and usage.
rg --type cs "PomCategory" --glob "!DriverBase.cs"

Length of output: 3928

Ginger/Ginger/AutomatePageLib/AddActionMenu/LiveSpy/LiveSpyPage.xaml.cs (2)

25-25: The addition of the GingerCore.Drivers namespace is appropriate for accessing DriverBase.


264-264: Setting the POM category in mSpyElement is crucial for the new POM management features. Ensure this does not adversely affect UI responsiveness.

Ginger/GingerCore/Drivers/MainFrame/MainFrameDriver.cs (2)

90-105: The implementation of the PomCategory property with a sensible default specific to mainframe elements is clear and aligns with the expected behavior.


756-756: Setting the POM category for each ElementInfo instance in the GetVisibleControls method is a good enhancement, ensuring consistency in how elements are handled across different parts of the application.

Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaViewPage.xaml.cs (2)

113-124: The addition of the deltaViewElements parameter in the constructor enhances flexibility by allowing external initialization of delta elements. This is a positive change for customizability and usability of the PomDeltaViewPage.


312-312: Including the Category field in the SetDeltaLocatorsGridView method aligns with the enhancements to POM element handling, providing better categorization and information visibility in the UI.

Ginger/GingerCoreNET/Run/Platforms/PlatformsInfo/WindowsPlatform.cs (2)

23-23: Added import for Amdocs.Ginger.Repository.

This import is necessary for accessing repository-related functionalities, aligning with the changes made in the class to handle POM categories.


67-74: Added method GetPlatformPOMElementCategories to specify POM element categories for the Windows platform.

This addition is crucial for the integration of POM handling across different platforms, ensuring that Windows-specific POM categories are correctly managed.

Ginger/GingerCoreNET/Run/Platforms/PlatformsInfo/WebPlatformInfo.cs (1)

279-287: The implementation of GetPlatformPOMElementCategories is correct and aligns with the PR's objectives to handle POM elements effectively.

Ginger/GingerCoreNET/Application Models/Delta/PomDelta/PomDeltaUtils.cs (1)

759-788: Ensure proper handling of null values in the MergeElements method to prevent potential null reference exceptions.

+ if (originalProp == null) {
+     originalElement.Properties.Add(secondElement.Properties[i]);
+ } else {
+     originalProp.Value = secondElement.Properties[i].Value;
+ }

+ if (originalLocator == null) {
+     originalElement.Locators.Add(secondElement.Locators[i]);
+ } else {
+     originalLocator.LocateValue = secondElement.Locators[i].LocateValue;
+ }

This refactor ensures that properties and locators are only accessed if they are not null, thus preventing potential runtime errors. It's crucial to handle cases where FirstOrDefault might return null, especially in a method that merges data from different sources.

Likely invalid or redundant comment.

Tools
GitHub Check: Codacy Static Code Analysis

[notice] 778-778: Ginger/GingerCoreNET/Application Models/Delta/PomDelta/PomDeltaUtils.cs#L778
Remove the unnecessary Boolean literal(s).

Ginger/Ginger/UserControlsLib/UCElementDetails.xaml.cs (1)

314-314: Ensure that the new Category field in ElementLocator is properly integrated and tested.

Ginger/Ginger/ApplicationModelsLib/POMModels/PomElementsPage.xaml.cs (3)

368-368: Addition of a toolbar tool for merging selected elements.

This addition aligns with the PR's objective to enhance POM element management by allowing users to merge elements directly from the UI. Good use of event handling to trigger the merge operation.


604-605: Addition of a new column for ElementLocator.Category in the locators grid view.

This change supports the new functionality of categorizing POM elements, which is a part of the PR objectives. The use of a ComboBox for category selection provides a user-friendly interface for categorization.


622-633: Implementation of GetPossibleCategories method.

This method dynamically fetches categories based on the platform, which enhances the flexibility and applicability of the POM categorization feature across different platforms. Good use of platform-specific information to populate the ComboBox.

Ginger/GingerCoreNET/Run/Platforms/PlatformsInfo/JavaPlatform.cs (1)

1077-1084: Well-documented method for fetching Java platform POM element categories.

Ginger/GingerCore/Drivers/PBDriver/PBDriver.cs (1)

91-106: The implementation of the PomCategory property with a default value specific to PowerBuilder is a good approach. However, consider adding a comment explaining why ePomElementCategory.PowerBuilder is used as a default to enhance code readability.

Ginger/GingerCore/Drivers/WindowsLib/WindowsDriver.cs (1)

108-123: Implement PomCategory with a default value and a setter.

The implementation of the PomCategory property with a default value of ePomElementCategory.Windows when not set is a good practice as it ensures a fallback value. The use of the base class property in the setter is also appropriate, maintaining encapsulation and reducing redundancy.

Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (1)

Line range hint 1876-1907: Optimization in Element Collection
[REFACTOR_SUGGESTion]
The method GetVisibleControls seems to be doing a lot within a single function, including XML node parsing, element filtering, and UI updates. Consider breaking this method into smaller, more focused methods to improve readability and maintainability. For instance, separating the XML parsing, element filtering, and UI update functionalities into distinct methods could make the code cleaner and easier to manage.

- EI.IsAutoLearned = true;
+ // Refactor suggestion: Break down this method into smaller parts
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs (2)

425-440: Implementation of PomCategory property looks good and adheres to the expected behavior.


5125-5127: Setting of PomCategory in HTMLElementInfo is consistent with the changes across the project. Good integration of POM category handling.

Comment on lines +1276 to +1277
inspectElementInfo.SetLocatorsAndPropertiesCategory(((DriverBase)mWindowExplorerDriver).PomCategory);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure consistent handling of PomCategory across different drivers.

The method SetLocatorsAndPropertiesCategory is being called with PomCategory from DriverBase. This is a good practice as it ensures that the category is consistently applied across different drivers. However, ensure that all drivers properly implement and handle the PomCategory property to avoid runtime errors or incorrect behavior.

Comment on lines +500 to +510
public void SetLocatorsAndPropertiesCategory(ePomElementCategory? category)
{
foreach(ElementLocator locator in Locators)
{
locator.Category = category;
}
foreach (ControlProperty property in Properties)
{
property.Category = category;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding null checks for the category parameter.

500  public void SetLocatorsAndPropertiesCategory(ePomElementCategory? category)
501  {
+     if (category == null) return;
502      foreach(ElementLocator locator in Locators)
503      {
504          locator.Category = category;
505      }
506      foreach (ControlProperty property in Properties)
507      {
508          property.Category = category;
509      }
510  }

This change ensures that the method handles null values gracefully, preventing potential null reference exceptions.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public void SetLocatorsAndPropertiesCategory(ePomElementCategory? category)
{
foreach(ElementLocator locator in Locators)
{
locator.Category = category;
}
foreach (ControlProperty property in Properties)
{
property.Category = category;
}
}
public void SetLocatorsAndPropertiesCategory(ePomElementCategory? category)
{
if (category == null) return;
foreach(ElementLocator locator in Locators)
{
locator.Category = category;
}
foreach (ControlProperty property in Properties)
{
property.Category = category;
}
}

Comment on lines +109 to +124
public override ePomElementCategory? PomCategory
{
get
{
if (base.PomCategory == null)
{
return ePomElementCategory.Java;
}
else
{
return base.PomCategory;
}
}

set => base.PomCategory = value;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure proper handling of PomCategory default value.

The implementation of the PomCategory property uses a base class property. It defaults to ePomElementCategory.Java if not set. This is a logical approach, but ensure that this default behavior is documented and that it aligns with the expected behavior across all usages of this property.

Comment on lines +2162 to +2164
//set the POM category
ci.SetLocatorsAndPropertiesCategory(this.PomCategory);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set PomCategory for JavaElementInfo instances.

The setting of PomCategory in the GetVisibleControls method is a good addition for consistency. However, consider encapsulating this behavior within the JavaElementInfo constructor or a factory method to ensure that all instances are correctly initialized without requiring external code to set it explicitly.

- ci.SetLocatorsAndPropertiesCategory(this.PomCategory);
+ // This line can be moved to the constructor of JavaElementInfo

Committable suggestion was skipped due to low confidence.

Comment on lines +178 to +200
public override ePomElementCategory? PomCategory
{
get
{
if (AppType == eAppType.NativeHybride)
{
switch(DevicePlatformType)
{
case eDevicePlatformType.iOS:
return ePomElementCategory.iOS;
case eDevicePlatformType.Android:
default:
return ePomElementCategory.Android;
}
}
else
{
return ePomElementCategory.Web;
}
}

set => base.PomCategory = value;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure Consistency in Property Implementation

The PomCategory property is overridden here. While the getter is well-implemented with logic to determine the category based on AppType and DevicePlatformType, the setter directly assigns the value to the base class property. This could lead to inconsistencies if the getter logic is expected to always determine the value. Consider if the setter should also contain logic or if it should be made read-only to ensure consistency.

var currentSelected = (DeltaElementInfo)xDeletedElementsMappingGrid.Grid.CurrentItem;

RemoveSelectedElementFromCombobox(currentSelected);
//RemoveSelectedElementFromCombobox(currentSelected);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this commented out code as it is no longer needed and clutters the codebase.

- //RemoveSelectedElementFromCombobox(currentSelected);
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
//RemoveSelectedElementFromCombobox(currentSelected);
Tools
GitHub Check: Codacy Static Code Analysis

[warning] 101-101: Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaDeletedElementMappingWizardPage.xaml.cs#L101
Remove this commented out code.


//filtering mapped added element
var filteredAddedList = new ObservableList<DeltaElementInfo>(deltaAddedList.Where(x => NewAddedElementComboList.Any(y => y.InternalValue == x.ElementInfo.Guid.ToString())));
// var filteredAddedList = new ObservableList<DeltaElementInfo>(deltaAddedList.Where(x => NewAddedElementComboList.Any(y => y.InternalValue == x.ElementInfo.Guid.ToString())));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this commented out code as it is no longer needed and clutters the codebase.

- // var filteredAddedList = new ObservableList<DeltaElementInfo>(deltaAddedList.Where(x => NewAddedElementComboList.Any(y => y.InternalValue == x.ElementInfo.Guid.ToString())));
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// var filteredAddedList = new ObservableList<DeltaElementInfo>(deltaAddedList.Where(x => NewAddedElementComboList.Any(y => y.InternalValue == x.ElementInfo.Guid.ToString())));
Tools
GitHub Check: Codacy Static Code Analysis

[warning] 166-166: Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaDeletedElementMappingWizardPage.xaml.cs#L166
Remove this commented out code.

Comment on lines +105 to +125
//{
// NewAddedElementComboList.Clear();
// GetNewAddedElementComboBoxItem();
// foreach (var item in DeletedDeltaElementInfos)
// {
// if (currentSelected != null && item.MappedElementInfo == currentSelected.MappedElementInfo)
// {
// continue;
// }
// if (item.MappedElementInfo != null && item.MappedElementInfo.ToLower() != "none")
// {
// var removeItem = NewAddedElementComboList.IndexOf(NewAddedElementComboList.FirstOrDefault(x => x.InternalValue == item.MappedElementInfo));

// if (removeItem != -1)
// {
// NewAddedElementComboList.RemoveAt(removeItem);
// }

// }
// }
//}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this commented out code as it is no longer needed and clutters the codebase.

- //private void RemoveSelectedElementFromCombobox(DeltaElementInfo currentSelected = null)
- //{
- //    NewAddedElementComboList.Clear();
- //    GetNewAddedElementComboBoxItem();
- //    foreach (var item in DeletedDeltaElementInfos)
- //    {
- //        if (currentSelected != null && item.MappedElementInfo == currentSelected.MappedElementInfo)
- //        {
- //            continue;
- //        }
- //        if (item.MappedElementInfo != null && item.MappedElementInfo.ToLower() != "none")
- //        {
- //            var removeItem = NewAddedElementComboList.IndexOf(NewAddedElementComboList.FirstOrDefault(x => x.InternalValue == item.MappedElementInfo));
- //
- //            if (removeItem != -1)
- //            {
- //                NewAddedElementComboList.RemoveAt(removeItem);
- //            }
- //
- //        }
- //    }
- //}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
//{
// NewAddedElementComboList.Clear();
// GetNewAddedElementComboBoxItem();
// foreach (var item in DeletedDeltaElementInfos)
// {
// if (currentSelected != null && item.MappedElementInfo == currentSelected.MappedElementInfo)
// {
// continue;
// }
// if (item.MappedElementInfo != null && item.MappedElementInfo.ToLower() != "none")
// {
// var removeItem = NewAddedElementComboList.IndexOf(NewAddedElementComboList.FirstOrDefault(x => x.InternalValue == item.MappedElementInfo));
// if (removeItem != -1)
// {
// NewAddedElementComboList.RemoveAt(removeItem);
// }
// }
// }
//}
Tools
GitHub Check: Codacy Static Code Analysis

[warning] 105-105: Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaDeletedElementMappingWizardPage.xaml.cs#L105
Remove this commented out code.

GetNewAddedElementComboBoxItem();
view.GridColsView.Add(new GridColView() { Field = nameof(DeltaElementInfo.MappedElementInfo), Header = "New Added Element", StyleType = GridColView.eGridColStyleType.ComboBox, CellValuesList = NewAddedElementComboList, ComboboxDisplayMemberField = nameof(NewAddedComboboxItem.DisplayValue), ComboboxSelectedValueField = nameof(NewAddedComboboxItem.InternalValue), BindingMode = BindingMode.TwoWay });
view.GridColsView.Add(new GridColView() { Field = " ", Header = " ", WidthWeight = 15, BindingMode = BindingMode.OneWay, StyleType = GridColView.eGridColStyleType.Template, CellTemplate = (DataTemplate)this.MainGrid.Resources["xMatchingElementTemplate"] });
//GetNewAddedElementComboBoxItem();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this commented out code as it is no longer needed and clutters the codebase.

- //GetNewAddedElementComboBoxItem();
- //view.GridColsView.Add(new GridColView() { Field = nameof(DeltaElementInfo.MappedElementInfo), Header = "Mapped New Element", StyleType = GridColView.eGridColStyleType.ComboBox, CellValuesList = NewAddedElementComboList, ComboboxDisplayMemberField = nameof(NewAddedComboboxItem.DisplayValue), ComboboxSelectedValueField = nameof(NewAddedComboboxItem.InternalValue), BindingMode = BindingMode.TwoWay });

Committable suggestion was skipped due to low confidence.

Tools
GitHub Check: Codacy Static Code Analysis

[warning] 76-76: Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaDeletedElementMappingWizardPage.xaml.cs#L76
Remove this commented out code.


SetDeletedElementsGridView();
DeletedDeltaElementInfos = new ObservableList<DeltaElementInfo>(mPomWizard.mPomDeltaUtils.DeltaViewElements.Where(x => x.DeltaStatus.Equals(eDeltaStatus.Deleted)));
DeletedDeltaElementInfos = new ObservableList<DeltaElementInfo>(mPomWizard.mPomDeltaUtils.DeltaViewElements.Where(x => x.DeltaStatus.Equals(eDeltaStatus.Deleted) && x.IsSelected == true));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assignment of DeletedDeltaElementInfos is straightforward and correctly filters elements based on their status. However, consider simplifying the Boolean expression by removing unnecessary literals.

- DeletedDeltaElementInfos = new ObservableList<DeltaElementInfo>(mPomWizard.mPomDeltaUtils.DeltaViewElements.Where(x => x.DeltaStatus.Equals(eDeltaStatus.Deleted) && x.IsSelected == true));
+ DeletedDeltaElementInfos = new ObservableList<DeltaElementInfo>(mPomWizard.mPomDeltaUtils.DeltaViewElements.Where(x => x.DeltaStatus == eDeltaStatus.Deleted && x.IsSelected));
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
DeletedDeltaElementInfos = new ObservableList<DeltaElementInfo>(mPomWizard.mPomDeltaUtils.DeltaViewElements.Where(x => x.DeltaStatus.Equals(eDeltaStatus.Deleted) && x.IsSelected == true));
DeletedDeltaElementInfos = new ObservableList<DeltaElementInfo>(mPomWizard.mPomDeltaUtils.DeltaViewElements.Where(x => x.DeltaStatus == eDeltaStatus.Deleted && x.IsSelected));
Tools
GitHub Check: Codacy Static Code Analysis

[notice] 61-61: Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/DeltaWizard/PomDeltaDeletedElementMappingWizardPage.xaml.cs#L61
Remove the unnecessary Boolean literal(s).

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c3bc175 and 95905d2.

Files selected for processing (1)
  • Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (6 hunks)
Files skipped from review as they are similar to previous changes (1)
  • Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range and nitpick comments (1)
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs (1)

4060-4068: Consider adding a comment explaining why the category is only considered in mobile flows for better code clarity.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 95905d2 and 9336fe5.

Files selected for processing (1)
  • Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs (4 hunks)
Additional comments not posted (4)
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs (4)

29-29: Consider removing unused imports to maintain code cleanliness.


425-440: The implementation of PomCategory property is well-encapsulated and handles default values correctly.


5129-5131: Proper use of this.PomCategory to set the category in foundElementInfo.


29-29: Please verify the usage of new imports to ensure they are necessary.

Verification successful

The verification confirms that all the mentioned namespaces are indeed used within the SeleniumDriver.cs file. Hence, the imports are necessary and should not be removed.

  • Amdocs.Ginger.CoreNET.ActionsLib.UI.Web
  • Amdocs.Ginger.CoreNET.Application_Models.Execution.POM
  • Amdocs.Ginger.CoreNET.Drivers.CoreDrivers.Web
  • Amdocs.Ginger.CoreNET.Drivers.CoreDrivers.Mobile
  • Amdocs.Ginger.CoreNET.Drivers.CoreDrivers.Web.Selenium
  • Amdocs.Ginger.CoreNET.Execution
  • Amdocs.Ginger.CoreNET.GeneralLib
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of newly added imports in SeleniumDriver.cs.

# Test: Search for the usage of the newly added namespaces. Expect: At least one usage of each namespace.
rg --type cs --files-with-matches 'Amdocs.Ginger.CoreNET.ActionsLib.UI.Web|Amdocs.Ginger.CoreNET.Application_Models.Execution.POM|Amdocs.Ginger.CoreNET.Drivers.CoreDrivers.Web|Amdocs.Ginger.CoreNET.Drivers.CoreDrivers.Mobile|Amdocs.Ginger.CoreNET.Drivers.CoreDrivers.Web.Selenium|Amdocs.Ginger.CoreNET.Execution|Amdocs.Ginger.CoreNET.GeneralLib' Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs

Length of output: 491



Script:

#!/bin/bash
# Description: Verify the usage of each import in SeleniumDriver.cs.

# Test: Search for the usage of each namespace individually. Expect: At least one usage of each namespace.
for namespace in \
    "Amdocs.Ginger.CoreNET.ActionsLib.UI.Web" \
    "Amdocs.Ginger.CoreNET.Application_Models.Execution.POM" \
    "Amdocs.Ginger.CoreNET.Drivers.CoreDrivers.Web" \
    "Amdocs.Ginger.CoreNET.Drivers.CoreDrivers.Mobile" \
    "Amdocs.Ginger.CoreNET.Drivers.CoreDrivers.Web.Selenium" \
    "Amdocs.Ginger.CoreNET.Execution" \
    "Amdocs.Ginger.CoreNET.GeneralLib"
do
    echo "Checking usage of $namespace:"
    rg --type cs "$namespace" Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs
    echo
done

Length of output: 5227

@Maheshkale447
Maheshkale447 changed the base branch from Releases/Beta to master June 20, 2024 14:50
@Maheshkale447
Maheshkale447 merged commit ae7372b into master Jun 24, 2024
@Maheshkale447
Maheshkale447 deleted the Single-POM-For-Android-And-iOS branch June 24, 2024 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants