From c3f73c0de3821d0abfb455e0e2197eb48543013a Mon Sep 17 00:00:00 2001 From: dstrukt Date: Mon, 17 Jan 2022 17:19:27 -0800 Subject: [PATCH] Content Consistency Updates (1.4.0) (#3316) * updates * updates * updates * updates * updates * moves api key CTA to top right * updates * more updates * more updates * Fix active state when "Account" is selected * Update wording in subnav: Profile becomes Account * Fix email test * Update Emails wording * Try to fix email test * Make General first tab in store settings Co-authored-by: Dennis Reimann --- .../AltcoinTests/AltcoinTests.cs | 3 +- BTCPayServer.Tests/CheckoutUITests.cs | 5 +- BTCPayServer.Tests/SeleniumTester.cs | 32 ++--- BTCPayServer.Tests/SeleniumTests.cs | 29 +++-- .../Components/MainNav/Default.cshtml | 4 +- BTCPayServer/Views/Shared/EmailsBody.cshtml | 10 +- .../Views/UIAccount/ForgotPassword.cshtml | 2 +- .../Views/UIAccount/SetPassword.cshtml | 2 +- .../Views/UIApps/TemplateEditor.cshtml | 2 +- .../Views/UIApps/UpdateCrowdfund.cshtml | 14 +-- .../Views/UIApps/UpdatePointOfSale.cshtml | 12 +- BTCPayServer/Views/UIManage/APIKeys.cshtml | 13 +- BTCPayServer/Views/UIManage/AddApiKey.cshtml | 2 +- .../Views/UIManage/AuthorizeAPIKey.cshtml | 2 +- .../Views/UIManage/ChangePassword.cshtml | 6 +- .../Views/UIManage/ConfirmAPIKey.cshtml | 2 +- .../Views/UIManage/EnableAuthenticator.cshtml | 5 +- BTCPayServer/Views/UIManage/Index.cshtml | 4 +- BTCPayServer/Views/UIManage/LoginCodes.cshtml | 4 +- .../UIManage/NotificationSettings.cshtml | 2 +- .../Views/UIManage/SetPassword.cshtml | 2 +- .../UIManage/TwoFactorAuthentication.cshtml | 2 +- BTCPayServer/Views/UIManage/_Nav.cshtml | 2 +- .../UIServer/CLightningRestServices.cshtml | 2 +- .../Views/UIServer/ConfiguratorService.cshtml | 2 +- .../UIServer/CreateTemporaryFileUrl.cshtml | 4 +- BTCPayServer/Views/UIServer/CreateUser.cshtml | 2 +- .../Views/UIServer/DynamicDnsService.cshtml | 4 +- .../Views/UIServer/DynamicDnsServices.cshtml | 6 +- .../EditAmazonS3StorageProvider.cshtml | 2 +- ...EditAzureBlobStorageStorageProvider.cshtml | 2 +- .../EditFileSystemStorageProvider.cshtml | 2 +- ...itGoogleCloudStorageStorageProvider.cshtml | 2 +- BTCPayServer/Views/UIServer/Emails.cshtml | 2 +- BTCPayServer/Views/UIServer/Files.cshtml | 6 +- .../UIServer/LightningChargeServices.cshtml | 2 +- .../UIServer/LightningWalletServices.cshtml | 2 +- .../Views/UIServer/ListPlugins.cshtml | 4 +- BTCPayServer/Views/UIServer/ListUsers.cshtml | 2 + .../Views/UIServer/LndSeedBackup.cshtml | 2 +- .../Views/UIServer/LndServices.cshtml | 2 +- BTCPayServer/Views/UIServer/Logs.cshtml | 2 +- .../Views/UIServer/Maintenance.cshtml | 2 +- BTCPayServer/Views/UIServer/P2PService.cshtml | 2 +- BTCPayServer/Views/UIServer/Policies.cshtml | 2 +- BTCPayServer/Views/UIServer/RPCService.cshtml | 2 +- BTCPayServer/Views/UIServer/SSHService.cshtml | 2 +- BTCPayServer/Views/UIServer/Services.cshtml | 2 +- BTCPayServer/Views/UIServer/Storage.cshtml | 4 +- BTCPayServer/Views/UIServer/Theme.cshtml | 2 +- BTCPayServer/Views/UIServer/User.cshtml | 2 +- BTCPayServer/Views/UIServer/_Nav.cshtml | 2 +- .../UIShopify/EditShopifyIntegration.cshtml | 4 +- .../Views/UIStores/CheckoutAppearance.cshtml | 21 ++-- BTCPayServer/Views/UIStores/Emails.cshtml | 4 +- .../Views/UIStores/GeneralSettings.cshtml | 14 +-- .../Views/UIStores/Integrations.cshtml | 3 +- .../Views/UIStores/ModifyWebhook.cshtml | 8 +- .../Views/UIStores/PaymentMethods.cshtml | 8 +- BTCPayServer/Views/UIStores/Rates.cshtml | 11 +- BTCPayServer/Views/UIStores/StoreNavPages.cs | 2 +- .../Views/UIStores/TestWebhook.cshtml | 6 +- BTCPayServer/Views/UIStores/Webhooks.cshtml | 116 +++++++++--------- BTCPayServer/Views/UIStores/_Nav.cshtml | 2 +- 64 files changed, 220 insertions(+), 214 deletions(-) diff --git a/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs b/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs index 8167d685c..f412fb37d 100644 --- a/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs +++ b/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs @@ -16,6 +16,7 @@ using BTCPayServer.Payments.Lightning; using BTCPayServer.Services.Apps; using BTCPayServer.Services.Invoices; using BTCPayServer.Tests.Logging; +using BTCPayServer.Views.Stores; using Microsoft.AspNetCore.Mvc; using NBitcoin; using NBitcoin.Scripting.Parser; @@ -429,7 +430,7 @@ namespace BTCPayServer.Tests s.GoToInvoiceCheckout(invoiceId); s.Driver.FindElement(By.ClassName("payment__currencies_noborder")); s.GoToHome(); - s.GoToStore(); + s.GoToStore(StoreNavPages.PaymentMethods); s.AddDerivationScheme("LTC"); s.AddLightningNode(LightningConnectionType.CLightning); //there should be three now diff --git a/BTCPayServer.Tests/CheckoutUITests.cs b/BTCPayServer.Tests/CheckoutUITests.cs index 6bebeec01..4bf584d66 100644 --- a/BTCPayServer.Tests/CheckoutUITests.cs +++ b/BTCPayServer.Tests/CheckoutUITests.cs @@ -186,8 +186,7 @@ namespace BTCPayServer.Tests s.RegisterNewUser(true); s.CreateNewStore(); s.AddLightningNode(); - s.GoToStore(); - s.Driver.FindElement(By.Id("Modify-LightningBTC")).Click(); + s.GoToLightningSettings(); s.Driver.SetCheckbox(By.Id("LightningAmountInSatoshi"), true); s.Driver.FindElement(By.Id("save")).Click(); Assert.Contains("BTC Lightning settings successfully updated", s.FindAlertMessage().Text); @@ -205,7 +204,7 @@ namespace BTCPayServer.Tests s.GoToRegister(); s.RegisterNewUser(); s.CreateNewStore(); - s.GoToStore(); + s.GoToStore(StoreNavPages.PaymentMethods); s.AddDerivationScheme(); var invoiceId = s.CreateInvoice(0.001m, "BTC", "a@x.com"); var invoice = await s.Server.PayTester.InvoiceRepository.GetInvoice(invoiceId); diff --git a/BTCPayServer.Tests/SeleniumTester.cs b/BTCPayServer.Tests/SeleniumTester.cs index d9e0dfcc2..685820286 100644 --- a/BTCPayServer.Tests/SeleniumTester.cs +++ b/BTCPayServer.Tests/SeleniumTester.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; @@ -152,7 +153,7 @@ namespace BTCPayServer.Tests Driver.WaitForElement(By.Id("Name")).SendKeys(name); Driver.WaitForElement(By.Id("Create")).Click(); Driver.FindElement(By.Id("StoreNav-StoreSettings")).Click(); - Driver.FindElement(By.Id($"SectionNav-{StoreNavPages.GeneralSettings.ToString()}")).Click(); + Driver.FindElement(By.Id($"SectionNav-{StoreNavPages.General.ToString()}")).Click(); var storeId = Driver.WaitForElement(By.Id("Id")).GetAttribute("value"); Driver.FindElement(By.Id($"SectionNav-{StoreNavPages.PaymentMethods.ToString()}")).Click(); if (keepId) @@ -360,37 +361,40 @@ namespace BTCPayServer.Tests Driver.FindElement(By.Id("LoginButton")).Click(); } - public void GoToStore(StoreNavPages storeNavPage = StoreNavPages.PaymentMethods) + public void GoToStore(StoreNavPages storeNavPage = StoreNavPages.General) { GoToStore(null, storeNavPage); } - public void GoToStore(string storeId, StoreNavPages storeNavPage = StoreNavPages.PaymentMethods) + public void GoToStore(string storeId, StoreNavPages storeNavPage = StoreNavPages.General) { if (storeId is not null) GoToUrl($"/stores/{storeId}/"); Driver.FindElement(By.Id("StoreNav-StoreSettings")).Click(); - if (storeNavPage != StoreNavPages.PaymentMethods) + if (storeNavPage != StoreNavPages.General) { - // FIXME: Review and optimize this once we decided on where which items belong - try + switch (storeNavPage) { - Driver.FindElement(By.Id($"StoreNav-{storeNavPage.ToString()}")).Click(); - } - catch (NoSuchElementException) - { - Driver.FindElement(By.Id($"SectionNav-{storeNavPage.ToString()}")).Click(); + case StoreNavPages.Dashboard: + case StoreNavPages.Payouts: + case StoreNavPages.PayButton: + case StoreNavPages.PullPayments: + Driver.FindElement(By.Id($"StoreNav-{storeNavPage.ToString()}")).Click(); + break; + default: + Driver.FindElement(By.Id($"SectionNav-{storeNavPage.ToString()}")).Click(); + break; } } } - + public void GoToWalletSettings(string storeId, string cryptoCode = "BTC") { try { - GoToStore(storeId); + GoToStore(storeId, StoreNavPages.PaymentMethods); Driver.FindElement(By.Id($"Modify{cryptoCode}")).Click(); } catch (NoSuchElementException) @@ -401,7 +405,7 @@ namespace BTCPayServer.Tests public void GoToLightningSettings(string cryptoCode = "BTC") { - GoToStore(); + GoToStore(StoreNavPages.PaymentMethods); Driver.FindElement(By.Id($"StoreNav-Lightning{cryptoCode}")).Click(); } diff --git a/BTCPayServer.Tests/SeleniumTests.cs b/BTCPayServer.Tests/SeleniumTests.cs index be04beeb5..c25afbff8 100644 --- a/BTCPayServer.Tests/SeleniumTests.cs +++ b/BTCPayServer.Tests/SeleniumTests.cs @@ -274,11 +274,11 @@ namespace BTCPayServer.Tests { using var s = CreateSeleniumTester(); await s.StartAsync(); - s.RegisterNewUser(isAdmin: true); + s.RegisterNewUser(true); s.Driver.Navigate().GoToUrl(s.Link("/server/emails")); if (s.Driver.PageSource.Contains("Configured")) { - s.Driver.FindElement(By.CssSelector("button[value=\"ResetPassword\"]")).Submit(); + s.Driver.FindElement(By.Id("ResetPassword")).Submit(); s.FindAlertMessage(); } CanSetupEmailCore(s); @@ -406,7 +406,7 @@ namespace BTCPayServer.Tests Assert.True(s.Driver.PageSource.Contains(onchainHint), "Wallet hint not present"); Assert.True(s.Driver.PageSource.Contains(offchainHint), "Lightning hint not present"); - s.GoToStore(); + s.GoToStore(StoreNavPages.PaymentMethods); Assert.Contains(storeName, s.Driver.PageSource); Assert.True(s.Driver.PageSource.Contains(onchainHint), "Wallet hint should be present at this point"); Assert.True(s.Driver.PageSource.Contains(offchainHint), @@ -518,7 +518,7 @@ namespace BTCPayServer.Tests // Alice should be able to delete the store s.Logout(); s.LogIn(alice); - s.GoToStore(StoreNavPages.GeneralSettings); + s.GoToStore(StoreNavPages.General); s.Driver.FindElement(By.Id("DeleteStore")).Click(); s.Driver.WaitForElement(By.Id("ConfirmInput")).SendKeys("DELETE"); s.Driver.FindElement(By.Id("ConfirmContinue")).Click(); @@ -791,7 +791,7 @@ namespace BTCPayServer.Tests Assert.Contains(server.ServerUri.AbsoluteUri, s.Driver.PageSource); TestLogs.LogInformation("Let's see if we can generate an event"); - s.GoToStore(); + s.GoToStore(StoreNavPages.PaymentMethods); s.AddDerivationScheme(); s.CreateInvoice(); var request = await server.GetNextRequest(); @@ -840,7 +840,7 @@ namespace BTCPayServer.Tests server.Done(); TestLogs.LogInformation("Let's see if we can delete store with some webhooks inside"); - s.GoToStore(StoreNavPages.GeneralSettings); + s.GoToStore(StoreNavPages.General); s.Driver.FindElement(By.Id("DeleteStore")).Click(); s.Driver.WaitForElement(By.Id("ConfirmInput")).SendKeys("DELETE"); s.Driver.FindElement(By.Id("ConfirmContinue")).Click(); @@ -913,7 +913,7 @@ namespace BTCPayServer.Tests receiveAddr = s.Driver.FindElement(By.Id("address")).GetAttribute("value"); //change the wallet and ensure old address is not there and generating a new one does not result in the prev one - s.GoToStore(storeId); + s.GoToStore(storeId, StoreNavPages.PaymentMethods); s.GenerateWallet(cryptoCode, "", true); s.Driver.FindElement(By.Id($"StoreNav-Wallet{cryptoCode}")).Click(); s.Driver.FindElement(By.Id("SectionNav-Receive")).Click(); @@ -929,7 +929,7 @@ namespace BTCPayServer.Tests var result = await s.Server.ExplorerNode.GetAddressInfoAsync(BitcoinAddress.Create(address, Network.RegTest)); Assert.True(result.IsWatchOnly); - s.GoToStore(storeId); + s.GoToStore(storeId, StoreNavPages.PaymentMethods); var mnemonic = s.GenerateWallet(cryptoCode, "", true, true); //lets import and save private keys @@ -1302,7 +1302,7 @@ namespace BTCPayServer.Tests s.RegisterNewUser(true); s.CreateNewStore(); - s.GoToStore(); + s.GoToStore(StoreNavPages.PaymentMethods); s.AddLightningNode(LightningConnectionType.CLightning, false); s.GoToLightningSettings(); s.Driver.SetCheckbox(By.Id("LNURLEnabled"), true); @@ -1345,7 +1345,7 @@ namespace BTCPayServer.Tests s.RegisterNewUser(true); (_, string storeId) = s.CreateNewStore(); var network = s.Server.NetworkProvider.GetNetwork(cryptoCode).NBitcoinNetwork; - s.GoToStore(); + s.GoToStore(StoreNavPages.PaymentMethods); s.AddLightningNode(LightningConnectionType.CLightning, false); s.GoToLightningSettings(); // LNURL is false by default @@ -1539,7 +1539,7 @@ namespace BTCPayServer.Tests //ensure ln address is not available as Lightning is not enable s.Driver.AssertElementNotFound(By.Id("StoreNav-LightningAddress")); - s.GoToStore(s.StoreId); + s.GoToStore(s.StoreId, StoreNavPages.PaymentMethods); s.AddLightningNode(LightningConnectionType.LndREST, false); //ensure ln address is not available as lnurl is not configured s.Driver.AssertElementNotFound(By.Id("StoreNav-LightningAddress")); @@ -1709,18 +1709,17 @@ retry: { s.Driver.FindElement(By.Id("QuickFillDropdownToggle")).Click(); s.Driver.FindElement(By.CssSelector("#quick-fill .dropdown-menu .dropdown-item:first-child")).Click(); - s.Driver.FindElement(By.Id("Settings_Login")).SendKeys("test@gmail.com"); s.Driver.FindElement(By.CssSelector("button[value=\"Save\"]")).Submit(); s.FindAlertMessage(); s.Driver.FindElement(By.Id("Settings_Password")).SendKeys("mypassword"); - s.Driver.FindElement(By.CssSelector("button[value=\"Save\"]")).Submit(); + s.Driver.FindElement(By.Id("Save")).SendKeys(Keys.Enter); Assert.Contains("Configured", s.Driver.PageSource); s.Driver.FindElement(By.Id("Settings_Login")).SendKeys("test_fix@gmail.com"); - s.Driver.FindElement(By.CssSelector("button[value=\"Save\"]")).Submit(); + s.Driver.FindElement(By.Id("Save")).SendKeys(Keys.Enter); Assert.Contains("Configured", s.Driver.PageSource); Assert.Contains("test_fix", s.Driver.PageSource); - s.Driver.FindElement(By.CssSelector("button[value=\"ResetPassword\"]")).Submit(); + s.Driver.FindElement(By.Id("ResetPassword")).SendKeys(Keys.Enter); s.FindAlertMessage(); Assert.DoesNotContain("Configured", s.Driver.PageSource); Assert.Contains("test_fix", s.Driver.PageSource); diff --git a/BTCPayServer/Components/MainNav/Default.cshtml b/BTCPayServer/Components/MainNav/Default.cshtml index 94d269d16..9219590a7 100644 --- a/BTCPayServer/Components/MainNav/Default.cshtml +++ b/BTCPayServer/Components/MainNav/Default.cshtml @@ -35,7 +35,7 @@