Skip to content

Commit 7af0882

Browse files
author
NikolayAvramov
committed
Fix errors when LLM settings not exist in config
1 parent fecb2d6 commit 7af0882

File tree

14 files changed

+19
-44
lines changed

14 files changed

+19
-44
lines changed

Bellatrix.LLM/SemanticKernelService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ private static void EnsureInitialized()
5454
return;
5555

5656
var llmSettings = ConfigurationService.GetSection<LargeLanguageModelsSettings>();
57-
57+
if (llmSettings == null)
58+
return;
59+
5860
var genSettings = llmSettings.ModelSettings[0];
5961
var embedSettings = llmSettings.ModelSettings[1];
6062

Bellatrix.LLM/plugins/SmartFailureAnalysisPlugin .cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ public SmartFailureAnalysisPlugin()
3434
{
3535
_screenshotOutputProvider = ServicesCollection.Current.Resolve<IScreenshotOutputProvider>();
3636
_viewSnapshotProvider = ServicesCollection.Main.Resolve<IViewSnapshotProvider>();
37-
_isEnabled = ConfigurationService.GetSection<LargeLanguageModelsSettings>().EnableSmartFailureAnalysis;
37+
var largeLanguageModelsSettings = ConfigurationService.GetSection<LargeLanguageModelsSettings>();
38+
_isEnabled = largeLanguageModelsSettings?.EnableSmartFailureAnalysis ?? false;
3839
}
3940

4041
public static void Add()

shared/SharedAssemblyInfo.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<RunAnalyzers>true</RunAnalyzers>
4646
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
4747
<WarningsAsErrors />
48-
<NoWarn>NU1701;NU1702;NU1705;NU1608;</NoWarn>
48+
<NoWarn>NU1701;NU1702;NU1705;NU1608;NU1903;NU1902;NU1904;</NoWarn>
4949
</PropertyGroup>
5050
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
5151
<Optimize>true</Optimize>

src/Bellatrix.Core/utilities/WindowsProcessExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static IEnumerable<Process> GetChildProcesses(this Process process)
3232

3333
return children;
3434
}
35-
35+
3636
public static Process GetParentProcess(this Process process)
3737
{
3838
int parentPid = 0;

src/Bellatrix.Desktop/Bellatrix.Desktop.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
<PackageReference Include="NUnit" Version="4.3.2" />
1212
<PackageReference Include="System.Drawing.Primitives" Version="4.3.0" />
1313
</ItemGroup>
14-
1514
<ItemGroup>
1615
<ProjectReference Include="..\..\Bellatrix.LLM\Bellatrix.LLM.csproj" />
1716
<ProjectReference Include="..\Bellatrix.Allure\Bellatrix.Results.Allure.csproj" />

src/Bellatrix.Desktop/DesktopPluginsConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public static void ConfigureLLM()
150150
{
151151
if (ConfigurationService.GetSection<LargeLanguageModelsSettings>() == null)
152152
{
153-
throw new ArgumentException("Could not load LargeLanguageModelsSettings section from testFrameworkSettings.json");
153+
return;
154154
}
155155

156156
try

src/Bellatrix.Desktop/components/Core/Component.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ protected AppiumElement GetAndWaitWebDriverElement()
250250
_wrappedElement = GetWebDriverElement();
251251

252252
// ✅ Save if healing is enabled
253-
if (_llmSettings.EnableSelfHealing)
253+
if (_llmSettings != null && _llmSettings.EnableSelfHealing)
254254
{
255255
var snapshot = _viewSnapshotProvider.GetCurrentViewSnapshot();
256256
LocatorSelfHealingService.SaveWorkingLocator(By.ToString(), snapshot, WrappedDriver.CurrentWindowHandle);
@@ -261,7 +261,7 @@ protected AppiumElement GetAndWaitWebDriverElement()
261261
}
262262
catch (Exception ex)
263263
{
264-
if (!_llmSettings.EnableSelfHealing)
264+
if (_llmSettings == null || !_llmSettings.EnableSelfHealing)
265265
{
266266
throw new TimeoutException($"❌ Element not found: {By?.Value}", ex);
267267
}

src/Bellatrix.Mobile/AndroidPluginsConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public static void ConfigureLLM()
159159
{
160160
if (ConfigurationService.GetSection<LargeLanguageModelsSettings>() == null)
161161
{
162-
throw new ArgumentException("Could not load LargeLanguageModelsSettings section from testFrameworkSettings.json");
162+
return;
163163
}
164164

165165
try

src/Bellatrix.Mobile/IOSPluginsConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public static void ConfigureLLM()
155155
{
156156
if (ConfigurationService.GetSection<LargeLanguageModelsSettings>() == null)
157157
{
158-
throw new ArgumentException("Could not load LargeLanguageModelsSettings section from testFrameworkSettings.json");
158+
return;
159159
}
160160

161161
try

src/Bellatrix.Playwright/WebPluginsConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public static void ConfigureLLM()
237237
{
238238
if (ConfigurationService.GetSection<LargeLanguageModelsSettings>() == null)
239239
{
240-
throw new ArgumentException("Could not load LargeLanguageModelsSettings section from testFrameworkSettings.json");
240+
return;
241241
}
242242

243243
try

0 commit comments

Comments
 (0)