Fix default payment bug (#2975)

* Fix default payment bug

This attempts to fix the default payment bug described in #2963.

Update to complete #2986

This takes into account #2986 and @NicolasDorier 's suggestion to add a default payment type as an empty (valueless) option that is selected by default.

* Fix tests

Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
This commit is contained in:
Samuel B. Atwood
2021-10-20 01:34:04 -04:00
committed by GitHub
parent 791d0abb34
commit 5655f22397
2 changed files with 7 additions and 3 deletions

View File

@@ -21,6 +21,7 @@ using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.Extensions;
using Xunit;
using OpenQA.Selenium.Support.UI;
namespace BTCPayServer.Tests
{
@@ -352,7 +353,7 @@ namespace BTCPayServer.Tests
decimal? amount = 100,
string currency = "USD",
string refundEmail = "",
string defaultPaymentMethod = "BTC"
string defaultPaymentMethod = null
)
{
GoToInvoices();
@@ -364,7 +365,8 @@ namespace BTCPayServer.Tests
currencyEl.SendKeys(currency);
Driver.FindElement(By.Id("BuyerEmail")).SendKeys(refundEmail);
Driver.FindElement(By.Name("StoreId")).SendKeys(storeName);
Driver.FindElement(By.Name("DefaultPaymentMethod")).SendKeys(defaultPaymentMethod);
if (defaultPaymentMethod is string)
new SelectElement(Driver.FindElement(By.Name("DefaultPaymentMethod"))).SelectByValue(defaultPaymentMethod);
Driver.FindElement(By.Id("Create")).Click();
var statusElement = FindAlertMessage();