Skip to content

Commit df621fe

Browse files
upgrade appium version for mobile, add page summary JSON for mobile which we will use later in LLM solutions
1 parent b0f0c38 commit df621fe

File tree

19 files changed

+272
-42
lines changed

19 files changed

+272
-42
lines changed
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
## Research Foundation Notice
1+
## 🔬 Research Foundation Notice
22

33
This repository is part of an academic research project on **AI-powered autonomous test automation agents**, integrating Large Language Models (LLMs), Semantic Kernel, and Retrieval-Augmented Generation (RAG).
44

55
- The core architecture, prompt engineering, and agent logic are original contributions by [Anton Angelov](https://www.linkedin.com/in/angelovstanton/).
66
- This work serves as the foundation for a PhD dissertation at the Technical University of Sofia.
77
- The system demonstrates AI agent-based planning, execution, healing, and diagnostics in automated testing.
8+
- The AI agent logic, planning structure, prompt strategies, and memory integration were designed by the author.
9+
- Implementation of auxiliary components (e.g., PR automation, UI fixes) may involve contributions from collaborators under the author’s supervision. All core design and research aspects remain attributable to the author.
810

911
**If you reuse or reference this project in academic, research, or commercial contexts, please provide appropriate attribution.**
1012

1113
---
1214

13-
## License
15+
## 📄 License
1416

1517
Licensed under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0).

src/Bellatrix.Api/LogWorkflowPlugin.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class LogWorkflowPlugin : Plugin
1717
{
1818
protected override void PreTestInit(object sender, PluginEventArgs e)
1919
{
20+
Logger.CurrentTestFullName.Value = e.TestFullName;
2021
Logger.LogInformation($"Start Test {e.TestClassType.Name}.{e.TestMethodMemberInfo.Name}");
2122
}
2223
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using Bellatrix.Desktop.Services;
2+
using HtmlAgilityPack;
3+
using Newtonsoft.Json;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
7+
namespace Bellatrix.Desktop;
8+
9+
public static class AppServiceExtensions
10+
{
11+
public static string GetPageSummaryJson(this AppService app)
12+
{
13+
var sourceXml = app.WrappedDriver.PageSource;
14+
15+
var doc = new HtmlDocument();
16+
doc.LoadHtml(sourceXml);
17+
18+
var nodes = doc.DocumentNode.SelectNodes("//*");
19+
if (nodes == null || nodes.Count == 0)
20+
{
21+
return "[]";
22+
}
23+
24+
List<DesktopElementSummary> elements = nodes
25+
.Select(node => new DesktopElementSummary
26+
{
27+
Tag = node.Name,
28+
AutomationId = node.GetAttributeValue("AutomationId", null),
29+
Name = node.GetAttributeValue("Name", null),
30+
ClassName = node.GetAttributeValue("ClassName", null),
31+
ControlType = node.GetAttributeValue("ControlType", null),
32+
Value = node.GetAttributeValue("Value.Value", null),
33+
HelpText = node.GetAttributeValue("HelpText", null)
34+
})
35+
.Where(x => !string.IsNullOrWhiteSpace(x.Name) || !string.IsNullOrWhiteSpace(x.AutomationId))
36+
.ToList();
37+
38+
return JsonConvert.SerializeObject(elements, Formatting.None);
39+
}
40+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// <copyright file="DesktopElementSummary.cs" company="Automate The Planet Ltd.">
2+
// Copyright 2025 Automate The Planet Ltd.
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// You may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
// Unless required by applicable law or agreed to in writing, software
7+
// distributed under the License is distributed on an "AS IS" BASIS,
8+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
// See the License for the specific language governing permissions and
10+
// limitations under the License.
11+
// </copyright>
12+
// <author>Anton Angelov</author>
13+
// <site>https://bellatrix.solutions/</site>
14+
// <note>This file is part of an academic research project exploring autonomous test agents using LLMs and Semantic Kernel.
15+
// The architecture and agent logic are original contributions by Anton Angelov, forming the foundation for a PhD dissertation.
16+
// Please cite or credit appropriately if reusing in academic or commercial work.</note>
17+
18+
namespace Bellatrix.Desktop;
19+
public class DesktopElementSummary
20+
{
21+
public string Tag { get; set; }
22+
public string AutomationId { get; set; }
23+
public string Name { get; set; }
24+
public string ClassName { get; set; }
25+
public string ControlType { get; set; }
26+
public string Value { get; set; }
27+
public string HelpText { get; set; }
28+
public bool Enabled { get; set; }
29+
}

src/Bellatrix.Desktop/plugins/LogLifecyclePlugin.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class LogLifecyclePlugin : Plugin
2020
{
2121
protected override void PreTestInit(object sender, PluginEventArgs e)
2222
{
23+
Logger.CurrentTestFullName.Value = e.TestFullName;
2324
Logger.LogInformation($"Start Test {e.TestClassType.Name}.{e.TestMethodMemberInfo.Name}");
2425
}
2526
}

src/Bellatrix.Mobile/Bellatrix.Mobile.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Appium.WebDriver" Version="5.0.0-rc.5" />
8+
<PackageReference Include="Appium.WebDriver" Version="7.2.0" />
99
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
1010
<PackageReference Include="MSTest" Version="3.2.2" />
1111
<PackageReference Include="NUnit" Version="4.3.2" />

src/Bellatrix.Mobile/findstrategies/iOS/FindIOSUIAutomationStrategy.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ public FindIOSUIAutomationStrategy(string name)
2525

2626
public override AppiumElement FindElement(IOSDriver searchContext)
2727
{
28-
return searchContext.FindElement(MobileBy.IosUIAutomation(Value));
28+
return searchContext.FindElement(MobileBy.IosNSPredicate(Value));
2929
}
3030

3131
public override IEnumerable<AppiumElement> FindAllElements(IOSDriver searchContext)
3232
{
33-
return searchContext.FindElements(MobileBy.IosUIAutomation(Value));
33+
return searchContext.FindElements(MobileBy.IosNSPredicate(Value));
3434
}
3535

3636
public override AppiumElement FindElement(AppiumElement element)
3737
{
38-
return element.FindElement(MobileBy.IosUIAutomation(Value));
38+
return element.FindElement(MobileBy.IosNSPredicate(Value));
3939
}
4040

4141
public override IEnumerable<AppiumElement> FindAllElements(AppiumElement element)
4242
{
43-
return element.FindElements(MobileBy.IosUIAutomation(Value));
43+
return element.FindElements(MobileBy.IosNSPredicate(Value));
4444
}
4545

4646
public override string ToString()
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// <copyright file="AppServiceExtensions.cs" company="Automate The Planet Ltd.">
2+
// Copyright 2025 Automate The Planet Ltd.
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// You may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
// Unless required by applicable law or agreed to in writing, software
7+
// distributed under the License is distributed on an "AS IS" BASIS,
8+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
// See the License for the specific language governing permissions and
10+
// limitations under the License.
11+
// </copyright>
12+
// <author>Anton Angelov</author>
13+
// <site>https://bellatrix.solutions/</site>
14+
// <note>This file is part of an academic research project exploring autonomous test agents using LLMs and Semantic Kernel.
15+
// The architecture and agent logic are original contributions by Anton Angelov, forming the foundation for a PhD dissertation.
16+
// Please cite or credit appropriately if reusing in academic or commercial work.</note>
17+
using Bellatrix.Mobile.Services;
18+
using HtmlAgilityPack;
19+
using Newtonsoft.Json;
20+
using System.Linq;
21+
22+
namespace Bellatrix.Mobile;
23+
24+
public static class AppServiceExtensions
25+
{
26+
public static string GetPageSummaryJson<TDriver, TComponent>(this AppService<TDriver, TComponent> app)
27+
where TDriver : AppiumDriver
28+
where TComponent : AppiumElement
29+
{
30+
var xml = app.PageSource;
31+
var doc = new HtmlDocument();
32+
doc.LoadHtml(xml);
33+
34+
var nodes = doc.DocumentNode.SelectNodes("//*");
35+
if (nodes == null || nodes.Count == 0)
36+
{
37+
return "[]";
38+
}
39+
40+
var summary = nodes.Select(node => new MobileElementSummary
41+
{
42+
Tag = node.Name,
43+
Id = node.GetAttributeValue("resource-id", node.GetAttributeValue("name", null)),
44+
Text = node.GetAttributeValue("text", null),
45+
Class = node.GetAttributeValue("class", null),
46+
ContentDesc = node.GetAttributeValue("content-desc", node.GetAttributeValue("label", null)),
47+
Type = node.GetAttributeValue("type", null)
48+
})
49+
.Where(e => !string.IsNullOrEmpty(e.Id) || !string.IsNullOrEmpty(e.Text) || !string.IsNullOrEmpty(e.ContentDesc))
50+
.ToList();
51+
52+
return JsonConvert.SerializeObject(summary, Formatting.None);
53+
}
54+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// <copyright file="MobileElementSummary.cs" company="Automate The Planet Ltd.">
2+
// Copyright 2025 Automate The Planet Ltd.
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// You may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
// Unless required by applicable law or agreed to in writing, software
7+
// distributed under the License is distributed on an "AS IS" BASIS,
8+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
// See the License for the specific language governing permissions and
10+
// limitations under the License.
11+
// </copyright>
12+
// <author>Anton Angelov</author>
13+
// <site>https://bellatrix.solutions/</site>
14+
// <note>This file is part of an academic research project exploring autonomous test agents using LLMs and Semantic Kernel.
15+
// The architecture and agent logic are original contributions by Anton Angelov, forming the foundation for a PhD dissertation.
16+
// Please cite or credit appropriately if reusing in academic or commercial work.</note>
17+
namespace Bellatrix.Mobile;
18+
19+
public class MobileElementSummary
20+
{
21+
public string Tag { get; set; }
22+
public string Id { get; set; } // resource-id (Android) or name (iOS)
23+
public string Text { get; set; }
24+
public string Class { get; set; }
25+
public string ContentDesc { get; set; } // Android: content-desc, iOS: label
26+
public string Type { get; set; } // iOS only
27+
}

src/Bellatrix.Mobile/plugins/LogWorkflowPlugin.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class LogWorkflowPlugin : Plugin
2020
{
2121
protected override void PreTestInit(object sender, PluginEventArgs e)
2222
{
23+
Logger.CurrentTestFullName.Value = e.TestFullName;
2324
Logger.LogInformation($"Start Test {e.TestClassType.Name}.{e.TestMethodMemberInfo.Name}");
2425
}
2526
}

0 commit comments

Comments
 (0)