-
Notifications
You must be signed in to change notification settings - Fork 60
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
Bug fix/Empty POM adding with Activity target application #3877
Conversation
WalkthroughThe changes encompass modifications to several files, primarily focusing on enhancing functionality related to SSL certificate management, application platform handling, and HTTP client configuration. Key updates include the addition of event handlers, new methods for unique file path generation, and the introduction of required parameters in constructors. These adjustments aim to improve code organization, maintainability, and modularity across various components of the application. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI
participant API
participant CertHandler
User->>UI: Check "Do Not Certificate Import"
UI->>CertHandler: DoNotCertificateImportFile_Checked()
CertHandler->>API: Validate certificate path
API->>CertHandler: Path valid
CertHandler->>CertHandler: Copy certificate to path
CertHandler->>UI: Update UI with new certificate path
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Inline review comments failed to post
Actionable comments posted: 4
Outside diff range, codebase verification and nitpick comments (2)
Ginger/GingerCoreNET/Drivers/WebServicesDriver/HttpWebClientUtils.cs (2)
Line range hint
359-373
: Correct the method name.The method name is misspelled as
InitilizeClient
. It should beInitializeClient
.Apply this diff to correct the method name:
-private void InitilizeClient(HttpMessageHandler handler) +private void InitializeClient(HttpMessageHandler handler)
Line range hint
714-724
: Correct the method name.The method name is misspelled as
RequestConstractorREST
. It should beRequestConstructorREST
.Apply this diff to correct the method name:
-private bool RequestConstractorREST(HttpClientHandler handler) +private bool RequestConstructorREST(HttpClientHandler handler)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (4)
Ginger/GingerCore/DLLs/RQMExportStd.dll
is excluded by!**/*.dll
,!**/*.dll
Ginger/GingerCore/DLLs/RQM_RepositoryStd.dll
is excluded by!**/*.dll
,!**/*.dll
Ginger/GingerCoreNET/DLLS/RQMExportStd.dll
is excluded by!**/*.dll
,!**/*.dll
Ginger/GingerCoreNET/DLLS/RQM_RepositoryStd.dll
is excluded by!**/*.dll
,!**/*.dll
Files selected for processing (12)
- Ginger/.editorconfig (1 hunks)
- Ginger/Ginger/Actions/ActionEditPages/WebServices/ActWebAPIEditPage.xaml (1 hunks)
- Ginger/Ginger/Actions/ActionEditPages/WebServices/ActWebAPIEditPage.xaml.cs (5 hunks)
- Ginger/Ginger/Actions/UserControls/UCValueExpression.xaml.cs (1 hunks)
- Ginger/Ginger/AutomatePageLib/AddActionMenu/ApplicationModels/POMNavPage.xaml.cs (2 hunks)
- Ginger/Ginger/SolutionWindows/TreeViewItems/ApplicationModelsTreeItems/ApplicationPOMsTreeItem.cs (2 hunks)
- Ginger/GingerCoreNET/Application Models/Delta/PomDelta/PomDeltaUtils.cs (2 hunks)
- Ginger/GingerCoreNET/Application Models/Execution/POM/POMExecutionUtils.cs (1 hunks)
- Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/BrowserElementLocator.cs (3 hunks)
- Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/POM/POMElementLocator.cs (5 hunks)
- Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Playwright/PlaywrightDriver.cs (3 hunks)
- Ginger/GingerCoreNET/Drivers/WebServicesDriver/HttpWebClientUtils.cs (14 hunks)
Files skipped from review due to trivial changes (2)
- Ginger/.editorconfig
- Ginger/Ginger/Actions/UserControls/UCValueExpression.xaml.cs
Additional context used
Learnings (1)
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Playwright/PlaywrightDriver.cs (3)
Learnt from: IamRanjeetSingh PR: Ginger-Automation/Ginger#3783 File: Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Playwright/PlaywrightDriver.cs:129-129 Timestamp: 2024-06-24T08:39:59.351Z Learning: User IamRanjeetSingh has indicated that the `RunAction` method in the `PlaywrightDriver` class should remain synchronous due to current constraints in the codebase.
Learnt from: GokulBothe99 PR: Ginger-Automation/Ginger#3835 File: Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Playwright/PlaywrightDriver.cs:1022-1029 Timestamp: 2024-07-18T09:05:15.264Z Learning: The user prefers readability over concise code in the context of deactivating locators in the `LearnElementInfoDetails` method of the `PlaywrightDriver` class.
Learnt from: IamRanjeetSingh PR: Ginger-Automation/Ginger#3862 File: Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Playwright/PlaywrightNonPersistentBrowser.cs:26-38 Timestamp: 2024-08-14T11:51:45.785Z Learning: The use of `Task.Run` in the `PlaywrightNonPersistentBrowser` constructor is planned to be removed in future changes.
Additional comments not posted (30)
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/BrowserElementLocator.cs (4)
26-26
: LGTM!The addition of the
POMExecutionUtils
property is appropriate and ensures that theContext
class has the necessary utility for POM execution.The code changes are approved.
27-27
: LGTM!The addition of the
Agent
property is appropriate and provides flexibility for different execution agents.The code changes are approved.
91-91
: LGTM!The inclusion of
POMExecutionUtils
in the method's context initialization is appropriate and ensures that POM execution utilities are available for locating elements.The code changes are approved.
92-92
: LGTM!The inclusion of
Agent
in the method's context initialization is appropriate and ensures that the method can leverage different execution agents for locating elements.The code changes are approved.
Ginger/Ginger/SolutionWindows/TreeViewItems/ApplicationModelsTreeItems/ApplicationPOMsTreeItem.cs (4)
42-42
: LGTM!The addition of the
_applicationPlatform
field is appropriate and provides flexibility for managing application-specific configurations.The code changes are approved.
49-52
: LGTM!The new constructor with the
applicationPlatform
parameter is appropriate and enhances the class's functionality by enabling instances to be associated with a specific application platform.The code changes are approved.
158-161
: LGTM!The modification to check if
_applicationPlatform
is not null in theAddEmptyPOM
method is appropriate and improves the specificity and relevance of the target application assignment.The code changes are approved.
162-162
: LGTM!The modification to fall back to the previous logic if
_applicationPlatform
is null in theAddEmptyPOM
method is appropriate and ensures backward compatibility.The code changes are approved.
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/POM/POMElementLocator.cs (8)
98-98
: LGTM!The addition of the
POMExecutionUtils
property is appropriate and ensures that thePOMElementLocator
class has the necessary utility for POM execution.The code changes are approved.
100-100
: LGTM!The addition of the
Agent
property is appropriate and provides flexibility for different execution agents.The code changes are approved.
106-106
: LGTM!The inclusion of
POMExecutionUtils
in the constructor is appropriate and ensures that the class has access to the necessary utility for POM execution.The code changes are approved.
107-107
: LGTM!The inclusion of
Agent
in the constructor is appropriate and ensures that the class can leverage different execution agents for locating elements.The code changes are approved.
154-157
: LGTM!The conditional call to
ReprioritizeLocators
in theLocateAsync
method is appropriate and ensures that locator prioritization occurs only when necessary, potentially improving performance and accuracy in element location.The code changes are approved.
222-225
: LGTM!The check for
_agent
in theUpdatePOM
method is appropriate and ensures that the method enforces the necessity of the agent for the auto-update functionality, thereby improving error handling.The code changes are approved.
227-227
: LGTM!The inclusion of
POMExecutionUtils
in theUpdatePOM
method is appropriate and ensures that the method can utilize the utility for auto-updating the POM.The code changes are approved.
230-232
: LGTM!The new method
ReprioritizeLocators
is appropriate and enhances the control flow by ensuring that locator prioritization occurs only when necessary.The code changes are approved.
Ginger/Ginger/AutomatePageLib/AddActionMenu/ApplicationModels/POMNavPage.xaml.cs (2)
34-38
: LGTM!The constructor is correctly initializing the page and configuring the POM page.
The code changes are approved.
115-116
: LGTM!The function is correctly configuring the POM page with the application platform.
The code changes are approved.
Ginger/GingerCoreNET/Application Models/Execution/POM/POMExecutionUtils.cs (1)
54-58
: LGTM!The constructor is correctly initializing the class with executedFrom and elementLocateValue.
The code changes are approved.
Ginger/Ginger/Actions/ActionEditPages/WebServices/ActWebAPIEditPage.xaml (1)
185-185
: LGTM!The element is correctly adding an event handler for the Checked event.
The code changes are approved.
Ginger/Ginger/Actions/ActionEditPages/WebServices/ActWebAPIEditPage.xaml.cs (3)
66-68
: LGTM!The event handler is correctly implemented.
The code changes are approved.
397-401
: LGTM!The function is correctly implemented.
The code changes are approved.
403-427
: LGTM!The function is correctly implemented and ensures that file overwrites are prevented.
The code changes are approved.
Ginger/GingerCoreNET/Drivers/WebServicesDriver/HttpWebClientUtils.cs (4)
84-91
: LGTM!The changes improve modularity and are correctly implemented.
The code changes are approved.
149-171
: LGTM!The changes improve modularity and are correctly implemented.
The code changes are approved.
Line range hint
305-337
: LGTM!The changes improve modularity and are correctly implemented.
The code changes are approved.
Line range hint
824-850
: LGTM!The changes improve modularity and are correctly implemented.
The code changes are approved.
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Playwright/PlaywrightDriver.cs (3)
50-50
: LGTM!The new import statement for
Amdocs.Ginger.CoreNET.Application_Models.Execution.POM
is appropriate and necessary for the added functionality.
202-203
: LGTM! But verify the usage ofPOMExecutionUtils
.The inclusion of
POMExecutionUtils
enhances the functionality for handling actions related to UI elements and accessibility testing. Ensure that the usage is consistent and correct throughout the codebase.Run the following script to verify the usage of
POMExecutionUtils
:Verification successful
Consistent Usage of
POMExecutionUtils
VerifiedThe
POMExecutionUtils
is consistently used across various parts of the codebase, including unit tests and multiple driver implementations. This indicates that its integration is both widespread and correct.
- Files with Usage:
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Playwright/PlaywrightDriver.cs
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs
Ginger/GingerCoreNETUnitTest/Drivers/CoreDrivers/Web/Selenium/SeleniumUnitTest.cs
- And others...
The presence in unit tests further supports the correctness of its implementation.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `POMExecutionUtils` in the codebase. # Test: Search for the usage of `POMExecutionUtils`. Expect: Consistent and correct usage. rg --type python -A 5 $'POMExecutionUtils'Length of output: 72
Script:
#!/bin/bash # Description: Verify the usage of `POMExecutionUtils` in the codebase. # Test: Search for the usage of `POMExecutionUtils`. Expect: Consistent and correct usage. rg 'POMExecutionUtils' -A 5Length of output: 23633
233-233
: LGTM! But verify the usage ofPOMExecutionUtils
.The inclusion of
POMExecutionUtils
enhances the functionality for handling actions related to accessibility testing. Ensure that the usage is consistent and correct throughout the codebase.Run the following script to verify the usage of
POMExecutionUtils
:Verification successful
Usage of
POMExecutionUtils
is consistent and correct. The utility is integrated across various parts of the system, including different drivers and platforms, without any apparent inconsistencies or incorrect usages.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `POMExecutionUtils` in the codebase. # Test: Search for the usage of `POMExecutionUtils`. Expect: Consistent and correct usage. rg --type python -A 5 $'POMExecutionUtils'Length of output: 72
Script:
#!/bin/bash # Description: Verify the usage of `POMExecutionUtils` in the C# codebase. # Test: Search for the usage of `POMExecutionUtils`. Expect: Consistent and correct usage. rg --type cs -A 5 $'POMExecutionUtils'Length of output: 23643
Comments failed to post (4)
Ginger/Ginger/Actions/ActionEditPages/WebServices/ActWebAPIEditPage.xaml.cs (1)
377-395: Consider adding logging for better traceability.
The function is correctly implemented and improves the robustness of SSL certificate handling. However, adding logging would help in tracing the execution flow and debugging issues.
Consider adding logging statements at key points in the function, such as before and after copying the certificate file, and when creating directories.
Example:
+using GingerCore.GeneralLib; private void BrowseSSLCertificate(object sender, RoutedEventArgs e) { if (CertificatePath.ValueTextBox.Text != null) { string certFilePath = CertificatePath.ValueTextBox.Text.Replace(@"~\", WorkSpace.Instance.Solution.Folder, StringComparison.InvariantCultureIgnoreCase); if (IsToImportCertificateFile() && !certFilePath.Contains(webServicesCertificatePath, StringComparison.InvariantCultureIgnoreCase)) { + Reporter.ToLog(eLogLevel.INFO, "Importing SSL certificate file."); string targetDirPath = Path.Combine(WorkSpace.Instance.Solution.Folder, webServicesCertificatePath); string destFilePath = GetUniqueFilePath(Path.Combine(targetDirPath, Path.GetFileName(certFilePath))); if (!Directory.Exists(targetDirPath)) { Directory.CreateDirectory(targetDirPath); + Reporter.ToLog(eLogLevel.INFO, $"Created directory: {targetDirPath}"); } File.Copy(certFilePath, destFilePath, true); + Reporter.ToLog(eLogLevel.INFO, $"Copied certificate file to: {destFilePath}"); certFilePath = destFilePath; } CertificatePath.ValueTextBox.Text = certFilePath.Replace(WorkSpace.Instance.Solution.Folder, @"~\", StringComparison.InvariantCultureIgnoreCase); } }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.using GingerCore.GeneralLib; private void BrowseSSLCertificate(object sender, RoutedEventArgs e) { if (CertificatePath.ValueTextBox.Text != null) { string certFilePath = CertificatePath.ValueTextBox.Text.Replace(@"~\", WorkSpace.Instance.Solution.Folder, StringComparison.InvariantCultureIgnoreCase); if (IsToImportCertificateFile() && !certFilePath.Contains(webServicesCertificatePath, StringComparison.InvariantCultureIgnoreCase)) { Reporter.ToLog(eLogLevel.INFO, "Importing SSL certificate file."); string targetDirPath = Path.Combine(WorkSpace.Instance.Solution.Folder, webServicesCertificatePath); string destFilePath = GetUniqueFilePath(Path.Combine(targetDirPath, Path.GetFileName(certFilePath))); if (!Directory.Exists(targetDirPath)) { Directory.CreateDirectory(targetDirPath); Reporter.ToLog(eLogLevel.INFO, $"Created directory: {targetDirPath}"); } File.Copy(certFilePath, destFilePath, true); Reporter.ToLog(eLogLevel.INFO, $"Copied certificate file to: {destFilePath}"); certFilePath = destFilePath; } CertificatePath.ValueTextBox.Text = certFilePath.Replace(WorkSpace.Instance.Solution.Folder, @"~\", StringComparison.InvariantCultureIgnoreCase); } }
Ginger/GingerCoreNET/Application Models/Delta/PomDelta/PomDeltaUtils.cs (1)
83-86: Consider adding error handling for better robustness.
The function is correctly implemented and improves the adaptability of the automation framework to different UI elements based on the platform. However, adding error handling would help in managing potential issues during the retrieval of UI element filters.
Consider adding error handling around the retrieval of UI element filters.
Example:
var elementList = PlatformInfoBase.GetPlatformImpl(ePlatformType.Web).GetUIElementFilterList(); +if (elementList == null) +{ + throw new InvalidOperationException("Failed to retrieve UI element filter list for the Web platform."); +} PomLearnUtils.AutoMapBasicElementTypesList = elementList["Basic"]; PomLearnUtils.AutoMapAdvanceElementTypesList = elementList["Advanced"];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.DeltaViewElements.Clear(); var elementList = PlatformInfoBase.GetPlatformImpl(ePlatformType.Web).GetUIElementFilterList(); if (elementList == null) { throw new InvalidOperationException("Failed to retrieve UI element filter list for the Web platform."); } PomLearnUtils.AutoMapBasicElementTypesList = elementList["Basic"]; PomLearnUtils.AutoMapAdvanceElementTypesList = elementList["Advanced"];
Ginger/GingerCoreNET/Drivers/WebServicesDriver/HttpWebClientUtils.cs (2)
60-81: Correct the method name.
The method name is misspelled as
RequestContstructor
. It should beRequestConstructor
.Apply this diff to correct the method name:
-public bool RequestContstructor(ActWebAPIBase act, string ProxySettings, bool useProxyServerSettings, HttpClientHandler handler) +public bool RequestConstructor(ActWebAPIBase act, string ProxySettings, bool useProxyServerSettings, HttpClientHandler handler)Committable suggestion was skipped due to low confidence.
234-273: Correct the method name.
The method name is misspelled as
SetCertificates
. It should beSetCertificate
.Apply this diff to correct the method name:
-private bool SetCertificates(HttpClientHandler handler) +private bool SetCertificate(HttpClientHandler handler)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.private bool SetCertificate(HttpClientHandler handler) { string CertificateTypeRadioButton = mAct.GetInputParamCalculatedValue(ActWebAPIBase.Fields.CertificateTypeRadioButton); if (CertificateTypeRadioButton == ApplicationAPIUtils.eCretificateType.AllSSL.ToString()) { ServicePointManager.ServerCertificateValidationCallback += (_, _, _, _) => true; handler.ServerCertificateCustomValidationCallback += (_, _, _, _) => { return true; }; } else if (CertificateTypeRadioButton == ApplicationAPIUtils.eCretificateType.Custom.ToString()) { //Use Custom Certificate: handler.ClientCertificateOptions = ClientCertificateOption.Manual; string path = WorkSpace.Instance.Solution.SolutionOperations.ConvertSolutionRelativePath(mAct.GetInputParamCalculatedValue(ActWebAPIBase.Fields.CertificatePath)); if (!string.IsNullOrEmpty(path)) { string certificateKey = mAct.GetInputParamCalculatedValue(ActWebAPIBase.Fields.CertificatePassword); if (!string.IsNullOrEmpty(path)) { if (string.IsNullOrEmpty(certificateKey)) { handler.ClientCertificates.Add(new X509Certificate2(path)); } else { handler.ClientCertificates.Add(new X509Certificate2(path, certificateKey)); } ServicePointManager.ServerCertificateValidationCallback += delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { if (sslPolicyErrors == SslPolicyErrors.None) { return true; } mAct.Error = GetCertificateChainErrorStatusInfo(chain); mAct.ExInfo = "Server side certificate not valid."; return false;
Thank you for your contribution.
Before submitting this PR, please make sure:
Summary by CodeRabbit
New Features
PlaywrightDriver
for better UI interactions.Bug Fixes
Documentation
Chores