From 30247d6927869b9b48855db03d10af8ac0caef08 Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Thu, 24 Aug 2023 15:09:48 +0200 Subject: [PATCH] Improve sample test --- BTCPayApp.Tests/UnitTest1.cs | 21 +++++++-------------- BTCPayApp.UI/Shared/Onboarding.razor | 4 ++-- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/BTCPayApp.Tests/UnitTest1.cs b/BTCPayApp.Tests/UnitTest1.cs index f1764a2..df1dba2 100644 --- a/BTCPayApp.Tests/UnitTest1.cs +++ b/BTCPayApp.Tests/UnitTest1.cs @@ -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); } } diff --git a/BTCPayApp.UI/Shared/Onboarding.razor b/BTCPayApp.UI/Shared/Onboarding.razor index ef4d84d..06ba60c 100644 --- a/BTCPayApp.UI/Shared/Onboarding.razor +++ b/BTCPayApp.UI/Shared/Onboarding.razor @@ -30,8 +30,8 @@ Free and open-source bitcoin point of sale. With 0% Fees & No Third-party. - Pair with BTCPay Server - Use standalone + Pair with BTCPay Server + Use standalone