Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix/Empty POM adding with Activity target application #3877

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

GokulBothe99
Copy link
Contributor

@GokulBothe99 GokulBothe99 commented Aug 26, 2024

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 SSL certificate handling with improved directory management and unique file path generation.
    • Added functionality to dynamically manage UI element filters based on platform type.
    • Improved handling of application-specific configurations in the Page Object Model (POM) management.
    • Expanded capabilities in the PlaywrightDriver for better UI interactions.
  • Bug Fixes

    • Streamlined HTTP client initialization for better configuration management and error handling.
  • Documentation

    • Updated internal coding style configuration to align with standard practices.
  • Chores

    • Cosmetic changes for improved code readability.

Copy link
Contributor

coderabbitai bot commented Aug 26, 2024

Walkthrough

The 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

Files Change Summary
Ginger/.editorconfig Removed the line setting csharp_indent_braces to false, indicating a shift in C# brace indentation style.
Ginger/Ginger/Actions/ActionEditPages/WebServices/ActWebAPIEditPage.xaml, Added an event handler for the Checked event of the DoNotCertificateImportFile checkbox, enhancing interactivity.
Ginger/Ginger/Actions/ActionEditPages/WebServices/ActWebAPIEditPage.xaml.cs Introduced a constant for webServicesCertificatePath, modified BrowseSSLCertificate method to check and copy certificate files, and added GetUniqueFilePath for unique file naming. Updated event handler for ValueTextBox.
Ginger/Ginger/Actions/UserControls/UCValueExpression.xaml.cs Added a blank line in BrowseButton_Click for improved readability.
Ginger/Ginger/AutomatePageLib/AddActionMenu/ApplicationModels/POMNavPage.xaml.cs Introduced activityAppPlatform variable and modified mPOMsRoot instantiation to include it, enhancing platform-aware behavior.
Ginger/Ginger/SolutionWindows/TreeViewItems/ApplicationModelsTreeItems/ApplicationPOMsTreeItem.cs Added an optional parameter for _applicationPlatform in the constructor, refining target application assignment logic in AddEmptyPOM.
Ginger/GingerCoreNET/Application Models/Delta/PomDelta/PomDeltaUtils.cs Enhanced LearnDelta method to obtain UI element filters for the Web platform, improving adaptability during execution.
Ginger/GingerCoreNET/Application Models/Execution/POM/POMExecutionUtils.cs Added an overloaded constructor for POMExecutionUtils to initialize properties based on execution context.
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/BrowserElementLocator.cs Added POMExecutionUtils and Agent as required properties, updated FindAllMatchingElementsFromPOMA to utilize these properties.
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/POM/POMElementLocator.cs Introduced required properties in Args, modified constructor logic, and added checks in UpdatePOM method for improved error handling.
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Playwright/PlaywrightDriver.cs Added a using directive for POM and enhanced RunAction method with new POMExecutionUtils parameters for better UI interaction management.
Ginger/GingerCoreNET/Drivers/WebServicesDriver/HttpWebClientUtils.cs Refactored HTTP client initialization, streamlined methods to accept HttpClientHandler, and simplified request logic to enhance modularity and clarity.

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
Loading

🐇
In a world of code, changes abound,
With new paths and handlers, solutions are found.
Certificates now dance in their place,
As platforms unite in a harmonious space.
So hop with joy, let the updates ring,
For in this code, we make magic spring!
🌼


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 Configuration 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.

@GokulBothe99 GokulBothe99 changed the base branch from master to Releases/Beta August 26, 2024 12:30
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 be InitializeClient.

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 be RequestConstructorREST.

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

Commits

Files that changed from the base of the PR and between 2ae5bb7 and 73d05f0.

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 the Context 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 the AddEmptyPOM 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 the AddEmptyPOM 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 the POMElementLocator 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 the LocateAsync 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 the UpdatePOM 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 the UpdatePOM 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 of POMExecutionUtils.

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 Verified

The 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 5

Length of output: 23633


233-233: LGTM! But verify the usage of POMExecutionUtils.

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 be RequestConstructor.

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 be SetCertificate.

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;

@Maheshkale447 Maheshkale447 merged commit e09c3f6 into Releases/Beta Aug 26, 2024
8 of 9 checks passed
@Maheshkale447 Maheshkale447 deleted the BugFix/POM_TargetApplication_Issue branch August 26, 2024 14:07
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