From 2456d7128f28e3302911f1049602aac2856f20d7 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Thu, 25 Aug 2022 21:57:40 +0100 Subject: [PATCH 1/4] Added flag to log message and transaction records --- .../SupportRequestHandlerTests.cs | 43 ++++++++- .../TransactionRequestHandlerTests.cs | 4 +- ...tionMobile.Maui.BusinessLogic.Tests.csproj | 2 + .../Database/DatabaseContext.cs | 89 ++++++++++--------- .../Database/IDatabaseContext.cs | 4 +- .../Database/LogMessage.cs | 34 ++----- .../RequestHandlers/SupportRequestHandler.cs | 9 +- .../TransactionRequestHandler.cs | 8 +- .../Services/DatabaseLogger.cs | 24 +++-- .../Support/SupportPageViewModel.cs | 2 +- .../Features/Profile.feature.cs | 12 +-- TransactionMobile.Maui/MauiProgram.cs | 3 +- 12 files changed, 132 insertions(+), 102 deletions(-) diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/RequestHandlerTests/SupportRequestHandlerTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/RequestHandlerTests/SupportRequestHandlerTests.cs index 509a0f80..5f624722 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/RequestHandlerTests/SupportRequestHandlerTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/RequestHandlerTests/SupportRequestHandlerTests.cs @@ -5,6 +5,7 @@ using System.Threading; using System.Threading.Tasks; using Database; +using Microsoft.Data.Sqlite; using Moq; using RequestHandlers; using Requests; @@ -24,7 +25,7 @@ public async Task SupportRequestHandlerTests_UploadLogsRequest_NoLogs_Handle_IsH }); Mock databaseContext = new Mock(); - databaseContext.Setup(d => d.GetLogMessages(It.IsAny())).ReturnsAsync(new List()); + databaseContext.Setup(d => d.GetLogMessages(It.IsAny(), It.IsAny())).ReturnsAsync(new List()); Mock applicationCache = new Mock(); SupportRequestHandler handler = new SupportRequestHandler(configurationServiceResolver, databaseContext.Object, applicationCache.Object); @@ -45,7 +46,7 @@ public async Task SupportRequestHandlerTests_UploadLogsRequest_LogsToUpload_Only return configurationService.Object; }); Mock databaseContext = new Mock(); - databaseContext.SetupSequence(d => d.GetLogMessages(It.IsAny())).ReturnsAsync(new List() + databaseContext.SetupSequence(d => d.GetLogMessages(It.IsAny(), It.IsAny())).ReturnsAsync(new List() { new Database.LogMessage{LogLevel = LogLevel.Debug.ToString()}, new Database.LogMessage{LogLevel = LogLevel.Debug.ToString()}, @@ -80,7 +81,7 @@ public async Task SupportRequestHandlerTests_UploadLogsRequest_LogsToUpload_15Me return configurationService.Object; }); Mock databaseContext = new Mock(); - databaseContext.SetupSequence(d => d.GetLogMessages(It.IsAny())).ReturnsAsync(new List() + databaseContext.SetupSequence(d => d.GetLogMessages(It.IsAny(), It.IsAny())).ReturnsAsync(new List() { new Database.LogMessage{LogLevel = LogLevel.Debug.ToString()}, new Database.LogMessage{LogLevel = LogLevel.Debug.ToString()}, @@ -112,4 +113,40 @@ public async Task SupportRequestHandlerTests_UploadLogsRequest_LogsToUpload_15Me response.ShouldBeTrue(); databaseContext.Verify(d => d.RemoveUploadedMessages(It.IsAny>()), Times.Exactly(2)); } + + [Theory] + [InlineData(true, 4)] + [InlineData(false, 3)] + public async Task SupportRequestHandlerTests_ViewLogsRequest_Handle_IsHandled(Boolean isTrainingMode, Int32 expectedNumberMessages) { + Mock configurationService = new Mock(); + Func configurationServiceResolver = new Func((param) => + { + return configurationService.Object; + }); + Func logLevelFunc = new Func(() => + { + return Database.LogLevel.Debug; + }); + IDatabaseContext databaseContext = new DatabaseContext(":memory:", logLevelFunc); + await databaseContext.InitialiseDatabase(); + + List logMessages = new List(); + logMessages.Add(new LogMessage { LogLevel = LogLevel.Debug.ToString()}); + logMessages.Add(new LogMessage { LogLevel = LogLevel.Debug.ToString() }); + logMessages.Add(new LogMessage { LogLevel = LogLevel.Debug.ToString() }); + logMessages.Add(new LogMessage { LogLevel = LogLevel.Debug.ToString(), IsTrainingMode = true}); + logMessages.Add(new LogMessage { LogLevel = LogLevel.Debug.ToString(), IsTrainingMode = true }); + logMessages.Add(new LogMessage { LogLevel = LogLevel.Debug.ToString(), IsTrainingMode = true }); + logMessages.Add(new LogMessage { LogLevel = LogLevel.Debug.ToString(), IsTrainingMode = true }); + await databaseContext.InsertLogMessages(logMessages); + + Mock applicationCache = new Mock(); + applicationCache.Setup(a => a.GetUseTrainingMode()).Returns(isTrainingMode); + SupportRequestHandler handler = new SupportRequestHandler(configurationServiceResolver, databaseContext, applicationCache.Object); + + ViewLogsRequest request = ViewLogsRequest.Create(); + List? result = await handler.Handle(request, CancellationToken.None); + + result.Count.ShouldBe(expectedNumberMessages); + } } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/RequestHandlerTests/TransactionRequestHandlerTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/RequestHandlerTests/TransactionRequestHandlerTests.cs index 22b88d2d..812a4c93 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/RequestHandlerTests/TransactionRequestHandlerTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/RequestHandlerTests/TransactionRequestHandlerTests.cs @@ -108,7 +108,7 @@ public async Task TransactionRequestHandler_PerformReconciliationRequest_NoTrans Mock databaseContext = new Mock(); Mock applicationCache = new Mock(); transactionService.Setup(t => t.PerformReconciliation(It.IsAny(), It.IsAny())).ReturnsAsync(true); - databaseContext.Setup(d => d.GetTransactions()).ReturnsAsync(new List()); + databaseContext.Setup(d => d.GetTransactions(It.IsAny())).ReturnsAsync(new List()); TransactionRequestHandler handler = new TransactionRequestHandler(transactionServiceResolver, databaseContext.Object, applicationCache.Object); PerformReconciliationRequest request = PerformReconciliationRequest.Create(TestData.TransactionDateTime, @@ -132,7 +132,7 @@ public async Task TransactionRequestHandler_PerformReconciliationRequest_Transac Mock applicationCache = new Mock(); transactionService.Setup(t => t.PerformReconciliation(It.IsAny(), It.IsAny())).ReturnsAsync(true); - databaseContext.Setup(d => d.GetTransactions()).ReturnsAsync(TestData.StoredTransactions); + databaseContext.Setup(d => d.GetTransactions(It.IsAny())).ReturnsAsync(TestData.StoredTransactions); TransactionRequestHandler handler = new TransactionRequestHandler(transactionServiceResolver, databaseContext.Object, applicationCache.Object); PerformReconciliationRequest request = PerformReconciliationRequest.Create(TestData.TransactionDateTime, diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/TransactionMobile.Maui.BusinessLogic.Tests.csproj b/TransactionMobile.Maui.BusinessLogic.Tests/TransactionMobile.Maui.BusinessLogic.Tests.csproj index c5b4c878..0a2e46cb 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/TransactionMobile.Maui.BusinessLogic.Tests.csproj +++ b/TransactionMobile.Maui.BusinessLogic.Tests/TransactionMobile.Maui.BusinessLogic.Tests.csproj @@ -8,10 +8,12 @@ + + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/TransactionMobile.Maui.BusinessLogic/Database/DatabaseContext.cs b/TransactionMobile.Maui.BusinessLogic/Database/DatabaseContext.cs index 2aeca90a..7942c879 100644 --- a/TransactionMobile.Maui.BusinessLogic/Database/DatabaseContext.cs +++ b/TransactionMobile.Maui.BusinessLogic/Database/DatabaseContext.cs @@ -4,85 +4,86 @@ public class DatabaseContext : IDatabaseContext { + #region Fields + private readonly SQLiteConnection Connection; private readonly Func LogLevelResolver; - public DatabaseContext(String connectionString, Func logLevelResolver) - { + #endregion + + #region Constructors + + public DatabaseContext(String connectionString, + Func logLevelResolver) { this.Connection = new SQLiteConnection(connectionString); this.LogLevelResolver = logLevelResolver; } - public async Task InitialiseDatabase() - { - this.Connection.CreateTable(); - this.Connection.CreateTable(); + #endregion + + #region Methods + + public async Task ClearStoredTransactions(List transactionRecords) { + foreach (var transactionRecord in transactionRecords) { + this.Connection.Delete(transactionRecord.TransactionNumber); + } } - public async Task CreateTransaction(TransactionRecord transactionRecord) - { + public async Task CreateTransaction(TransactionRecord transactionRecord) { this.Connection.Insert(transactionRecord); return SQLite3.LastInsertRowid(this.Connection.Handle); } - public async Task UpdateTransaction(TransactionRecord transactionRecord) - { - this.Connection.Update(transactionRecord); - } + public async Task> GetLogMessages(Int32 batchSize, + Boolean isTrainingMode) { + if (this.Connection == null) + return new List(); - public async Task> GetTransactions() - { - return this.Connection.Table().ToList(); - } + List messages = this.Connection.Table().Where(l => l.IsTrainingMode == isTrainingMode).OrderByDescending(l => l.EntryDateTime) + .Take(batchSize).ToList(); - public async Task ClearStoredTransactions(List transactionRecords) - { - foreach (var transactionRecord in transactionRecords) - { - this.Connection.Delete(transactionRecord.TransactionNumber); - } + return messages; } - public async Task> GetLogMessages(int batchSize) - { - if (this.Connection == null) - return new List(); - - List messages = this.Connection.Table().OrderByDescending(l => l.EntryDateTime).Take(batchSize).ToList(); - - return messages; + public async Task> GetTransactions(Boolean isTrainingMode) { + return this.Connection.Table().Where(t => t.IsTrainingMode == isTrainingMode).ToList(); + } + + public async Task InitialiseDatabase() { + this.Connection.CreateTable(); + this.Connection.CreateTable(); } - public async Task InsertLogMessage(LogMessage logMessage) - { + public async Task InsertLogMessage(LogMessage logMessage) { if (this.Connection == null) return; LogLevel messageLevel = (LogLevel)Enum.Parse(typeof(LogLevel), logMessage.LogLevel, true); - if (messageLevel <= this.LogLevelResolver()) - { - this.Connection.Insert(logMessage); + if (messageLevel <= this.LogLevelResolver()) { + this.Connection.Insert(logMessage); } } - public async Task InsertLogMessages(List logMessages) - { - foreach (LogMessage logMessage in logMessages) - { + public async Task InsertLogMessages(List logMessages) { + foreach (LogMessage logMessage in logMessages) { await this.InsertLogMessage(logMessage); } } - public async Task RemoveUploadedMessages(List logMessagesToRemove) - { + public async Task RemoveUploadedMessages(List logMessagesToRemove) { if (this.Connection == null) return; - foreach (LogMessage logMessage in logMessagesToRemove) - { + foreach (LogMessage logMessage in logMessagesToRemove) { this.Connection.Delete(logMessage); } } + + public async Task UpdateTransaction(TransactionRecord transactionRecord) { + this.Connection.Update(transactionRecord); + } + + #endregion } -} +} \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic/Database/IDatabaseContext.cs b/TransactionMobile.Maui.BusinessLogic/Database/IDatabaseContext.cs index 7800d2ca..d0503187 100644 --- a/TransactionMobile.Maui.BusinessLogic/Database/IDatabaseContext.cs +++ b/TransactionMobile.Maui.BusinessLogic/Database/IDatabaseContext.cs @@ -14,10 +14,10 @@ public interface IDatabaseContext Task UpdateTransaction(TransactionRecord transactionRecord); - Task> GetTransactions(); + Task> GetTransactions(Boolean isTrainingMode); Task ClearStoredTransactions(List transactionRecords); - Task> GetLogMessages(Int32 batchSize); + Task> GetLogMessages(Int32 batchSize, Boolean isTrainingMode); Task InsertLogMessage(LogMessage logMessage); diff --git a/TransactionMobile.Maui.BusinessLogic/Database/LogMessage.cs b/TransactionMobile.Maui.BusinessLogic/Database/LogMessage.cs index 8549e23f..88fd86bb 100644 --- a/TransactionMobile.Maui.BusinessLogic/Database/LogMessage.cs +++ b/TransactionMobile.Maui.BusinessLogic/Database/LogMessage.cs @@ -4,40 +4,18 @@ public class LogMessage { #region Properties - - /// - /// Gets or sets the entry date time. - /// - /// - /// The entry date time. - /// + public DateTime EntryDateTime { get; set; } - - /// - /// Gets or sets the identifier. - /// - /// - /// The identifier. - /// + [PrimaryKey, AutoIncrement] public Int32 Id { get; set; } - - /// - /// Gets or sets the log level. - /// - /// - /// The log level. - /// + public String LogLevel { get; set; } - - /// - /// Gets or sets the message. - /// - /// - /// The message. - /// + public String Message { get; set; } + public Boolean IsTrainingMode { get; set; } + #endregion } diff --git a/TransactionMobile.Maui.BusinessLogic/RequestHandlers/SupportRequestHandler.cs b/TransactionMobile.Maui.BusinessLogic/RequestHandlers/SupportRequestHandler.cs index b84e3a36..2f0f1823 100644 --- a/TransactionMobile.Maui.BusinessLogic/RequestHandlers/SupportRequestHandler.cs +++ b/TransactionMobile.Maui.BusinessLogic/RequestHandlers/SupportRequestHandler.cs @@ -29,9 +29,11 @@ public SupportRequestHandler(Func configurationS public async Task Handle(UploadLogsRequest request, CancellationToken cancellationToken) { + Boolean useTrainingMode = this.ApplicationCache.GetUseTrainingMode(); + while (true) { - List logEntries = await this.DatabaseContext.GetLogMessages(10); // TODO: Configurable batch size + List logEntries = await this.DatabaseContext.GetLogMessages(10, useTrainingMode); // TODO: Configurable batch size if (logEntries.Any() == false) { @@ -49,7 +51,6 @@ public async Task Handle(UploadLogsRequest request, CancellationToken c EntryDateTime = l.EntryDateTime, Id = l.Id })); - Boolean useTrainingMode = this.ApplicationCache.GetUseTrainingMode(); IConfigurationService configurationService = this.ConfigurationServiceResolver(useTrainingMode); await configurationService.PostDiagnosticLogs(request.DeviceIdentifier, logMessageModels, CancellationToken.None); @@ -62,7 +63,9 @@ public async Task Handle(UploadLogsRequest request, CancellationToken c public async Task> Handle(ViewLogsRequest request, CancellationToken cancellationToken) { - List logEntries = await this.DatabaseContext.GetLogMessages(50); // TODO: Configurable batch size + Boolean useTrainingMode = this.ApplicationCache.GetUseTrainingMode(); + + List logEntries = await this.DatabaseContext.GetLogMessages(50, useTrainingMode); // TODO: Configurable batch size List logMessageModels = new List(); diff --git a/TransactionMobile.Maui.BusinessLogic/RequestHandlers/TransactionRequestHandler.cs b/TransactionMobile.Maui.BusinessLogic/RequestHandlers/TransactionRequestHandler.cs index a0795f41..8fa1bd37 100644 --- a/TransactionMobile.Maui.BusinessLogic/RequestHandlers/TransactionRequestHandler.cs +++ b/TransactionMobile.Maui.BusinessLogic/RequestHandlers/TransactionRequestHandler.cs @@ -208,21 +208,17 @@ public async Task Handle(PerformReconciliationRequest request, { Boolean useTrainingMode = this.ApplicationCache.GetUseTrainingMode(); - List storedTransactions = await this.DatabaseContext.GetTransactions(); + List storedTransactions = await this.DatabaseContext.GetTransactions(useTrainingMode); if (storedTransactions.Any() == false) { return true; } - - // Filter based on training mode - storedTransactions = storedTransactions.Where(t => t.IsTrainingMode == useTrainingMode).ToList(); - + // TODO: convert these to operator totals List operatorTotals = (from t in storedTransactions where t.IsSuccessful = true && t.TransactionType != 1 // Filter out logons - && t.IsTrainingMode == useTrainingMode group t by new { t.ContractId, diff --git a/TransactionMobile.Maui.BusinessLogic/Services/DatabaseLogger.cs b/TransactionMobile.Maui.BusinessLogic/Services/DatabaseLogger.cs index 13b78c1c..d30fb3f3 100644 --- a/TransactionMobile.Maui.BusinessLogic/Services/DatabaseLogger.cs +++ b/TransactionMobile.Maui.BusinessLogic/Services/DatabaseLogger.cs @@ -12,9 +12,13 @@ namespace TransactionMobile.Maui.BusinessLogic.Services public class DatabaseLogger : ILogger { private readonly IDatabaseContext DatabaseContext; - public DatabaseLogger(IDatabaseContext databaseContext) + + private readonly IApplicationCache ApplicationCache; + + public DatabaseLogger(IDatabaseContext databaseContext,IApplicationCache applicationCache) { this.DatabaseContext = databaseContext; + this.ApplicationCache = applicationCache; this.IsInitialised = true; } @@ -30,7 +34,8 @@ public void LogCritical(Exception exception) { EntryDateTime = item.EntryDateTime, LogLevel = item.LogLevel.ToString(), - Message = item.Message + Message = item.Message, + IsTrainingMode = this.ApplicationCache.GetUseTrainingMode() }); } this.DatabaseContext.InsertLogMessages(logMessages); @@ -43,7 +48,8 @@ public void LogDebug(string message) { EntryDateTime = logMessageModel.EntryDateTime, LogLevel = logMessageModel.LogLevel.ToString(), - Message = logMessageModel.Message + Message = logMessageModel.Message, + IsTrainingMode = this.ApplicationCache.GetUseTrainingMode() }; this.DatabaseContext.InsertLogMessage(logMessage); } @@ -58,7 +64,8 @@ public void LogError(Exception exception) { EntryDateTime = item.EntryDateTime, LogLevel = item.LogLevel.ToString(), - Message = item.Message + Message = item.Message, + IsTrainingMode = this.ApplicationCache.GetUseTrainingMode() }); } this.DatabaseContext.InsertLogMessages(logMessages); @@ -71,7 +78,8 @@ public void LogInformation(string message) { EntryDateTime = logMessageModel.EntryDateTime, LogLevel = logMessageModel.LogLevel.ToString(), - Message = logMessageModel.Message + Message = logMessageModel.Message, + IsTrainingMode = this.ApplicationCache.GetUseTrainingMode() }; this.DatabaseContext.InsertLogMessage(logMessage); } @@ -83,7 +91,8 @@ public void LogTrace(string message) { EntryDateTime = logMessageModel.EntryDateTime, LogLevel = logMessageModel.LogLevel.ToString(), - Message = logMessageModel.Message + Message = logMessageModel.Message, + IsTrainingMode = this.ApplicationCache.GetUseTrainingMode() }; this.DatabaseContext.InsertLogMessage(logMessage); } @@ -95,7 +104,8 @@ public void LogWarning(string message) { EntryDateTime = logMessageModel.EntryDateTime, LogLevel = logMessageModel.LogLevel.ToString(), - Message = logMessageModel.Message + Message = logMessageModel.Message, + IsTrainingMode = this.ApplicationCache.GetUseTrainingMode() }; this.DatabaseContext.InsertLogMessage(logMessage); } diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/Support/SupportPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/Support/SupportPageViewModel.cs index 9be7d1f2..f300677c 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/Support/SupportPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/Support/SupportPageViewModel.cs @@ -55,7 +55,7 @@ public SupportPageViewModel(IDeviceService deviceService, public String ApplicationName => $"{this.ApplicationInfoService.ApplicationName} v{this.ApplicationInfoService.VersionString}"; - public String NumberTransactionsStored => $"Transactions Stored: {this.DatabaseContext.GetTransactions().Result.Count()}"; + public String NumberTransactionsStored => $"Transactions Stored: {this.DatabaseContext.GetTransactions(this.ApplicationCache.GetUseTrainingMode()).Result.Count()}"; public String Platform { get { diff --git a/TransactionMobile.Maui.UiTests/Features/Profile.feature.cs b/TransactionMobile.Maui.UiTests/Features/Profile.feature.cs index 49ac1d8b..9d02ac88 100644 --- a/TransactionMobile.Maui.UiTests/Features/Profile.feature.cs +++ b/TransactionMobile.Maui.UiTests/Features/Profile.feature.cs @@ -203,12 +203,14 @@ public void ViewMerchantContacts() [NUnit.Framework.TestAttribute()] [NUnit.Framework.DescriptionAttribute("View Merchant Details")] + [NUnit.Framework.CategoryAttribute("PRTest")] public void ViewMerchantDetails() { - string[] tagsOfScenario = ((string[])(null)); + string[] tagsOfScenario = new string[] { + "PRTest"}; System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("View Merchant Details", null, tagsOfScenario, argumentsOfScenario, featureTags); -#line 28 +#line 29 this.ScenarioInitialize(scenarioInfo); #line hidden if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags))) @@ -221,10 +223,10 @@ public void ViewMerchantDetails() #line 4 this.FeatureBackground(); #line hidden -#line 29 +#line 30 testRunner.When("I tap on the Account Info button", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden -#line 30 +#line 31 testRunner.Then("the Account Info Page is displayed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] { @@ -241,7 +243,7 @@ public void ViewMerchantDetails() "01/08/2022", "01/09/2022", "Monthly"}); -#line 31 +#line 32 testRunner.And("the Account Info is displayed", ((string)(null)), table3, "And "); #line hidden } diff --git a/TransactionMobile.Maui/MauiProgram.cs b/TransactionMobile.Maui/MauiProgram.cs index 812294ee..06772b7d 100644 --- a/TransactionMobile.Maui/MauiProgram.cs +++ b/TransactionMobile.Maui/MauiProgram.cs @@ -36,7 +36,8 @@ public static MauiApp CreateMauiApp() // Setup static logger IDatabaseContext databaseContext = MauiProgram.Container.Services.GetService(); - Logger.Initialise(new DatabaseLogger(databaseContext)); + IApplicationCache applicationCache = MauiProgram.Container.Services.GetService(); + Logger.Initialise(new DatabaseLogger(databaseContext,applicationCache)); return Container; } From a74a7425a397af6605be0313905dee63a25994be Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 26 Aug 2022 11:32:17 +0100 Subject: [PATCH 2/4] :( --- TransactionMobile.Maui.UiTests/Drivers/AppiumDriver.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TransactionMobile.Maui.UiTests/Drivers/AppiumDriver.cs b/TransactionMobile.Maui.UiTests/Drivers/AppiumDriver.cs index 4f55becb..74ea280b 100644 --- a/TransactionMobile.Maui.UiTests/Drivers/AppiumDriver.cs +++ b/TransactionMobile.Maui.UiTests/Drivers/AppiumDriver.cs @@ -79,12 +79,12 @@ private static void SetupiOSDriver(AppiumLocalService appiumService) { private static void SetupAndroidDriver(AppiumLocalService appiumService) { // Do Android stuff to start up var driverOptions = new AppiumOptions(); - driverOptions.AddAdditionalAppiumOption("adbExecTimeout", TimeSpan.FromMinutes(5).Milliseconds); + driverOptions.AddAdditionalAppiumOption("adbExecTimeout", TimeSpan.FromMinutes(5).TotalMilliseconds); driverOptions.AutomationName = "UIAutomator2"; driverOptions.PlatformName = "Android"; driverOptions.PlatformVersion = "9.0"; driverOptions.DeviceName = "emulator-5554"; - + // TODO: Only do this locally //driverOptions.AddAdditionalAppiumOption(MobileCapabilityType.FullReset, true); driverOptions.AddAdditionalAppiumOption("appPackage", "com.transactionprocessing.pos"); From acba7039c8ce185ac3d704ebee1b4d9c5acc03c6 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 26 Aug 2022 15:17:51 +0100 Subject: [PATCH 3/4] .. --- TransactionMobile.Maui.UiTests/Drivers/AppiumDriver.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TransactionMobile.Maui.UiTests/Drivers/AppiumDriver.cs b/TransactionMobile.Maui.UiTests/Drivers/AppiumDriver.cs index 74ea280b..9ff4a9c9 100644 --- a/TransactionMobile.Maui.UiTests/Drivers/AppiumDriver.cs +++ b/TransactionMobile.Maui.UiTests/Drivers/AppiumDriver.cs @@ -86,7 +86,7 @@ private static void SetupAndroidDriver(AppiumLocalService appiumService) { driverOptions.DeviceName = "emulator-5554"; // TODO: Only do this locally - //driverOptions.AddAdditionalAppiumOption(MobileCapabilityType.FullReset, true); + driverOptions.AddAdditionalAppiumOption(MobileCapabilityType.FullReset, true); driverOptions.AddAdditionalAppiumOption("appPackage", "com.transactionprocessing.pos"); //driverOptions.AddAdditionalAppiumOption("forceEspressoRebuild", true); driverOptions.AddAdditionalAppiumOption("enforceAppInstall", true); From 76e62142d05c79c0890c71b62e56b37791fb4077 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 26 Aug 2022 16:05:50 +0100 Subject: [PATCH 4/4] :| --- TransactionMobile.Maui.UiTests/Features/Profile.feature | 1 - 1 file changed, 1 deletion(-) diff --git a/TransactionMobile.Maui.UiTests/Features/Profile.feature b/TransactionMobile.Maui.UiTests/Features/Profile.feature index 782a18b9..c019c846 100644 --- a/TransactionMobile.Maui.UiTests/Features/Profile.feature +++ b/TransactionMobile.Maui.UiTests/Features/Profile.feature @@ -25,7 +25,6 @@ Scenario: View Merchant Contacts | Name | EmailAddress | MobileNumber | | Test Contact | stuart_ferguson1@outlook.com | 123456789 | -@PRTest Scenario: View Merchant Details When I tap on the Account Info button Then the Account Info Page is displayed