Skip to content

MainFrame Support Added for F13 to F24 keys#4357

Merged
prashelke merged 4 commits into
masterfrom
Enhancement/MainFrameSupport
Nov 11, 2025
Merged

MainFrame Support Added for F13 to F24 keys#4357
prashelke merged 4 commits into
masterfrom
Enhancement/MainFrameSupport

Conversation

@prashelke

@prashelke prashelke commented Nov 11, 2025

Copy link
Copy Markdown
Contributor

Description

Type of Change

  • Bug fix - [ ] New feature - [ ] Breaking change - [ ] Plugin update

Checklist

  • PR description clearly describes the changes
  • Target branch is correct (master for features, Releases/* for fixes)
  • Latest code from target branch merged
  • No commented/junk code included
  • No new build warnings or errors
  • All existing unit tests pass
  • New unit tests added for new functionality
  • Cross-platform compatibility verified (Windows/Linux/macOS)
  • CI/CD pipeline passes
  • Code follows project conventions (Act{Platform}{Type}, {Platform}Driver)
  • Repository objects use [IsSerializedForLocalRepository] where needed
  • Error handling uses Reporter.ToLog() pattern
  • Documentation updated for user-facing changes
  • Self-review completed and code review comments addressed

Summary by CodeRabbit

  • Bug Fixes

    • Added null safety check for connection status property.
    • Improved error message clarity when page object model elements are not found.
  • Chores

    • Updated assembly dependency handling to use flexible versioning.

@coderabbitai

coderabbitai Bot commented Nov 11, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The PR improves null safety in the MainFrame driver, refactors Terminal driver's screen XML handling to use updated API methods, simplifies the Open3270 assembly reference configuration, and updates the POM element-not-found error message formatting in the Selenium driver.

Changes

Cohort / File(s) Change Summary
MainFrame Driver Null Safety
Ginger/GingerCore/Drivers/MainFrame/MainFrameDriver.cs
Added null-guard logic to the isConnected property to return false when MFE is null; otherwise returns MFE.IsConnected. Existing try-catch exception handling preserved.
Terminal Driver Screen Rendering
Ginger/GingerCore/Drivers/MainFrame/Terminal.cs
Removed RowsCount and ColumnsCount assignment to emu.Config in constructor. In GetScreenAsXML, replaced emu.GetScreenAsXML() with explicit Render() call with emu.CurrentScreenXML and parameterless XmlS.Render() invocation.
Project Assembly Reference
Ginger/GingerCore/GingerCore.csproj
Simplified Open3270 assembly reference: removed explicit version (1.5.0.1), culture, processor architecture, and SpecificVersion attribute; now uses generic Include="Open3270" with HintPath preserved.
POM Element Error Messaging
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs
Updated error message when POM element is not found in ActUIElement handling from verbose concatenation to concise format: "POM Element not found: POM = '{currentPOM.Name}' , Element = '{currentPOMElementInfo.ElementName}'".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Attention areas:
    • Verify Terminal.cs API compatibility: confirm emu.CurrentScreenXML property exists and that XmlS.Render() produces equivalent output to the previous explicit Render(ColumnsCount, RowsCount) call.
    • Validate Open3270 version resolution: ensure the simplified assembly reference correctly resolves dependencies without breaking mainframe driver functionality.
    • Confirm MainFrameDriver null-guard logic doesn't mask underlying MFE initialization issues that should be logged or handled differently.

Possibly related PRs

Suggested reviewers

  • Maheshkale447

Poem

🐰 A null guard here, an XML there,
Assembly refs simplified with care,
Error messages dressed in their Sunday best,
The drivers now pass their robust test!

Pre-merge checks and finishing touches

❌ Failed checks (3 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'MainFrame Support Added for F13 to F24 keys' mentions F13-F24 key support but the code changes show fixes to null checks, XML handling, assembly references, and error messages with no evidence of F13-F24 key implementation. Update the title to accurately reflect the actual changes, such as 'Fix MainFrame driver null safety and refactor XML screen handling' or similar based on the real modifications.
Description check ⚠️ Warning The PR description is completely empty with no actual content provided—only the template structure remains with all sections blank and all checklist items unchecked. Provide a complete description including what changes were made, why they were necessary, and mark the appropriate Type of Change checkbox. Address all applicable verification checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch Enhancement/MainFrameSupport

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 308f01b and 73b3500.

📒 Files selected for processing (1)
  • Ginger/GingerCore/Drivers/MainFrame/MainFrameDriver.cs (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: prashelke
Repo: Ginger-Automation/Ginger PR: 4294
File: Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs:9146-9291
Timestamp: 2025-09-04T15:43:57.789Z
Learning: In SeleniumDriver.cs, prefer using the C# fallback GenerateEnhancedSvgXPath(IWebElement) for SVG XPath generation instead of injecting/validating a JavaScript-based XPath builder. This was accepted in PR Ginger-Automation/Ginger#4294.
📚 Learning: 2025-09-04T11:19:44.719Z
Learnt from: prashelke
Repo: Ginger-Automation/Ginger PR: 4294
File: Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs:10651-10658
Timestamp: 2025-09-04T11:19:44.719Z
Learning: In Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs, maintainer prefers not to keep the helper IsSvgElementByWebElement(IWebElement); rely on the existing enum-based IsSvgElement(eElementType) helper instead. Future reviews should not reintroduce IsSvgElementByWebElement.

Applied to files:

  • Ginger/GingerCore/Drivers/MainFrame/MainFrameDriver.cs
🔇 Additional comments (1)
Ginger/GingerCore/Drivers/MainFrame/MainFrameDriver.cs (1)

124-137: LGTM! Improved null safety with explicit guard.

The explicit null check for MFE before accessing MFE.IsConnected is a solid improvement. Null checking is an essential part of developing quality C# code, and code that attempts to access a member of a null object reference throws a NullReferenceException. This change replaces exception-based control flow with defensive coding practices that leverage language features to effectively prevent null reference exceptions, making the code more performant and readable.

The change is contextually sound: when IsServerAvailable is false, LaunchDriver returns early without initializing MFE (lines 165–169). The isConnected property is then used by IsRunning() (line 528–532) to check driver status, which may be called during queries before full driver initialization. The explicit null check at line 130 prevents a NullReferenceException in this scenario.

However, the script output reveals 33+ other MFE accesses throughout the file (lines 204, 239, 291, 314, 339, 414, 418, 421, 433, 438, 456, 467, 473, 490, 496, 614, 628, 637, 645, 650, 653, 665, 667, 668, 674, 676, 679, 688, 692, 700, 704, 744) without null checks. These are likely guarded at the method call level (e.g., within Execute() or RunAction() flows that only proceed after LaunchDriver completion), but this requires manual verification.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Ginger/GingerCore/Drivers/MainFrame/Terminal.cs (1)

41-50: Remove unused RowsCount and ColumnsCount parameters from Terminal constructor.

The parameters are accepted but never assigned to emu.Config or used anywhere in the Terminal class. Open3270 determines terminal dimensions from the TermType configuration (e.g., IBM-3278-2-E) rather than separate row/column parameters.

Remove the unused parameters from:

  • Terminal constructor signature (line 41)
  • Terminal instantiation in MainFrameDriver.cs (line 171, currently passing MFRows and MFColumns)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 671b3eb and edfbb17.

⛔ Files ignored due to path filters (1)
  • Ginger/Ginger/DLLs/Open3270.dll is excluded by !**/*.dll, !**/*.dll
📒 Files selected for processing (4)
  • Ginger/Ginger/Ginger.csproj (1 hunks)
  • Ginger/GingerCore/Drivers/MainFrame/MainFrameDriver.cs (1 hunks)
  • Ginger/GingerCore/Drivers/MainFrame/Terminal.cs (1 hunks)
  • Ginger/GingerCore/GingerCore.csproj (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-08-25T08:48:11.915Z
Learnt from: AmanPrasad43
Repo: Ginger-Automation/Ginger PR: 4281
File: Ginger/GingerCore/GingerCore.csproj:538-538
Timestamp: 2025-08-25T08:48:11.915Z
Learning: In the Ginger codebase, the OWASPZAPDotNetAPI package reference in GingerCore.csproj is required for architectural reasons, even when direct usage is not immediately visible in the codebase. This was confirmed by AmanPrasad43 during the security testing feature implementation.

Applied to files:

  • Ginger/GingerCore/GingerCore.csproj
  • Ginger/Ginger/Ginger.csproj
📚 Learning: 2025-03-20T11:10:30.816Z
Learnt from: GokulBothe99
Repo: Ginger-Automation/Ginger PR: 4137
File: Ginger/Ginger/SourceControl/SourceControlProjectsPage.xaml.cs:21-21
Timestamp: 2025-03-20T11:10:30.816Z
Learning: The `Amdocs.Ginger.Common.SourceControlLib` namespace is required in files that reference the `GingerSolution` class for source control operations in the Ginger automation framework.

Applied to files:

  • Ginger/GingerCore/GingerCore.csproj
  • Ginger/Ginger/Ginger.csproj
📚 Learning: 2025-06-16T10:37:13.073Z
Learnt from: prashelke
Repo: Ginger-Automation/Ginger PR: 4232
File: Ginger/GingerCoreNET/ActionsLib/UI/VisualTesting/VRTAnalyzer.cs:19-22
Timestamp: 2025-06-16T10:37:13.073Z
Learning: In Ginger codebase, both `using amdocs.ginger.GingerCoreNET;` and `using Amdocs.Ginger.CoreNET;` are valid and serve different purposes. The first (lowercase) contains the WorkSpace class and related workspace functionality, while the second (proper case) contains drivers like GenericAppiumDriver and other core functionality. Both may be required in files that use types from both namespaces.

Applied to files:

  • Ginger/GingerCore/GingerCore.csproj
📚 Learning: 2025-01-16T04:09:15.662Z
Learnt from: IamRanjeetSingh
Repo: Ginger-Automation/Ginger PR: 4058
File: Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/ActionHandlers/ActUIElementHandler.cs:648-649
Timestamp: 2025-01-16T04:09:15.662Z
Learning: The Ginger project primarily targets .NET 8.0, which supports C# 12 features including collection expressions with spread operator.

Applied to files:

  • Ginger/GingerCore/GingerCore.csproj
🧬 Code graph analysis (1)
Ginger/GingerCore/Drivers/MainFrame/Terminal.cs (1)
Ginger/GingerCore/Drivers/MainFrame/MainFrameDriver.cs (1)
  • XMLScreen (612-615)
🔇 Additional comments (3)
Ginger/GingerCore/Drivers/MainFrame/MainFrameDriver.cs (1)

130-130: LGTM! Good defensive null-safety check.

The null check prevents potential NullReferenceException when accessing MFE.IsConnected. Returning false when MFE is null is the appropriate default for a connection status check.

Ginger/Ginger/Ginger.csproj (1)

846-848: Resolve the inconsistent Open3270 DLL paths—both reference directories that don't exist.

The verification confirms a critical inconsistency: Ginger.csproj (line 846–847) references ..\..\..\..\..\..\..\TestDLL\Open3270.dll, while GingerCore.csproj (line 92–93) and GingerCoreNET.csproj (line 431–432) both reference ..\Ginger\DLLs\Open3270.dll. Neither TestDLL nor DLLs directories exist in the repository, meaning both paths are broken. This will cause:

  1. Build failures when projects attempt to resolve the missing reference
  2. Different Open3270 versions loaded (or load failure) across projects
  3. Confusion about the canonical DLL location

Standardize all Open3270 references to the same relative path pointing to an actual DLL location in the repository.

⛔ Skipped due to learnings
Learnt from: prashelke
Repo: Ginger-Automation/Ginger PR: 4067
File: Ginger/GingerCoreCommon/Repository/SolutionRepository.cs:55-55
Timestamp: 2025-01-21T11:43:12.379Z
Learning: In Ginger's SolutionRepository, the path @"ExecutionResults\GingerExecutionResults.db" needs to be explicitly excluded in mSolutionPathsToAvoid list, even though its parent directory @"ExecutionResults\" is also excluded. This specific file exclusion serves a distinct purpose and should not be considered redundant.
Learnt from: AmanPrasad43
Repo: Ginger-Automation/Ginger PR: 4281
File: Ginger/GingerCore/GingerCore.csproj:538-538
Timestamp: 2025-08-25T08:48:11.915Z
Learning: In the Ginger codebase, the OWASPZAPDotNetAPI package reference in GingerCore.csproj is required for architectural reasons, even when direct usage is not immediately visible in the codebase. This was confirmed by AmanPrasad43 during the security testing feature implementation.
Ginger/GingerCore/Drivers/MainFrame/Terminal.cs (1)

62-63: Add null check before cast; verify Render() implementation in Open3270.

The explicit cast at line 62 is inconsistent with the codebase pattern—lines 151, 201, 251, and 253 access emu.CurrentScreenXML directly without casting, indicating the property already returns XMLScreen type. More critically, there is no null check before the cast; if CurrentScreenXML is null, XmlS.Render() will throw NullReferenceException.

Although the Refresh() loop suggests the screen should be valid after line 199, explicit null checking is defensive. Additionally, Render() is called without parameters, and MFRows/MFColumns (defined in MainFrameDriver) are not passed to it—verify in Open3270 documentation whether Render() has overloads that accept dimensions or if it determines them internally.

Comment thread Ginger/GingerCore/GingerCore.csproj
Maheshkale447
Maheshkale447 previously approved these changes Nov 11, 2025
@prashelke
prashelke merged commit 7b04dd9 into master Nov 11, 2025
11 checks passed
@prashelke
prashelke deleted the Enhancement/MainFrameSupport branch November 11, 2025 20:22
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