Skip to content

Commit eeb48ed

Browse files
committed
Cleaned dependencies from other projects
1 parent 2c85902 commit eeb48ed

File tree

156 files changed

+2279
-833
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+2279
-833
lines changed

BellatrixTestFramework.sln

Lines changed: 350 additions & 0 deletions
Large diffs are not rendered by default.

src/Bellatrix.BugReporting/azuredevops/AzureQueryExecutor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
using Microsoft.TeamFoundation.WorkItemTracking.WebApi;
2222
using Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models;
2323
using Microsoft.VisualStudio.Services.Common;
24-
using Microsoft.VisualStudio.Services.WebApi;
2524
using Microsoft.VisualStudio.Services.WebApi.Patch;
2625
using Microsoft.VisualStudio.Services.WebApi.Patch.Json;
2726

src/Bellatrix.Mobile/AndroidApp.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// </copyright>
1212
// <author>Anton Angelov</author>
1313
// <site>https://bellatrix.solutions/</site>
14-
using Bellatrix.LLM;
1514
using Bellatrix.Mobile.EventHandlers.Android;
1615
using Bellatrix.Mobile.Services;
1716
using Bellatrix.Mobile.Services.Android;
@@ -22,11 +21,6 @@ namespace Bellatrix.Mobile;
2221

2322
public class AndroidApp : App<AndroidDriver, AppiumElement>
2423
{
25-
public AndroidApp()
26-
{
27-
ServicesCollection.Main.RegisterInstance<IViewSnapshotProvider>(AppService);
28-
}
29-
3024
public AndroidAppService AppService => ServicesCollection.Current.Resolve<AndroidAppService>();
3125
public AndroidFileSystemService Files => ServicesCollection.Current.Resolve<AndroidFileSystemService>();
3226
public AndroidDeviceService Device => ServicesCollection.Current.Resolve<AndroidDeviceService>();

src/Bellatrix.Mobile/AndroidPluginsConfiguration.cs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,13 @@
1414
using System;
1515
using System.Collections.Generic;
1616
using Bellatrix.Layout;
17-
using Bellatrix.LLM.Plugins;
18-
using Bellatrix.LLM.Settings;
19-
using Bellatrix.LLM.Skills;
20-
using Bellatrix.LLM;
2117
using Bellatrix.Mobile.BddLogging.Android;
2218
using Bellatrix.Mobile.EventHandlers.Android;
2319
using Bellatrix.Mobile.Plugins;
2420
using Bellatrix.Mobile.Screenshots;
2521
using Bellatrix.Plugins;
2622
using Bellatrix.Plugins.Screenshots;
2723
using Bellatrix.Plugins.Screenshots.Contracts;
28-
using Microsoft.SemanticKernel;
29-
using Bellatrix.Mobile.LLM.Skills;
30-
using Bellatrix.Mobile.LLM.Skills.Android;
3124

3225
namespace Bellatrix.Mobile.Android;
3326

@@ -84,34 +77,4 @@ public static void AddLogExecutionLifecycle()
8477
{
8578
ServicesCollection.Current.RegisterType<Plugin, LogWorkflowPlugin>(Guid.NewGuid().ToString());
8679
}
87-
88-
public static void ConfigureLLM()
89-
{
90-
if (ConfigurationService.GetSection<LargeLanguageModelsSettings>() == null)
91-
{
92-
Logger.LogError("Could not load LargeLanguageModelsSettings section from testFrameworkSettings.json");
93-
return;
94-
}
95-
96-
try
97-
{
98-
var settings = ConfigurationService.GetSection<LargeLanguageModelsSettings>();
99-
100-
SemanticKernelService.Kernel.ImportPluginFromObject(new AndroidLocatorSkill(), nameof(AndroidLocatorSkill));
101-
SemanticKernelService.Kernel.ImportPluginFromObject(new AssertionSkill(), nameof(AssertionSkill));
102-
SemanticKernelService.Kernel.ImportPluginFromObject(new AndroidPageObjectSummarizerSkill(), nameof(AndroidPageObjectSummarizerSkill));
103-
SemanticKernelService.Kernel.ImportPluginFromObject(new LocatorMapperSkill(), nameof(LocatorMapperSkill));
104-
SemanticKernelService.Kernel.ImportPluginFromObject(new FailureAnalyzerSkill(), nameof(FailureAnalyzerSkill));
105-
106-
// index all page objects:
107-
if (settings.ShouldIndexPageObjects)
108-
{
109-
PageObjectsIndexer.IndexAllPageObjects(settings.PageObjectFilesPath, settings.MemoryIndex, settings.ResetIndexEverytime);
110-
}
111-
}
112-
catch (Exception ex)
113-
{
114-
Logger.LogError(ex.ToString());
115-
}
116-
}
11780
}

src/Bellatrix.Mobile/App.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
// <author>Anton Angelov</author>
1313
// <site>https://bellatrix.solutions/</site>
1414
using Bellatrix.Assertions;
15-
using Bellatrix.AWS;
16-
using Bellatrix.CognitiveServices;
1715
using Bellatrix.Mobile.Services;
1816
using Bellatrix.Plugins;
1917
using OpenQA.Selenium.Appium.Service;
@@ -39,9 +37,6 @@ public App()
3937
public ComponentWaitService<TDriver, TDriverElement> Wait => ServicesCollection.Current.Resolve<ComponentWaitService<TDriver, TDriverElement>>();
4038
public ComponentCreateService Components => ServicesCollection.Current.Resolve<ComponentCreateService>();
4139
public WebServicesFacade Web => ServicesCollection.Current.Resolve<WebServicesFacade>();
42-
public FormRecognizer FormRecognizer => ServicesCollection.Current.Resolve<FormRecognizer>();
43-
public ComputerVision ComputerVision => ServicesCollection.Current.Resolve<ComputerVision>();
44-
public AWSServicesFactory AWS => ServicesCollection.Current.Resolve<AWSServicesFactory>();
4540
public IAssert Assert => ServicesCollection.Current.Resolve<IAssert>();
4641

4742
public static void StartAppiumLocalService()

src/Bellatrix.Mobile/Bellatrix.Mobile.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
</ItemGroup>
1717

1818
<ItemGroup>
19-
<ProjectReference Include="..\Bellatrix.LLM\Bellatrix.LLM.csproj" />
20-
<ProjectReference Include="..\Bellatrix.Allure\Bellatrix.Results.Allure.csproj" />
21-
<ProjectReference Include="..\Bellatrix.AWS\Bellatrix.AWS.csproj" />
22-
<ProjectReference Include="..\Bellatrix.CognitiveServices\Bellatrix.CognitiveServices.csproj" />
2319
<ProjectReference Include="..\Bellatrix.Core\Bellatrix.Core.csproj" />
2420
<ProjectReference Include="..\Bellatrix.Layout\Bellatrix.Layout.csproj" />
2521
<ProjectReference Include="..\Bellatrix.Plugins.Screenshots\Bellatrix.Plugins.Screenshots.csproj" />

src/Bellatrix.Mobile/IOSApp.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
// </copyright>
1212
// <author>Anton Angelov</author>
1313
// <site>https://bellatrix.solutions/</site>
14-
using Bellatrix.LLM;
15-
using Bellatrix.Mobile.Android;
1614
using Bellatrix.Mobile.EventHandlers.IOS;
1715
using Bellatrix.Mobile.Services;
1816
using Bellatrix.Mobile.Services.IOS;
@@ -23,11 +21,6 @@ namespace Bellatrix.Mobile;
2321

2422
public class IOSApp : App<IOSDriver, AppiumElement>
2523
{
26-
public IOSApp()
27-
{
28-
ServicesCollection.Main.RegisterInstance<IViewSnapshotProvider>(AppService);
29-
}
30-
3124
public IOSAppService AppService => ServicesCollection.Current.Resolve<IOSAppService>();
3225

3326
[Obsolete("DeviceService is deprecated use Device property instead.")]

src/Bellatrix.Mobile/IOSPluginsConfiguration.cs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,13 @@
1414
using System;
1515
using System.Collections.Generic;
1616
using Bellatrix.Layout;
17-
using Bellatrix.LLM.Plugins;
18-
using Bellatrix.LLM.Settings;
19-
using Bellatrix.LLM.Skills;
20-
using Bellatrix.LLM;
2117
using Bellatrix.Mobile.BddLogging.IOS;
2218
using Bellatrix.Mobile.EventHandlers.IOS;
2319
using Bellatrix.Mobile.Plugins;
2420
using Bellatrix.Mobile.Screenshots;
2521
using Bellatrix.Plugins;
2622
using Bellatrix.Plugins.Screenshots;
2723
using Bellatrix.Plugins.Screenshots.Contracts;
28-
using Bellatrix.Mobile.LLM.Skills.iOS;
29-
using Microsoft.SemanticKernel;
3024

3125
namespace Bellatrix.Mobile.IOS;
3226

@@ -82,34 +76,4 @@ public static void AddLogExecutionLifecycle()
8276
{
8377
ServicesCollection.Current.RegisterType<Plugin, LogWorkflowPlugin>(Guid.NewGuid().ToString());
8478
}
85-
86-
public static void ConfigureLLM()
87-
{
88-
if (ConfigurationService.GetSection<LargeLanguageModelsSettings>() == null)
89-
{
90-
Logger.LogError("Could not load LargeLanguageModelsSettings section from testFrameworkSettings.json");
91-
return;
92-
}
93-
94-
try
95-
{
96-
var settings = ConfigurationService.GetSection<LargeLanguageModelsSettings>();
97-
98-
SemanticKernelService.Kernel.ImportPluginFromObject(new IOSLocatorSkill(), nameof(IOSLocatorSkill));
99-
SemanticKernelService.Kernel.ImportPluginFromObject(new AssertionSkill(), nameof(AssertionSkill));
100-
SemanticKernelService.Kernel.ImportPluginFromObject(new IOSPageObjectSummarizerSkill(), nameof(IOSPageObjectSummarizerSkill));
101-
SemanticKernelService.Kernel.ImportPluginFromObject(new LocatorMapperSkill(), nameof(LocatorMapperSkill));
102-
SemanticKernelService.Kernel.ImportPluginFromObject(new FailureAnalyzerSkill(), nameof(FailureAnalyzerSkill));
103-
104-
// index all page objects:
105-
if (settings.ShouldIndexPageObjects)
106-
{
107-
PageObjectsIndexer.IndexAllPageObjects(settings.PageObjectFilesPath, settings.MemoryIndex, settings.ResetIndexEverytime);
108-
}
109-
}
110-
catch (Exception ex)
111-
{
112-
Logger.LogError(ex.ToString());
113-
}
114-
}
11579
}

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

Lines changed: 14 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
using System.Drawing;
1818
using System.IO;
1919
using System.Text;
20-
using Bellatrix.CognitiveServices;
21-
using Bellatrix.CognitiveServices.services;
22-
using Bellatrix.LLM.Settings;
23-
using Bellatrix.LLM;
2420
using Bellatrix.Mobile.Contracts;
2521
using Bellatrix.Mobile.Controls.Core;
2622
using Bellatrix.Mobile.Events;
@@ -60,6 +56,8 @@ public Component()
6056
public static event EventHandler<ComponentActionEventArgs<TDriverElement>> CreatingComponents;
6157
public static event EventHandler<ComponentActionEventArgs<TDriverElement>> CreatedComponents;
6258
public static event EventHandler<NativeElementActionEventArgs<TDriverElement>> ReturningWrappedElement;
59+
public static event EventHandler<ElementResolveFailedEventArgs<TDriver, TDriverElement>> ElementResolveFailed;
60+
public static event EventHandler<ElementResolvedEventArgs<TDriver, TDriverElement>> ElementResolved;
6361

6462
public TDriver WrappedDriver { get; }
6563

@@ -85,14 +83,6 @@ public virtual string GetAttribute(string name)
8583
return WrappedElement.GetAttribute(name);
8684
}
8785

88-
public AssertedFormPage AIAnalyze()
89-
{
90-
string currentComponentScreenshot = TakeScreenshot();
91-
var formRecognizer = ServicesCollection.Current.Resolve<FormRecognizer>();
92-
var analyzedComponent = formRecognizer.Analyze(currentComponentScreenshot);
93-
return analyzedComponent;
94-
}
95-
9686
public string TakeScreenshot(string filePath = null)
9787
{
9888
if (string.IsNullOrEmpty(filePath))
@@ -256,54 +246,28 @@ protected TDriverElement GetAndWaitWebDriverElement(bool shouldRefresh = false)
256246

257247
_wrappedElement = GetWebDriverElement();
258248

259-
var settings = ConfigurationService.GetSection<LargeLanguageModelsSettings>();
260-
if (settings.EnableSelfHealing)
261-
{
262-
var snapshotProvider = ServicesCollection.Current.Resolve<IViewSnapshotProvider>();
263-
var snapshot = snapshotProvider.GetCurrentViewSnapshot();
264-
LocatorSelfHealingService.SaveWorkingLocator(By.ToString(), snapshot, GetLocationKey());
265-
}
249+
ElementResolved?.Invoke(this, new ElementResolvedEventArgs<TDriver, TDriverElement>(this, _wrappedElement));
266250

267251
_untils.Clear();
268252
return _wrappedElement;
269253
}
270254
catch (Exception ex)
271255
{
272-
var settings = ConfigurationService.GetSection<LargeLanguageModelsSettings>();
273-
if (!settings.EnableSelfHealing)
274-
{
275-
throw new TimeoutException($"❌ Element not found: {By?.Value}", ex);
276-
}
277-
278-
Logger.LogWarning($"⚠️ Element not found with locator: {By}. Trying AI-based healing...");
256+
var args = new ElementResolveFailedEventArgs<TDriver, TDriverElement>(this, ex);
279257

280-
var snapshotProvider = ServicesCollection.Current.Resolve<IViewSnapshotProvider>();
281-
var snapshot = snapshotProvider.GetCurrentViewSnapshot();
282-
var healedLocator = LocatorSelfHealingService.TryHeal(By.ToString(), snapshot, GetLocationKey());
258+
ElementResolveFailed?.Invoke(this, args);
283259

284-
if (!string.IsNullOrWhiteSpace(healedLocator))
260+
if (args.ResolvedElement != null)
285261
{
286-
try
287-
{
288-
// Determine strategy based on locator format
289-
if (healedLocator.StartsWith("uiautomator=", StringComparison.OrdinalIgnoreCase))
290-
{
291-
var expression = healedLocator.Substring("uiautomator=".Length).Trim();
292-
return new FindAndroidUIAutomatorStrategy(expression).FindElement(WrappedDriver as AndroidDriver) as TDriverElement;
293-
}
294-
else if (healedLocator.StartsWith("nspredicate=", StringComparison.OrdinalIgnoreCase))
295-
{
296-
var expression = healedLocator.Substring("nspredicate=".Length).Trim();
297-
return new FindIOSNsPredicateStrategy(expression).FindElement(WrappedDriver as IOSDriver) as TDriverElement;
298-
}
299-
}
300-
catch
301-
{
302-
throw new NotFoundException($"❌ Healing attempt failed for locator: {By}", ex);
303-
}
304-
}
262+
_wrappedElement = args.ResolvedElement;
305263

306-
throw new NotFoundException($"❌ Healing failed: {By}", ex);
264+
ElementResolved?.Invoke(this, new ElementResolvedEventArgs<TDriver, TDriverElement>(this, _wrappedElement));
265+
266+
_untils.Clear();
267+
return _wrappedElement;
268+
}
269+
270+
throw new TimeoutException($"❌ Element not found: {By?.Value}", ex);
307271
}
308272
}
309273

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace Bellatrix.Mobile.Events;
2+
3+
using System;
4+
5+
public class CapabilityValueResolvingEventArgs : EventArgs
6+
{
7+
public string RawValue { get; }
8+
public object ResolvedValue { get; set; }
9+
public bool Handled { get; set; }
10+
11+
public CapabilityValueResolvingEventArgs(string rawValue)
12+
{
13+
RawValue = rawValue;
14+
}
15+
}

0 commit comments

Comments
 (0)