Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/android_e2e_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ jobs:
run: dotnet build TransactionProcessor.Mobile/TransactionProcessor.Mobile.csproj -f net10.0-android -c Release --no-restore

- name: Run Android Navigation Tests
run: dotnet test TransactionProcessor.Mobile.UITests/TransactionProcessor.Mobile.UITests.csproj --filter "(Category=PRTest)&(Category=Android)" --no-restore
run: dotnet test TransactionProcessor.Mobile.UITests/TransactionProcessor.Mobile.UITests.csproj --filter "FullyQualifiedName~EndToEndTestsFeature&Category=Android|FullyQualifiedName~ReportingFeature" --no-restore

- name: Upload Logs on Failure
if: always()
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/android_navigation_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ jobs:
run: dotnet build TransactionProcessor.Mobile/TransactionProcessor.Mobile.csproj -f net10.0-android -c Release --no-restore

- name: Run Android Navigation Tests
run: dotnet test TransactionProcessor.Mobile.UITests/TransactionProcessor.Mobile.UITests.csproj --filter "(Category=PRNavTest)&(Category=Android)" --no-restore
run: dotnet test TransactionProcessor.Mobile.UITests/TransactionProcessor.Mobile.UITests.csproj --filter "FullyQualifiedName~PageNavigationFeature&Category=Android" --no-restore

- name: Upload Appium Logs on Failure
if: always()
Expand Down Expand Up @@ -287,7 +287,7 @@ jobs:
run: dotnet build TransactionProcessor.Mobile/TransactionProcessor.Mobile.csproj -f net10.0-android -c Release --no-restore

- name: Run Android Navigation Tests
run: dotnet test TransactionProcessor.Mobile.UITests/TransactionProcessor.Mobile.UITests.csproj --filter "(Category=PRHWNavTest)&(Category=Android)" --no-restore
run: dotnet test TransactionProcessor.Mobile.UITests/TransactionProcessor.Mobile.UITests.csproj --filter "FullyQualifiedName~HardwarePageNavigationFeature&Category=Android" --no-restore

- name: Upload Appium Logs on Failure
if: always()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_e2e_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
}

- name: Run Windows End To End Tests
run: dotnet test TransactionProcessor.Mobile.UiTests/TransactionProcessor.Mobile.UiTests.csproj --filter "Category=PRTest&Category=Windows" --no-restore
run: dotnet test TransactionProcessor.Mobile.UiTests/TransactionProcessor.Mobile.UiTests.csproj --filter "FullyQualifiedName~EndToEndTestsFeature&Category=Windows|FullyQualifiedName~ReportingFeature" --no-restore
#run: dotnet test TransactionProcessor.Mobile.UiTests/TransactionProcessor.Mobile.UiTests.csproj --list-tests -v:d

- name: Upload Logs on Failure
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_navigation_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
}

- name: Run Windows Navigation Tests
run: dotnet test TransactionProcessor.Mobile.UiTests/TransactionProcessor.Mobile.UiTests.csproj --filter "(Category=PRNavTest)&(Category=Windows)" --no-restore
run: dotnet test TransactionProcessor.Mobile.UiTests/TransactionProcessor.Mobile.UiTests.csproj --filter "FullyQualifiedName~PageNavigationFeature&Category=Windows" --no-restore

- name: Upload Appium Logs on Failure
if: always()
Expand Down
60 changes: 30 additions & 30 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Appium.WebDriver" Version="8.2.0" />
<PackageVersion Include="Appium.WebDriver" Version="8.3.2" />
<PackageVersion Include="banditoth.MAUI.DeviceId" Version="1.0.2" />
<PackageVersion Include="ClientProxyBase" Version="2026.5.7" />
<PackageVersion Include="CommunityToolkit.Maui" Version="14.2.0" />
<PackageVersion Include="ClientProxyBase" Version="2026.8.2" />
<PackageVersion Include="CommunityToolkit.Maui" Version="15.0.0" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.2" />
<PackageVersion Include="coverlet.collector" Version="10.0.1" />
<PackageVersion Include="EventStoreProjections" Version="2023.12.3" />
<PackageVersion Include="LiveChartsCore.SkiaSharpView" Version="2.0.4" />
<PackageVersion Include="LiveChartsCore.SkiaSharpView.Maui" Version="2.0.4" />
<PackageVersion Include="MediatR" Version="14.1.0" />
<PackageVersion Include="Microsoft.Data.Sqlite.Core" Version="10.0.9" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Logging.Debug" Version="10.0.9" />
<PackageVersion Include="Microsoft.Maui.Controls" Version="10.0.71" />
<PackageVersion Include="Microsoft.Maui.Controls.Compatibility" Version="10.0.71" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
<PackageVersion Include="LiveChartsCore.SkiaSharpView" Version="2.0.5" />
<PackageVersion Include="LiveChartsCore.SkiaSharpView.Maui" Version="2.0.5" />
<PackageVersion Include="MediatR" Version="14.2.0" />
<PackageVersion Include="Microsoft.Data.Sqlite.Core" Version="10.0.11" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.11" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="10.0.11" />
<PackageVersion Include="Microsoft.Extensions.Logging.Debug" Version="10.0.11" />
<PackageVersion Include="Microsoft.Maui.Controls" Version="10.0.90" />
<PackageVersion Include="Microsoft.Maui.Controls.Compatibility" Version="10.0.90" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.9.0" />
<PackageVersion Include="Moq" Version="4.20.72" />
<PackageVersion Include="NUnit" Version="4.6.1" />
<PackageVersion Include="NUnit.Analyzers" Version="4.14.0" />
Expand All @@ -28,24 +28,24 @@
<PackageVersion Include="Refractored.MvvmHelpers" Version="1.6.2" />
<PackageVersion Include="Reqnroll.NUnit" Version="3.3.4" />
<PackageVersion Include="Reqnroll.Tools.MsBuild.Generation" Version="3.3.4" />
<PackageVersion Include="RichardSzalay.MockHttp" Version="7.0.0" />
<PackageVersion Include="SecurityService.Client" Version="2026.5.1" />
<PackageVersion Include="SecurityService.IntegrationTesting.Helpers" Version="2026.5.1" />
<PackageVersion Include="Shared.IntegrationTesting" Version="2026.5.7" />
<PackageVersion Include="Shared.Results" Version="2026.5.7" />
<PackageVersion Include="RichardSzalay.MockHttp" Version="7.1.0" />
<PackageVersion Include="SecurityService.Client" Version="2026.7.2" />
<PackageVersion Include="SecurityService.IntegrationTesting.Helpers" Version="2026.7.2" />
<PackageVersion Include="Shared.IntegrationTesting" Version="2026.8.2" />
<PackageVersion Include="Shared.Results" Version="2026.8.2" />
<PackageVersion Include="Shouldly" Version="4.3.0" />
<PackageVersion Include="Sentry.Maui" Version="6.6.0" />
<PackageVersion Include="SQLite" Version="3.13.0" />
<PackageVersion Include="sqlite-net-pcl" Version="1.9.172" />
<PackageVersion Include="Sentry.Maui" Version="6.9.0" />
<PackageVersion Include="SQLite" Version="3.53.4" />
<PackageVersion Include="sqlite-net-pcl" Version="1.11.285" />
<PackageVersion Include="SQLitePCLRaw.bundle_green" Version="2.1.11" />
<PackageVersion Include="SQLitePCLRaw.core" Version="3.0.3" />
<PackageVersion Include="SQLitePCLRaw.provider.dynamic_cdecl" Version="3.0.3" />
<PackageVersion Include="SQLitePCLRaw.provider.sqlite3" Version="3.0.3" />
<PackageVersion Include="TransactionProcessor.Client" Version="2026.5.2" />
<PackageVersion Include="TransactionProcessor.Database" Version="2026.5.2" />
<PackageVersion Include="TransactionProcessor.IntegrationTesting.Helpers" Version="2026.5.2" />
<PackageVersion Include="TransactionProcessorACL.DataTransferObjects" Version="2026.7.1" />
<PackageVersion Include="xunit.v3" Version="3.2.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="SQLitePCLRaw.core" Version="3.0.5" />
<PackageVersion Include="SQLitePCLRaw.provider.dynamic_cdecl" Version="3.0.5" />
<PackageVersion Include="SQLitePCLRaw.provider.sqlite3" Version="3.0.5" />
<PackageVersion Include="TransactionProcessor.Client" Version="2026.7.2" />
<PackageVersion Include="TransactionProcessor.Database" Version="2026.7.2" />
<PackageVersion Include="TransactionProcessor.IntegrationTesting.Helpers" Version="2026.7.2" />
<PackageVersion Include="TransactionProcessorACL.DataTransferObjects" Version="2026.7.6" />
<PackageVersion Include="xunit.v3" Version="4.0.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="4.0.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Shouldly;
using TransactionProcessor.Mobile.BusinessLogic.Models;

namespace TransactionProcessor.Mobile.BusinessLogic.Tests.ModelTests;

public class AutomationIdHelperTests
{
[Fact]
public void Create_ReplacesUnsupportedCharactersWithUnderscores()
{
AutomationIdHelper.Create("RecentActivityResult", "TXN-10001")
.ShouldBe("RecentActivityResult_TXN_10001");
}

[Fact]
public void Create_TrimsAndCollapsesSeparators()
{
AutomationIdHelper.Create("TransactionMixItem", " bill-pay-post ")
.ShouldBe("TransactionMixItem_bill_pay_post");
}

[Fact]
public void Create_ReturnsPrefixForEmptyValues()
{
AutomationIdHelper.Create("TransactionMixItem", " ")
.ShouldBe("TransactionMixItem");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
namespace TransactionProcessor.Mobile.BusinessLogic.Models;

public static class AutomationIdHelper
{
public static string Create(string prefix, string value)
{
if (string.IsNullOrWhiteSpace(value))
{
return prefix;
}

var builder = new System.Text.StringBuilder(prefix.Length + value.Length + 1);
builder.Append(prefix);
builder.Append('_');

bool appendedCharacter = false;
bool lastWasSeparator = false;

foreach (char character in value.Trim())
{
char sanitized = char.IsLetterOrDigit(character) ? character : '_';

if (sanitized == '_')
{
if (lastWasSeparator)
{
continue;
}

lastWasSeparator = true;
}
else
{
lastWasSeparator = false;
}

builder.Append(sanitized);
appendedCharacter = true;
}

if (appendedCharacter == false)
{
return prefix;
}

if (builder.Length > 0 && builder[^1] == '_')
{
builder.Length--;
}

return builder.ToString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public sealed record RecentActivityReceiptItemModel(string Reference,
DateTime TransactionDateTime,
string ReceiptReference)
{
public string AutomationId => AutomationIdHelper.Create("RecentActivityResult", this.Reference);

public bool Matches(string searchText)
{
return this.Reference.Contains(searchText, StringComparison.OrdinalIgnoreCase)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ public static TransactionMixSummaryModel CreateMock(int merchantReportingId,
public sealed record TransactionMixSummaryItemModel(string Key,
string Label,
decimal Count,
decimal Value);
decimal Value)
{
public string AutomationId => AutomationIdHelper.Create("TransactionMixItem", this.Key);
}

public sealed record TransactionMixDrillDownTransactionModel(string Reference,
string TransactionType,
Expand Down
20 changes: 18 additions & 2 deletions TransactionProcessor.Mobile.UITests/Common/DockerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using TestHosts.Clients;
using TransactionProcessor.Client;
using TransactionProcessor.DataTransferObjects.Responses.Contract;
using TransactionProcessor.IntegrationTesting.Helpers;
Expand Down Expand Up @@ -42,6 +43,8 @@ public class DockerHelper : global::Shared.IntegrationTesting.TestContainers.Doc

private readonly TestingContext TestingContext;

public IAgencyBankingClient AgencyBankingClient;

#endregion

public EventStoreProjectionManagementClient ProjectionManagementClient;
Expand Down Expand Up @@ -119,6 +122,16 @@ Object Deserialise(String arg, Type type)
return StringSerialiser.DeserializeObject<Object>(arg, type, new SerialiserOptions(SerialiserPropertyFormat.SnakeCase));
}

String Serialise_CamelCase(Object arg)
{
return StringSerialiser.Serialise<Object>(arg, new SerialiserOptions(SerialiserPropertyFormat.CamelCase));
}

Object Deserialise_CamelCase(String arg, Type type)
{
return StringSerialiser.DeserializeObject<Object>(arg, type, new SerialiserOptions(SerialiserPropertyFormat.CamelCase));
}

/// <summary>
/// Starts the containers for scenario run.
/// </summary>
Expand Down Expand Up @@ -164,7 +177,8 @@ public override async Task StartContainersForScenarioRun(String scenarioName, Do

this.TestHostHttpClient = new HttpClient(clientHandler);
this.TestHostHttpClient.BaseAddress = new Uri($"http://127.0.0.1:{this.TestHostServicePort}");

this.AgencyBankingClient = new AgencyBankingClient(TestHostServiceBaseAddressResolver, httpClient, Serialise_CamelCase, this.Deserialise_CamelCase);

this.ProjectionManagementClient = new EventStoreProjectionManagementClient(this.ConfigureEventStoreSettings());
}

Expand All @@ -173,7 +187,9 @@ public override async Task StartContainersForScenarioRun(String scenarioName, Do
public String TransactionProcessorAclBaseAddressResolver(String api) => $"http://127.0.0.1:{this.TransactionProcessorAclPort}";

public String SecurityServiceBaseAddressResolver(String api) => $"https://127.0.0.1:{this.SecurityServicePort}";


public String TestHostServiceBaseAddressResolver(String api) => $"http://127.0.0.1:{this.TestHostServicePort}";

public const int ConfigHostDockerPort = 9200;

public String ConfigHostContainerName;
Expand Down
44 changes: 38 additions & 6 deletions TransactionProcessor.Mobile.UITests/Drivers/AppiumDriver.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Reflection;
using System.Net.Sockets;
using OpenQA.Selenium;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Enums;
Expand All @@ -17,15 +18,20 @@ public enum MobileTestPlatform

public class AppiumDriverWrapper
{
private const int AppiumPort = 4723;
private static readonly Uri AppiumServerUri = new($"http://127.0.0.1:{AppiumPort}/");

public static MobileTestPlatform MobileTestPlatform;
public static AppiumDriver Driver;

public void StartApp()
{
AppiumLocalService appiumService = new AppiumServiceBuilder().UsingPort(4723).Build();
bool appiumAlreadyRunning = this.IsPortOpen("127.0.0.1", AppiumPort);
AppiumLocalService appiumService = null;

if (appiumService.IsRunning == false)
if (appiumAlreadyRunning == false)
{
appiumService = new AppiumServiceBuilder().UsingPort(AppiumPort).Build();
appiumService.OutputDataReceived += (sender,
args) => {
Console.WriteLine(args.Data);
Expand All @@ -44,7 +50,7 @@ public void StartApp()
}
}

private static void SetupWindowsDriver(AppiumLocalService appiumService)
private static void SetupWindowsDriver(AppiumLocalService? appiumService)
{
var driverOptions = new AppiumOptions();
driverOptions.AutomationName = "windows";
Expand All @@ -56,10 +62,12 @@ private static void SetupWindowsDriver(AppiumLocalService appiumService)
driverOptions.AddAdditionalAppiumOption("ms:waitForAppLaunch", "50");
//driverOptions.AddAdditionalAppiumOption("appium:createSessionTimeout", "100000");
driverOptions.App = "TransactionMobile_zct748q4xfh0m!App";
AppiumDriverWrapper.Driver = new WindowsDriver(appiumService, driverOptions, TimeSpan.FromMinutes(10));
AppiumDriverWrapper.Driver = appiumService == null
? new WindowsDriver(AppiumServerUri, driverOptions, TimeSpan.FromMinutes(10))
: new WindowsDriver(appiumService, driverOptions, TimeSpan.FromMinutes(10));
}

private static void SetupAndroidDriver(AppiumLocalService appiumService)
private static void SetupAndroidDriver(AppiumLocalService? appiumService)
{
var driverOptions = new AppiumOptions();
driverOptions.AddAdditionalAppiumOption("adbExecTimeout", TimeSpan.FromMinutes(5).TotalMilliseconds);
Expand All @@ -82,7 +90,9 @@ private static void SetupAndroidDriver(AppiumLocalService appiumService)

driverOptions.App = apkPath;

AppiumDriverWrapper.Driver = new OpenQA.Selenium.Appium.Android.AndroidDriver(appiumService, driverOptions, TimeSpan.FromMinutes(5));
AppiumDriverWrapper.Driver = appiumService == null
? new OpenQA.Selenium.Appium.Android.AndroidDriver(AppiumServerUri, driverOptions, TimeSpan.FromMinutes(5))
: new OpenQA.Selenium.Appium.Android.AndroidDriver(appiumService, driverOptions, TimeSpan.FromMinutes(5));
}

public List<LogEntry> GetLogs()
Expand Down Expand Up @@ -112,5 +122,27 @@ public void StopApp()
Console.WriteLine(e.Message);
}
}

private bool IsPortOpen(string host, int port)
{
try
{
using TcpClient client = new TcpClient();
IAsyncResult result = client.BeginConnect(host, port, null, null);
bool completed = result.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(1));
if (completed == false)
{
client.Close();
return false;
}

client.EndConnect(result);
return client.Connected;
}
catch
{
return false;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Background:
@PRTest
Scenario: EndToEnd
Given I am on the Login Screen
And the application is in training mode
And my device is registered
When I enter 'user1' as the Email Address
And I enter '123456' as the Password
Expand Down
Loading
Loading