mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
Store centric UI: Part 3 (#3224)
* Set store context in cookie * Fix page id usages in view * Move Pay Button to nav * Move integrations to plugins nav * Store switch links to wallet if present * Test fixes * Nav fixes * Fix altcoin view * Main nav updates * Wallet setttings nav update * Move storeId cookie fallback to cookie auth handler * View fixes * Test fixes * Fix profile check * Rename integrations nav extension point to store-integrations-nav-list * Allow strings for Active page/category for plugins * Make invoice list filter based on store context * Do not set context if we are running authorizer through tag helper * Fix test and unfiltered invoices * Add permission helper for wallet links * Add sanity checks for payment requests and invoices * Store context in home controller * Fix PayjoinViaUI test * Store context for notifications * Minor UI improvements * Store context for userstores and vault controller * Bring back integrations page * Rename notifications nav pages file * Fix user stores controller policies * Controller policy fixes from code review * CookieAuthHandler: Simplify CanViewInvoices case * Revert "Controller policy fixes from code review" This reverts commit 97e8b8379c2f2f373bac15a96632d2c8913ef4bd. * Simplify LayoutSimple * Fix CanViewInvoices condition Co-authored-by: Kukks <evilkukka@gmail.com>
This commit is contained in:
@@ -332,17 +332,10 @@ namespace BTCPayServer.Tests
|
||||
Driver.FindElement(By.Id("Password")).SendKeys(password);
|
||||
Driver.FindElement(By.Id("LoginButton")).Click();
|
||||
}
|
||||
|
||||
public void GoToApps()
|
||||
{
|
||||
Driver.FindElement(By.Id("StoreNav-Apps")).Click();
|
||||
}
|
||||
|
||||
public void GoToStore(string storeId, StoreNavPages storeNavPage = StoreNavPages.PaymentMethods)
|
||||
{
|
||||
GoToHome();
|
||||
Driver.WaitForAndClick(By.Id("StoreSelectorToggle"));
|
||||
Driver.WaitForAndClick(By.Id($"StoreSelectorMenuItem-{storeId}"));
|
||||
GoToUrl($"/stores/{storeId}/");
|
||||
|
||||
if (storeNavPage != StoreNavPages.PaymentMethods)
|
||||
{
|
||||
@@ -360,8 +353,15 @@ namespace BTCPayServer.Tests
|
||||
|
||||
public void GoToWalletSettings(string storeId, string cryptoCode = "BTC")
|
||||
{
|
||||
GoToStore(storeId);
|
||||
Driver.FindElement(By.Id($"Modify{cryptoCode}")).Click();
|
||||
try
|
||||
{
|
||||
GoToStore(storeId);
|
||||
Driver.FindElement(By.Id($"Modify{cryptoCode}")).Click();
|
||||
}
|
||||
catch (NoSuchElementException)
|
||||
{
|
||||
GoToWallet(new WalletId(storeId, cryptoCode), WalletsNavPages.Settings);
|
||||
}
|
||||
}
|
||||
|
||||
public void GoToLightningSettings(string storeId, string cryptoCode = "BTC")
|
||||
@@ -377,10 +377,14 @@ namespace BTCPayServer.Tests
|
||||
CheckForJSErrors();
|
||||
}
|
||||
|
||||
public void GoToInvoices()
|
||||
public void GoToInvoice(string id)
|
||||
{
|
||||
GoToHome();
|
||||
Driver.FindElement(By.Id("Nav-Invoices")).Click();
|
||||
GoToUrl($"/invoices/{id}/");
|
||||
}
|
||||
|
||||
public void GoToInvoices(string storeId = null)
|
||||
{
|
||||
GoToUrl(storeId == null ? "/invoices/" : $"/stores/{storeId}/invoices/");
|
||||
}
|
||||
|
||||
public void GoToProfile(ManageNavPages navPages = ManageNavPages.Index)
|
||||
@@ -394,11 +398,11 @@ namespace BTCPayServer.Tests
|
||||
|
||||
public void GoToLogin()
|
||||
{
|
||||
Driver.Navigate().GoToUrl(new Uri(ServerUri, "/login"));
|
||||
GoToUrl("/login");
|
||||
}
|
||||
|
||||
public string CreateInvoice(
|
||||
string storeName,
|
||||
string storeId,
|
||||
decimal? amount = 100,
|
||||
string currency = "USD",
|
||||
string refundEmail = "",
|
||||
@@ -407,7 +411,7 @@ namespace BTCPayServer.Tests
|
||||
StatusMessageModel.StatusSeverity expectedSeverity = StatusMessageModel.StatusSeverity.Success
|
||||
)
|
||||
{
|
||||
GoToInvoices();
|
||||
GoToInvoices(storeId);
|
||||
Driver.FindElement(By.Id("CreateNewInvoice")).Click();
|
||||
if (amount is decimal v)
|
||||
Driver.FindElement(By.Id("Amount")).SendKeys(v.ToString(CultureInfo.InvariantCulture));
|
||||
@@ -415,7 +419,6 @@ namespace BTCPayServer.Tests
|
||||
currencyEl.Clear();
|
||||
currencyEl.SendKeys(currency);
|
||||
Driver.FindElement(By.Id("BuyerEmail")).SendKeys(refundEmail);
|
||||
Driver.FindElement(By.Name("StoreId")).SendKeys(storeName);
|
||||
if (defaultPaymentMethod is string)
|
||||
new SelectElement(Driver.FindElement(By.Name("DefaultPaymentMethod"))).SelectByValue(defaultPaymentMethod);
|
||||
if (requiresRefundEmail is bool)
|
||||
@@ -501,18 +504,5 @@ namespace BTCPayServer.Tests
|
||||
Driver.FindElement(By.Id($"SectionNav-{navPages}")).Click();
|
||||
}
|
||||
}
|
||||
|
||||
public void GoToInvoice(string id)
|
||||
{
|
||||
GoToInvoices();
|
||||
foreach (var el in Driver.FindElements(By.ClassName("invoice-details-link")))
|
||||
{
|
||||
if (el.GetAttribute("href").Contains(id, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
el.Click();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user