From 0dcf240fafe9ce1d3ad8e4deadc12b38064a0b77 Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Fri, 7 Jan 2022 17:25:28 +0100 Subject: [PATCH] Account menu improvement --- BTCPayServer.Tests/SeleniumTester.cs | 4 +- BTCPayServer.Tests/SeleniumTests.cs | 15 ++-- .../Components/MainNav/Default.cshtml | 68 ++++++++++++------- BTCPayServer/wwwroot/main/layout.css | 12 ++-- 4 files changed, 59 insertions(+), 40 deletions(-) diff --git a/BTCPayServer.Tests/SeleniumTester.cs b/BTCPayServer.Tests/SeleniumTester.cs index d6b71c94d..cd40bfc80 100644 --- a/BTCPayServer.Tests/SeleniumTester.cs +++ b/BTCPayServer.Tests/SeleniumTester.cs @@ -337,7 +337,8 @@ namespace BTCPayServer.Tests public void Logout() { - Driver.FindElement(By.Id("Logout")).Click(); + Driver.FindElement(By.Id("Nav-Account")).Click(); + Driver.FindElement(By.Id("Nav-Logout")).Click(); } public void Login(string user, string password) @@ -424,6 +425,7 @@ namespace BTCPayServer.Tests public void GoToProfile(ManageNavPages navPages = ManageNavPages.Index) { Driver.FindElement(By.Id("Nav-Account")).Click(); + Driver.FindElement(By.Id("Nav-ManageAccount")).Click(); if (navPages != ManageNavPages.Index) { Driver.FindElement(By.Id($"SectionNav-{navPages.ToString()}")).Click(); diff --git a/BTCPayServer.Tests/SeleniumTests.cs b/BTCPayServer.Tests/SeleniumTests.cs index 58ad5972b..5c09bd919 100644 --- a/BTCPayServer.Tests/SeleniumTests.cs +++ b/BTCPayServer.Tests/SeleniumTests.cs @@ -150,7 +150,7 @@ namespace BTCPayServer.Tests s.Driver.AssertNoError(); Assert.Contains("/login", s.Driver.Url); - s.Driver.Navigate().GoToUrl(s.Link("/invoices")); + s.GoToUrl("/invoices"); Assert.Contains("ReturnUrl=%2Finvoices", s.Driver.Url); // We should be redirected to login @@ -163,18 +163,17 @@ namespace BTCPayServer.Tests Assert.EndsWith("/invoices", s.Driver.Url); // Should not be able to reach server settings - s.Driver.Navigate().GoToUrl(s.Link("/server/users")); + s.GoToUrl("/server/users"); Assert.Contains("ReturnUrl=%2Fserver%2Fusers", s.Driver.Url); + s.GoToHome(); //Change Password & Log Out - s.GoToHome(); - s.Driver.FindElement(By.Id("Nav-Account")).Click(); - s.Driver.FindElement(By.Id("SectionNav-ChangePassword")).Click(); + s.GoToProfile(ManageNavPages.ChangePassword); s.Driver.FindElement(By.Id("OldPassword")).SendKeys("123456"); s.Driver.FindElement(By.Id("NewPassword")).SendKeys("abc???"); s.Driver.FindElement(By.Id("ConfirmPassword")).SendKeys("abc???"); s.Driver.FindElement(By.Id("UpdatePassword")).Click(); - s.Driver.FindElement(By.Id("Logout")).Click(); + s.Logout(); s.Driver.AssertNoError(); //Log In With New Password @@ -183,7 +182,7 @@ namespace BTCPayServer.Tests s.Driver.FindElement(By.Id("LoginButton")).Click(); Assert.True(s.Driver.PageSource.Contains("Stores"), "Can't Access Stores"); - s.Driver.FindElement(By.Id("Nav-Account")).Click(); + s.GoToProfile(); s.ClickOnAllSectionLinks(); //let's test invite link @@ -417,7 +416,7 @@ namespace BTCPayServer.Tests Assert.Contains(invoiceId, s.Driver.PageSource); // When logout out we should not be able to access store and invoice details - s.Driver.FindElement(By.Id("Logout")).Click(); + s.Logout(); s.Driver.Navigate().GoToUrl(storeUrl); Assert.Contains("ReturnUrl", s.Driver.Url); s.Driver.Navigate().GoToUrl(invoiceUrl); diff --git a/BTCPayServer/Components/MainNav/Default.cshtml b/BTCPayServer/Components/MainNav/Default.cshtml index ce4247570..637fb880c 100644 --- a/BTCPayServer/Components/MainNav/Default.cshtml +++ b/BTCPayServer/Components/MainNav/Default.cshtml @@ -217,30 +217,48 @@ } - + } diff --git a/BTCPayServer/wwwroot/main/layout.css b/BTCPayServer/wwwroot/main/layout.css index ad44070d9..9f9b6b2b0 100644 --- a/BTCPayServer/wwwroot/main/layout.css +++ b/BTCPayServer/wwwroot/main/layout.css @@ -65,7 +65,7 @@ border: none !important; } -#mainNav .navbar-nav > li.nav-item > .nav-link { +#mainNav .navbar-nav > li.nav-item .nav-link { display: inline-flex; align-items: center; font-weight: var(--btcpay-font-weight-semibold); @@ -74,14 +74,14 @@ transition-duration: var(--btcpay-transition-duration-fast); } -#mainNav .navbar-nav > li.nav-item > .nav-link:focus, -#mainNav .navbar-nav > li.nav-item > .nav-link:hover { +#mainNav .navbar-nav > li.nav-item .nav-link:focus, +#mainNav .navbar-nav > li.nav-item .nav-link:hover { color: var(--btcpay-header-link-accent); } -#mainNav .navbar-nav > li.nav-item > .nav-link.active, -#mainNav .navbar-nav > li.nav-item > .nav-link.active:focus, -#mainNav .navbar-nav > li.nav-item > .nav-link.active:hover { +#mainNav .navbar-nav > li.nav-item .nav-link.active, +#mainNav .navbar-nav > li.nav-item .nav-link.active:focus, +#mainNav .navbar-nav > li.nav-item .nav-link.active:hover { color: var(--btcpay-header-link-active); }