Skip to content

1- fixed missing POM elements category setup#3798

Merged
Maheshkale447 merged 2 commits into
Releases/Betafrom
Meni-2024.3-Beta2-Fixes
Jun 28, 2024
Merged

1- fixed missing POM elements category setup#3798
Maheshkale447 merged 2 commits into
Releases/Betafrom
Meni-2024.3-Beta2-Fixes

Conversation

@MeniKadosh1

@MeniKadosh1 MeniKadosh1 commented Jun 27, 2024

Copy link
Copy Markdown
Contributor

2- fixing category related bugs
3- added check for mobile driver to validate the session is still active before taking screen shoot

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

    • Enhanced element merging prompt to include the name of the element being deleted.
  • Bug Fixes

    • Adjusted window dimensions in the mobile driver window for better UI consistency.
  • Refactor

    • Improved filtering logic for element details based on category in POM execution utilities.
  • Chores

    • Added method calls to set locators and properties category across various components for consistent element handling.
    • Updated import statements for better modularization and code organization.

2- fixing category related bugs
3- added check for mobile driver to validate the session is still active before taking screen shoot
@coderabbitai

coderabbitai Bot commented Jun 27, 2024

Copy link
Copy Markdown
Contributor

Walkthrough

The updates mainly revolve around setting locators and properties categories for various UI elements across different parts of the application. This change ensures that elements are properly categorized in the Page Object Model (POM) context. Additionally, some UI adjustments were made, such as changes to window sizes and refinements to message prompts.

Changes

Files Change Summary
.../POMModels/PomAllElementsPage.xaml.cs Added a method call to set locators and properties category for an element using mSpyElement.SetLocatorsAndPropertiesCategory.
.../POMModels/PomElementsPage.xaml.cs Updated the MergeSelectedElements method to include element names in the message prompt using string.Format.
.../WindowExplorer/Common/WindowExplorerPage.xaml.cs Called SetLocatorsAndPropertiesCategory method for elements in HTMLPageSourceTree_SelectedItemChanged and XMLPageSourceTree_SelectedItemChanged methods.
.../MobileDriverWindow.xaml Adjusted the window height from 650 to 685 and width from 750 to 323.
.../UserControlsLib/LiveSpyHandler.xaml.cs Added import for GingerCore.Drivers and called method to set locators and properties category for SpySelectedElement.
.../Application Models/Execution/POM/POMExecutionUtils.cs Refactored GetCurrentPOMElementInfo method and introduced a new method FilterElementDetailsByCategory.
.../Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs Imported Amdocs.Ginger.CoreNET.Application_Models.Execution.POM, modified HighLightElement method, and added test for session validity in GetScreenshotImage method.
.../RecordingLib/RecordingManager.cs Added an import for GingerCore.Drivers and modified ElementRecordedHandler to set locators and properties category.

Poem

In lines of code, a tale's been spun,
Where elements now find their place, one by one.
Windows resized, elements bright,
Categorized in POM's light.
With logic clear and paths refined,
In Ginger's code, improvements shine.

~ 🐰✨


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.

@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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8e0fb12 and 7e0d0a2.

Files selected for processing (8)
  • Ginger/Ginger/ApplicationModelsLib/POMModels/PomAllElementsPage.xaml.cs (1 hunks)
  • Ginger/Ginger/ApplicationModelsLib/POMModels/PomElementsPage.xaml.cs (1 hunks)
  • Ginger/Ginger/AutomatePageLib/AddActionMenu/WindowExplorer/Common/WindowExplorerPage.xaml.cs (2 hunks)
  • Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml (1 hunks)
  • Ginger/Ginger/UserControlsLib/LiveSpyHandler.xaml.cs (2 hunks)
  • Ginger/GingerCoreNET/Application Models/Execution/POM/POMExecutionUtils.cs (1 hunks)
  • Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (4 hunks)
  • Ginger/GingerCoreNET/RecordingLib/RecordingManager.cs (2 hunks)
Additional comments not posted (12)
Ginger/Ginger/UserControlsLib/LiveSpyHandler.xaml.cs (2)

22-22: Import statement added for GingerCore.Drivers.

This is necessary for the subsequent use of driver-related functionalities within this file.


133-133: Method call to set locators and properties categories added.

This change is in line with the PR's objective to enhance element handling by setting appropriate categories, which should improve the manageability and clarity of UI elements.

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

85-91: Refactoring to improve modularity in element filtering.

The logic to filter element details by category has been moved to a new method, FilterElementDetailsByCategory, enhancing readability and maintainability.


93-120: New method for filtering element details by category.

This method supports the refactoring by encapsulating the filtering logic, making the GetCurrentPOMElementInfo method cleaner and focused on its primary responsibility.

Ginger/GingerCoreNET/RecordingLib/RecordingManager.cs (1)

26-26: Import statement added for GingerCore.Drivers.

This is necessary for the subsequent use of driver-related functionalities within this file.

Ginger/Ginger/ApplicationModelsLib/POMModels/PomAllElementsPage.xaml.cs (1)

245-245: Method call to set locators and properties categories added.

This change is in line with the PR's objective to enhance element handling by setting appropriate categories, which should improve the manageability and clarity of UI elements.

Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml (1)

7-7: Window dimensions updated.

The height and width of the window have been adjusted, likely to better accommodate different screen sizes and enhance user interaction.

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

426-426: Enhancement to user feedback in element merge operation.

The updated message prompt in the MergeSelectedElements method now includes the name of the element that will be deleted post-merge, enhancing clarity for the user. This is a positive change as it helps in setting the right expectations before performing a potentially destructive operation.

Ginger/Ginger/AutomatePageLib/AddActionMenu/WindowExplorer/Common/WindowExplorerPage.xaml.cs (2)

210-211: Set POM Category in HTMLPageSourceTree_SelectedItemChanged Method

The addition of setting the POM category for elemInfo using the mWindowExplorerDriver's PomCategory is aligned with the PR's objective to enhance POM element handling. This change ensures that the element information is categorized correctly when selected from the HTML source tree.

  • Ensure that elemInfo and mWindowExplorerDriver are not null before this operation to avoid potential null reference exceptions.
  • Consider adding a unit test to verify that the category is set correctly.

233-234: Set POM Category in XMLPageSourceTree_SelectedItemChanged Method

Similar to the HTML source tree, setting the POM category for elements selected from the XML source tree ensures consistency and correct categorization across different types of source trees. This change supports the PR's goal of refining element management.

  • As with the HTML method, ensure the safety of this operation by checking for null values in elemInfo and mWindowExplorerDriver.
  • Adding a unit test for this method would help ensure that the category setting behaves as expected under various conditions.
Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (2)

40-40: Import statement added for POM-related functionality.

This import statement enables the use of POM (Page Object Model) related functions within this driver, aligning with the changes described in the AI-generated summary about refactoring for better element categorization.


1739-1762: Enhanced element highlighting with category filtering.

The HighLightElement method now incorporates the FilterElementDetailsByCategory method to filter elements based on the POM category before attempting to highlight them. This change enhances the method's ability to handle elements appropriately based on their category, which is crucial for maintaining consistency across different platforms and drivers.

Comment on lines +2754 to +2770
int checkSessionCounter = 0;
public Byte[] GetScreenshotImage()
{
return Driver.GetScreenshot().AsByteArray;
checkSessionCounter++;
//check session is still valid
if (checkSessionCounter % 5 == 0)
{
if (Driver.SessionDetails != null)
{
return Driver.GetScreenshot().AsByteArray;
}
}
else
{
return Driver.GetScreenshot().AsByteArray;
}

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.

Refactor suggested for session check logic in GetScreenshotImage.

The method GetScreenshotImage has been modified to include a session validity check. However, the check is performed every fifth call, which might not be frequent enough depending on the session timeout settings. Consider checking the session validity on every call or based on a configurable parameter.

Additionally, the method contains multiple return points and somewhat repetitive code. Consider refactoring for clarity and efficiency.

- if (checkSessionCounter % 5 == 0)
+ // Example: Introduce a method to handle session checks
+ private bool IsSessionValid()
+ {
+     return Driver.SessionDetails != null;
+ }

- if (Driver.SessionDetails != null)
+ if (IsSessionPassword())
{
    return Driver.GetScreenshot().AsByteArray;
}
- else
+ return null;

Committable suggestion was skipped due to low confidence.

@Maheshkale447
Maheshkale447 merged commit b4f0244 into Releases/Beta Jun 28, 2024
@Maheshkale447
Maheshkale447 deleted the Meni-2024.3-Beta2-Fixes branch June 28, 2024 07:20
@coderabbitai coderabbitai Bot mentioned this pull request Nov 26, 2024
15 tasks
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.

2 participants