Skip to content

Commit

Permalink
Improve sample test
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisreimann committed Aug 24, 2023
1 parent ce78e40 commit 30247d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
21 changes: 7 additions & 14 deletions BTCPayApp.Tests/UnitTest1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,18 @@ public UnitTest1(ITestOutputHelper testOutputHelper)
}

[Fact]
public async Task Test1()
public async Task TestHomePage()
{
await using var factory = new BTCPayAppTestServer(_testOutputHelper);
var page = await (await factory.InitializeAsync()).NewPageAsync();
await page.GotoAsync(factory.ServerAddress);
factory.Eventually(() =>
{
Assert.EndsWith(Routes.Home, page.Url);
});
Assert.EndsWith(Routes.Home, page.Url);

Thread.Sleep(3000);
var carousel = await page.QuerySelectorAsync("#OnboardingCarousel");
await (await carousel.QuerySelectorAsync("[aria-label='3']")).ClickAsync();
Thread.Sleep(3000);
await (await page.QuerySelectorAsync("#PairButton")).ClickAsync();
factory.Eventually(() =>
{
Assert.EndsWith(Routes.Pair, page.Url);
});
var carousel = page.Locator("#OnboardingCarousel");
await carousel.Locator("[aria-label='3']").ClickAsync();
Assert.True(await carousel.GetByTestId("StandaloneButton").IsDisabledAsync());

await carousel.GetByTestId("PairButton").ClickAsync();
Assert.EndsWith(Routes.Pair, page.Url);
}
}
4 changes: 2 additions & 2 deletions BTCPayApp.UI/Shared/Onboarding.razor
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
<MudText Typo="Typo.subtitle1" Align="Align.Center" Class="flex-grow-1">
Free and open-source bitcoin point of sale. With 0% Fees & No Third-party.
</MudText>
<MudButton Size="Size.Large" Variant="Variant.Filled" Color="Color.Primary" Href="@Routes.Pair" id="PairButton">Pair with BTCPay Server</MudButton>
<MudButton Size="Size.Large" Variant="Variant.Filled" Color="Color.Primary" Href="@Routes.Standalone" Disabled="true" id="StandaloneButton">Use standalone</MudButton>
<MudButton Size="Size.Large" Variant="Variant.Filled" Color="Color.Primary" Href="@Routes.Pair" data-testid="PairButton">Pair with BTCPay Server</MudButton>
<MudButton Size="Size.Large" Variant="Variant.Filled" Color="Color.Primary" Href="@Routes.Standalone" Disabled="true" data-testid="StandaloneButton">Use standalone</MudButton>
</MudContainer>
</MudCarouselItem>
</MudCarousel>
Expand Down

0 comments on commit 30247d6

Please sign in to comment.