diff --git a/BTCPayServer.Tests/BTCPayServer.Tests.csproj b/BTCPayServer.Tests/BTCPayServer.Tests.csproj index 94d8b5623..2862819be 100644 --- a/BTCPayServer.Tests/BTCPayServer.Tests.csproj +++ b/BTCPayServer.Tests/BTCPayServer.Tests.csproj @@ -23,7 +23,7 @@ - + all diff --git a/BTCPayServer.Tests/SeleniumTester.cs b/BTCPayServer.Tests/SeleniumTester.cs index f71d29e4a..07f34a646 100644 --- a/BTCPayServer.Tests/SeleniumTester.cs +++ b/BTCPayServer.Tests/SeleniumTester.cs @@ -393,6 +393,10 @@ namespace BTCPayServer.Tests public void GoToHome() { Driver.Navigate().GoToUrl(ServerUri); + if (Driver.PageSource.Contains("id=\"SkipWizard\"")) + { + Driver.FindElement(By.Id("SkipWizard")).Click(); + } } public void Logout() diff --git a/BTCPayServer.Tests/SeleniumTests.cs b/BTCPayServer.Tests/SeleniumTests.cs index 7dfec4e75..db9b8880a 100644 --- a/BTCPayServer.Tests/SeleniumTests.cs +++ b/BTCPayServer.Tests/SeleniumTests.cs @@ -57,10 +57,11 @@ namespace BTCPayServer.Tests using var s = CreateSeleniumTester(); await s.StartAsync(); s.RegisterNewUser(true); - s.Driver.FindElement(By.Id("Nav-ServerSettings")).Click(); + s.GoToHome(); + s.GoToServer(); s.Driver.AssertNoError(); s.ClickOnAllSectionLinks(); - s.Driver.FindElement(By.Id("Nav-ServerSettings")).Click(); + s.GoToServer(); s.Driver.FindElement(By.LinkText("Services")).Click(); TestLogs.LogInformation("Let's check if we can access the logs"); @@ -247,7 +248,8 @@ namespace BTCPayServer.Tests s.Server.ActivateLightning(); await s.StartAsync(); s.RegisterNewUser(true); - s.Driver.FindElement(By.Id("Nav-ServerSettings")).Click(); + s.GoToHome(); + s.GoToServer(); s.Driver.AssertNoError(); s.Driver.FindElement(By.LinkText("Services")).Click(); @@ -314,6 +316,7 @@ namespace BTCPayServer.Tests await s.StartAsync(); //Register & Log Out var email = s.RegisterNewUser(); + s.GoToHome(); s.Logout(); s.Driver.AssertNoError(); Assert.Contains("/login", s.Driver.Url); @@ -349,6 +352,7 @@ namespace BTCPayServer.Tests s.Driver.FindElement(By.Id("Password")).SendKeys("abc???"); s.Driver.FindElement(By.Id("LoginButton")).Click(); + s.GoToHome(); s.GoToProfile(); s.ClickOnAllSectionLinks(); @@ -356,6 +360,7 @@ namespace BTCPayServer.Tests s.Logout(); s.GoToRegister(); s.RegisterNewUser(true); + s.GoToHome(); s.GoToServer(ServerNavPages.Users); s.Driver.FindElement(By.Id("CreateUser")).Click(); @@ -378,6 +383,7 @@ namespace BTCPayServer.Tests s.Driver.FindElement(By.Id("LoginButton")).Click(); // We should be logged in now + s.GoToHome(); s.Driver.FindElement(By.Id("mainNav")); //let's test delete user quickly while we're at it @@ -642,7 +648,7 @@ namespace BTCPayServer.Tests // verify redirected to create store page Assert.EndsWith("/stores/create", s.Driver.Url); Assert.Contains("Create your first store", s.Driver.PageSource); - Assert.Contains("To start accepting payments, set up a store.", s.Driver.PageSource); + Assert.Contains("Create a store to begin accepting payments", s.Driver.PageSource); Assert.False(s.Driver.PageSource.Contains("id=\"StoreSelectorDropdown\""), "Store selector dropdown should not be present"); (_, string storeId) = s.CreateNewStore(); @@ -2583,6 +2589,7 @@ namespace BTCPayServer.Tests using var s = CreateSeleniumTester(); await s.StartAsync(); var user = s.RegisterNewUser(); + s.GoToHome(); s.GoToProfile(ManageNavPages.LoginCodes); var code = s.Driver.FindElement(By.Id("logincode")).GetAttribute("value"); s.Driver.FindElement(By.Id("regeneratecode")).Click(); @@ -2594,14 +2601,12 @@ namespace BTCPayServer.Tests s.Driver.SetAttribute("LoginCode", "value", "bad code"); s.Driver.InvokeJSFunction("logincode-form", "submit"); - s.Driver.SetAttribute("LoginCode", "value", code); s.Driver.InvokeJSFunction("logincode-form", "submit"); - s.GoToProfile(); + s.GoToHome(); Assert.Contains(user, s.Driver.PageSource); } - // For god know why, selenium have problems clicking on the save button, resulting in ultimate hacks // to make it works. private void SudoForceSaveLightningSettingsRightNowAndFast(SeleniumTester s, string cryptoCode) @@ -2620,7 +2625,6 @@ retry: } } - [Fact] [Trait("Selenium", "Selenium")] public async Task CanUseLNURLAuth() @@ -2628,6 +2632,7 @@ retry: using var s = CreateSeleniumTester(); await s.StartAsync(); var user = s.RegisterNewUser(true); + s.GoToHome(); s.GoToProfile(ManageNavPages.TwoFactorAuthentication); s.Driver.FindElement(By.Name("Name")).SendKeys("ln wallet"); s.Driver.FindElement(By.Name("type")) @@ -2676,7 +2681,8 @@ retry: { using var s = CreateSeleniumTester(newDb: true); await s.StartAsync(); - var user = s.RegisterNewUser(true); + s.RegisterNewUser(true); + s.GoToHome(); s.GoToServer(ServerNavPages.Roles); var existingServerRoles = s.Driver.FindElement(By.CssSelector("table")).FindElements(By.CssSelector("tr")); Assert.Equal(3, existingServerRoles.Count); diff --git a/BTCPayServer/Controllers/UIUserStoresController.cs b/BTCPayServer/Controllers/UIUserStoresController.cs index 91b83409c..357373106 100644 --- a/BTCPayServer/Controllers/UIUserStoresController.cs +++ b/BTCPayServer/Controllers/UIUserStoresController.cs @@ -39,12 +39,12 @@ namespace BTCPayServer.Controllers [HttpGet("create")] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie, Policy = Policies.CanModifyStoreSettingsUnscoped)] - public async Task CreateStore() + public async Task CreateStore(bool skipWizard) { var stores = await _repo.GetStoresByUserId(GetUserId()); var vm = new CreateStoreViewModel { - IsFirstStore = !stores.Any(), + IsFirstStore = !(stores.Any() || skipWizard), DefaultCurrency = StoreBlob.StandardDefaultCurrency, Exchanges = GetExchangesSelectList(null) }; diff --git a/BTCPayServer/Views/UIUserStores/CreateStore.cshtml b/BTCPayServer/Views/UIUserStores/CreateStore.cshtml index 0f53f0208..974e15bb0 100644 --- a/BTCPayServer/Views/UIUserStores/CreateStore.cshtml +++ b/BTCPayServer/Views/UIUserStores/CreateStore.cshtml @@ -1,5 +1,6 @@ @model BTCPayServer.Models.StoreViewModels.CreateStoreViewModel @{ + Layout = Model.IsFirstStore ? "_LayoutWizard" : "_Layout"; ViewData.SetActivePage(StoreNavPages.Create, Model.IsFirstStore ? "Create your first store" : "Create a new store"); } @@ -18,41 +19,48 @@ } - - @if (Model.IsFirstStore) { -

@ViewData["Title"]

-

To start accepting payments, set up a store.

+ @section Navbar { + + + + } + @section PageHeadContent { + + } +
+ + + + +

@ViewData["Title"]

+

Create a store to begin accepting payments.

+ +
+ + +
+
} else {

@ViewData["Title"]

-} -
-
-
-
-
- - - -
-
- - - -
-
- - -
The recommended price source gets chosen based on the default currency.
- -
- -
- -
-
+
+
+ +
-
+} + + + + diff --git a/BTCPayServer/Views/UIUserStores/_CreateStoreForm.cshtml b/BTCPayServer/Views/UIUserStores/_CreateStoreForm.cshtml new file mode 100644 index 000000000..5d52bcaa6 --- /dev/null +++ b/BTCPayServer/Views/UIUserStores/_CreateStoreForm.cshtml @@ -0,0 +1,24 @@ +@model BTCPayServer.Models.StoreViewModels.CreateStoreViewModel + +
+
+
+ + + +
+
+ + + +
+
+ + +
The recommended price source gets chosen based on the default currency.
+ +
+
+ +
+