37 lines
1.7 KiB
C#
37 lines
1.7 KiB
C#
using Bunit;
|
|
using Duempelkas.App.Components;
|
|
using Duempelkas.App.Services;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Xunit;
|
|
|
|
namespace Duempelkas.Tests;
|
|
|
|
public class GettingStartedTests
|
|
{
|
|
[Fact]
|
|
public async Task Introduction_CanBeSkippedAndResumed_AndCreatesNoSampleBookings()
|
|
{
|
|
using var f = new LedgerUiFixture(false);
|
|
var navigation = f.Service<NavigationManager>();
|
|
navigation.NavigateTo("/einstieg");
|
|
var page = f.Context.Render<Routes>();
|
|
page.WaitForElement("#setup-club").Input("Mein Testverein");
|
|
page.Find(".setup-next").Click();
|
|
page.WaitForAssertion(() => Assert.Contains("Dein erstes Konto", page.Markup));
|
|
page.FindAll("button").Single(b => b.TextContent.Contains("später fortsetzen")).Click();
|
|
navigation.NavigateTo("/einstieg");
|
|
page.WaitForAssertion(() => Assert.Contains("Dein erstes Konto", page.Markup));
|
|
page.FindAll("button").Single(b => b.TextContent.Trim() == "Konto anlegen").Click();
|
|
page.Find("#account-name").Input("Barkasse");
|
|
page.Find("#account-initial").Input("25,00");
|
|
page.Find("dialog form").Submit();
|
|
page.WaitForAssertion(() => Assert.Contains("Die erste Buchung", page.Markup));
|
|
var account = Assert.Single(await f.Service<IAccountService>().GetAllAccountsAsync());
|
|
Assert.Equal(25m, account.TotalBalance);
|
|
Assert.Empty(await f.Service<IEntryService>().GetEntriesAsync(account.Id, (int?)null));
|
|
Assert.Equal(2, await f.Service<ISettingsService>().GetSetupStepAsync());
|
|
navigation.NavigateTo("/hilfe");
|
|
page.WaitForAssertion(() => Assert.Contains("auch ohne Internet", page.Markup));
|
|
}
|
|
}
|