Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ public SupportPageViewModelTests() {
}

[Fact]
public void SupportPageViewModel_UploadLogsCommand_Execute_IsExecuted()
public async Task SupportPageViewModel_UploadLogsCommand_Execute_IsExecuted()
{
this.Mediator.Setup(m => m.Send(It.IsAny<SupportCommands.UploadLogsCommand>(), It.IsAny<CancellationToken>())).ReturnsAsync(Result.Success());
this.ViewModel.UploadLogsCommand.Execute(null);
await this.ViewModel.UploadLogsCommand.ExecuteAsync(null);

this.Mediator.Verify(m => m.Send(It.IsAny<SupportCommands.UploadLogsCommand>(),It.IsAny<CancellationToken>()),Times.Once);
this.DialogService.Verify(d => d.ShowUploadLogsCompleteNotice(), Times.Once);
this.NavigationService.Verify(n => n.GoBack(), Times.Never);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Task ShowInformationToast(String message,
TimeSpan? duration = null,
CancellationToken cancellationToken = default);

Task ShowUploadLogsCompleteNotice();

Task ShowSuccessToast(String message,
Action? action = null,
String? actionButtonText = "OK",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ private async Task UploadLogs() {
var result = await this.Mediator.Send(command, CancellationToken.None);

if (result.IsSuccess) {
await this.DialogService.ShowInformationToast("Logs have been uploaded successfully.");
await this.NavigationService.GoBack();
await this.DialogService.ShowUploadLogsCompleteNotice();
} else {
await this.DialogService.ShowWarningToast("Failed to upload logs.");
}
Expand All @@ -90,4 +89,4 @@ private async Task ViewLogs() {

#endregion
}
}
}
6 changes: 0 additions & 6 deletions TransactionProcessor.Mobile.UITests/Steps/ToolbarSteps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ public async Task ThenTheSupportPageIsDisplayed(){
[When(@"I tap on the Upload Logs Button")]
public async Task WhenITapOnTheUploadLogsButton()
{
if (TransactionProcessor.Mobile.UITests.Drivers.AppiumDriverWrapper.MobileTestPlatform == TransactionProcessor.Mobile.UITests.Drivers.MobileTestPlatform.Windows)
{
Console.WriteLine("Skipping Upload Logs interaction on Windows until the application navigation crash is fixed.");
return;
}

await this.supportPage.ClickUploadLogsButton();
}

Expand Down
23 changes: 21 additions & 2 deletions TransactionProcessor.Mobile/UIServices/DialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,27 @@ await Application.Current.MainPage.DisplaySnackbar(message,
action,
actionButtonText,
duration,
SnackBarOptionsHelper.GetInfoSnackbarOptions,
cancellationToken);
SnackBarOptionsHelper.GetInfoSnackbarOptions,
cancellationToken);
}

public async Task ShowUploadLogsCompleteNotice()
{
if (OperatingSystem.IsWindows())
{
await Application.Current.MainPage.DisplayAlert(
"Logs uploaded",
"Logs have been uploaded successfully.",
"OK");
return;
}

await Application.Current.MainPage.DisplaySnackbar(
"Logs have been uploaded successfully.",
null,
"OK",
null,
SnackBarOptionsHelper.GetSuccessSnackbarOptions);
}

public async Task ShowSuccessToast(String message,
Expand Down
Loading