diff --git a/Ginger/Ginger/Drivers/DriversConfigsEditPages/AppiumDriverEditPage.xaml b/Ginger/Ginger/Drivers/DriversConfigsEditPages/AppiumDriverEditPage.xaml index 1f7795538..ff3314b03 100644 --- a/Ginger/Ginger/Drivers/DriversConfigsEditPages/AppiumDriverEditPage.xaml +++ b/Ginger/Ginger/Drivers/DriversConfigsEditPages/AppiumDriverEditPage.xaml @@ -99,7 +99,7 @@ diff --git a/Ginger/Ginger/Environments/AppsListPage.xaml.cs b/Ginger/Ginger/Environments/AppsListPage.xaml.cs index b1c116e91..d8478e53a 100644 --- a/Ginger/Ginger/Environments/AppsListPage.xaml.cs +++ b/Ginger/Ginger/Environments/AppsListPage.xaml.cs @@ -129,9 +129,6 @@ private void SetGridView() new GridColView() { Field = nameof(EnvApplication.Url), WidthWeight = 100, Header = "URL" }, ] }; - - grdApps.SetAllColumnsDefaultView(view); - grdApps.InitViewItems(); } private void SetGridData() diff --git a/Ginger/Ginger/Ginger.csproj b/Ginger/Ginger/Ginger.csproj index 544357d9c..0a1901ef5 100644 --- a/Ginger/Ginger/Ginger.csproj +++ b/Ginger/Ginger/Ginger.csproj @@ -749,7 +749,7 @@ - + diff --git a/Ginger/Ginger/Reports/HTMLReportAttachmentConfigurationPage.xaml.cs b/Ginger/Ginger/Reports/HTMLReportAttachmentConfigurationPage.xaml.cs index d07582608..f0627eb89 100644 --- a/Ginger/Ginger/Reports/HTMLReportAttachmentConfigurationPage.xaml.cs +++ b/Ginger/Ginger/Reports/HTMLReportAttachmentConfigurationPage.xaml.cs @@ -145,9 +145,9 @@ private void OkButton_Click(object sender, RoutedEventArgs e) Reporter.ToUser(eUserMsgKey.FolderNameTextBoxIsEmpty); return; } - else if (extraInformationCalculated.Length > 100) + else if (extraInformationCalculated.Length > 255) { - Reporter.ToUser(eUserMsgKey.FolderNamesAreTooLong); + Reporter.ToUser(eUserMsgKey.FolderPathsAreTooLong); return; } } diff --git a/Ginger/GingerCoreCommon/ReporterLib/UserMsgsPool.cs b/Ginger/GingerCoreCommon/ReporterLib/UserMsgsPool.cs index 61c7bc4a9..7cd9f05ae 100644 --- a/Ginger/GingerCoreCommon/ReporterLib/UserMsgsPool.cs +++ b/Ginger/GingerCoreCommon/ReporterLib/UserMsgsPool.cs @@ -106,7 +106,7 @@ public enum eUserMsgKey ActivitiesGroupAlreadyMappedToTC, ExportItemToALMFailed, AskIfToSaveBFAfterExport, ALMIncorrectExternalID, BusinessFlowAlreadyMappedToTC, AskIfSureWantToClose, AskIfSureWantToCloseWithoutNote, AskIfSureWantToRestart, AskIfSureWantToRestartWithoutNote, AskIfSureWantToRestartInAdminMode, WindowClosed, TargetWindowNotSelected, ChangingEnvironmentParameterValue, IFSaveChangesOfBF, AskIfToLoadExternalFields, WhetherToOpenSolution, - AutomationTabExecResultsNotExists, FolderNamesAreTooLong, FolderSizeTooSmall, DefaultTemplateCantBeDeleted, FileNotExist, ExecutionsResultsProdIsNotOn, ExecutionsResultsNotExists, ExecutionsResultsToDelete, AllExecutionsResultsToDelete, FilterNotBeenSet, RetreivingAllElements, ClickElementAgain, CloseFilterPage, + AutomationTabExecResultsNotExists, FolderNamesAreTooLong, FolderPathsAreTooLong, FolderSizeTooSmall, DefaultTemplateCantBeDeleted, FileNotExist, ExecutionsResultsProdIsNotOn, ExecutionsResultsNotExists, ExecutionsResultsToDelete, AllExecutionsResultsToDelete, FilterNotBeenSet, RetreivingAllElements, ClickElementAgain, CloseFilterPage, BusinessFlowNeedTargetApplication, HTMLReportAttachment, ImageSize, ImageSizeTill5Mb, GherkinAskToSaveFeatureFile, GherkinScenariosGenerated, GherkinNotifyFeatureFileExists, GherkinNotifyFeatureFileSelectedFromTheSolution, GherkinNotifyBFIsNotExistForThisFeatureFile, GherkinFileNotFound, GherkinColumnNotExist, GherkinActivityNotFound, GherkinBusinessFlowNotCreated, GherkinFeatureFileImportedSuccessfully, GherkinFeatureFileImportOnlyFeatureFileAllowedErrorMessage, AskIfSureWantToDeLink, AnalyzerFoundIssues, AnalyzerFoundNoIssues, AnalyzerSaveRunSet, @@ -616,6 +616,7 @@ public static void LoadUserMsgsPool() { eUserMsgKey.ReportTemplateNotFound, new UserMsg(eUserMsgType.ERROR, "Report Template", "Report Template '{0}' not found", eUserMsgOption.OK, eUserMsgSelection.None) }, { eUserMsgKey.AutomationTabExecResultsNotExists, new UserMsg(eUserMsgType.WARN, "Execution Results are not existing", "Results from last execution are not existing (yet). Nothing to report, please wait for execution finish and click on report creation.", eUserMsgOption.OK, eUserMsgSelection.None) }, { eUserMsgKey.FolderNamesAreTooLong, new UserMsg(eUserMsgType.WARN, "Folders Names Are Too Long", "Provided folders names are too long. Please change them to be less than 100 characters", eUserMsgOption.OK, eUserMsgSelection.None) }, + { eUserMsgKey.FolderPathsAreTooLong, new UserMsg(eUserMsgType.WARN, "Folder Paths Are Too Long", "Provided folder paths are too long. Please change them to be less than 255 characters", eUserMsgOption.OK, eUserMsgSelection.None) }, { eUserMsgKey.FolderSizeTooSmall, new UserMsg(eUserMsgType.WARN, "Folders Size is Too Small", "Provided folder size is Too Small. Please change it to be bigger than 50 Mb", eUserMsgOption.OK, eUserMsgSelection.None) }, { eUserMsgKey.DefaultTemplateCantBeDeleted, new UserMsg(eUserMsgType.WARN, "Default Template Can't Be Deleted", "Default Template Can't Be Deleted. Please change it to be a non-default", eUserMsgOption.OK, eUserMsgSelection.None) }, { eUserMsgKey.ExecutionsResultsProdIsNotOn, new UserMsg(eUserMsgType.WARN, "Executions Results Producing Should Be Switched On", "In order to perform this action, executions results producing should be switched On", eUserMsgOption.OK, eUserMsgSelection.None) }, diff --git a/Ginger/GingerCoreNET/Database/DatabaseOperations.cs b/Ginger/GingerCoreNET/Database/DatabaseOperations.cs index 92cca1570..8839172bb 100644 --- a/Ginger/GingerCoreNET/Database/DatabaseOperations.cs +++ b/Ginger/GingerCoreNET/Database/DatabaseOperations.cs @@ -489,7 +489,34 @@ public Boolean Connect(bool displayErrorPopup = false) Password = EncryptionHandler.DecryptwithKey(PassCalculated) }; if (port1.HasValue) my.Port = port1.Value; - Database.ConnectionString = my.ConnectionString; + if (!string.IsNullOrEmpty(ConnectionStringCalculated)) + { + foreach (string segment in ConnectionStringCalculated.Split(';', StringSplitOptions.RemoveEmptyEntries)) + { + int eq = segment.IndexOf('='); + if (eq <= 0) + { + continue; + } + + string key = segment.Substring(0, eq).Trim(); + if (key.Equals("SslMode", StringComparison.OrdinalIgnoreCase)) + { + string value = segment.Substring(eq + 1).Trim(); + if (Enum.TryParse(value, ignoreCase: true, out MySqlSslMode sslMode)) + { + my.SslMode = sslMode; + } + + break; + } + } + } + + if (string.IsNullOrEmpty(ConnectionStringCalculated)) + { + Database.ConnectionString = my.ConnectionString; + } oConn = new MySqlConnection { diff --git a/Ginger/GingerCoreNET/External/WireMock/WireMockAPI.cs b/Ginger/GingerCoreNET/External/WireMock/WireMockAPI.cs index 156fb646f..1b1dca9c2 100644 --- a/Ginger/GingerCoreNET/External/WireMock/WireMockAPI.cs +++ b/Ginger/GingerCoreNET/External/WireMock/WireMockAPI.cs @@ -20,8 +20,10 @@ limitations under the License. using Amdocs.Ginger.Common; using Amdocs.Ginger.Common.External.Configurations; using System; +using System.Net; using System.Net.Http; using System.Text; +using System.Text.Json; using System.Threading.Tasks; namespace Amdocs.Ginger.CoreNET.External.WireMock @@ -99,7 +101,8 @@ public async Task StartRecordingAsync(string targetUrl) using (HttpClient client = new HttpClient()) { - var content = new StringContent($"{{\"targetBaseUrl\": \"{targetUrl}\"}}", Encoding.UTF8, "application/json"); + string json = JsonSerializer.Serialize(new { targetBaseUrl = targetUrl }); + var content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.PostAsync($"{NormalizeUrl(GingerCore.ValueExpression.PasswordCalculation(_baseUrl))}{StartRecordingEndpoint}", content); response.EnsureSuccessStatusCode(); return await response.Content.ReadAsStringAsync(); @@ -153,7 +156,19 @@ public async Task CreateStubAsync(string stubMapping, string contentType { contentType = "application/json"; } - var content = new StringContent(stubMapping, Encoding.UTF8, contentType); + + string body; + if (string.IsNullOrEmpty(stubMapping)) + { + body = stubMapping; + } + else + { + using JsonDocument doc = JsonDocument.Parse(stubMapping); + body = doc.RootElement.GetRawText(); + } + + var content = new StringContent(WebUtility.HtmlEncode(body), Encoding.UTF8, contentType); HttpResponseMessage response = await client.PostAsync($"{NormalizeUrl(GingerCore.ValueExpression.PasswordCalculation(_baseUrl))}{MappingEndpoint}", content); response.EnsureSuccessStatusCode(); return await response.Content.ReadAsStringAsync(); @@ -204,7 +219,18 @@ public async Task UpdateStubAsync(string stubId, string stubMapping) using (HttpClient client = new HttpClient()) { - var content = new StringContent(stubMapping, Encoding.UTF8, "application/json"); + string body; + if (string.IsNullOrEmpty(stubMapping)) + { + body = stubMapping; + } + else + { + using JsonDocument doc = JsonDocument.Parse(stubMapping); + body = doc.RootElement.GetRawText(); + } + + var content = new StringContent(body, Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.PutAsync($"{NormalizeUrl(GingerCore.ValueExpression.PasswordCalculation(_baseUrl))}{MappingEndpoint}/{stubId}", content); response.EnsureSuccessStatusCode(); return await response.Content.ReadAsStringAsync(); diff --git a/Ginger/GingerCoreNET/GenAIServices/GenAIServiceHelper.cs b/Ginger/GingerCoreNET/GenAIServices/GenAIServiceHelper.cs index b18bacbfa..fc6e355ce 100644 --- a/Ginger/GingerCoreNET/GenAIServices/GenAIServiceHelper.cs +++ b/Ginger/GingerCoreNET/GenAIServices/GenAIServiceHelper.cs @@ -22,6 +22,7 @@ limitations under the License. using System; using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; +using System.Net; using System.Net.Http; using System.Threading.Tasks; @@ -104,8 +105,7 @@ private async Task GetToken() catch (Exception ex) { var error = "Failed to get access token"; - Reporter.ToLog(eLogLevel.ERROR, $"{error}, Error :{ex.Message}"); - Reporter.ToLog(eLogLevel.ERROR, $"{error}, Error :{ex.Message}, InnerException:{ex.InnerException},StackTrace:{ex.StackTrace}"); + Reporter.ToLog(eLogLevel.ERROR, error, ex); return false; } } @@ -245,11 +245,11 @@ private MultipartFormDataContent PrepareRequestDetailsForChat(string Question) var content = new MultipartFormDataContent { { new StringContent(Question), "question" }, - { new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.Account)), "account" }, - { new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.DomainType)), "domainType" }, - { new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.TemperatureLevel)), "temperatureVal" }, - { new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.MaxTokenValue)), "maxTokensVal" }, - { new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.DataPath)), "dataPath" } + { new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.Account) ?? string.Empty)), "account" }, + { new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.DomainType) ?? string.Empty)), "domainType" }, + { new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.TemperatureLevel) ?? string.Empty)), "temperatureVal" }, + { new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.MaxTokenValue) ?? string.Empty)), "maxTokensVal" }, + { new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.DataPath) ?? string.Empty)), "dataPath" } }; return content; } diff --git a/Ginger/GingerCoreNET/GingerCoreNET.csproj b/Ginger/GingerCoreNET/GingerCoreNET.csproj index d327995ea..089ce3316 100644 --- a/Ginger/GingerCoreNET/GingerCoreNET.csproj +++ b/Ginger/GingerCoreNET/GingerCoreNET.csproj @@ -293,7 +293,7 @@ - + diff --git a/Ginger/GingerTest/GingerTest.csproj b/Ginger/GingerTest/GingerTest.csproj index 27c0fcdca..7789de54c 100644 --- a/Ginger/GingerTest/GingerTest.csproj +++ b/Ginger/GingerTest/GingerTest.csproj @@ -21,7 +21,7 @@ - +