Fix tests (Fix #5831)

This commit is contained in:
nicolas.dorier 2024-03-13 22:29:25 +09:00
parent 22c6468a5d
commit f0f698f411
No known key found for this signature in database
GPG key ID: 6618763EF09186FE
2 changed files with 26 additions and 19 deletions

View file

@ -430,6 +430,7 @@ namespace BTCPayServer.Tests
[Fact(Timeout = TestTimeout)] [Fact(Timeout = TestTimeout)]
[Trait("Altcoins", "Altcoins")] [Trait("Altcoins", "Altcoins")]
[Trait("Lightning", "Lightning")] [Trait("Lightning", "Lightning")]
[Trait("Integration", "Integration")]
public async Task CanUsePaymentMethodDropdown() public async Task CanUsePaymentMethodDropdown()
{ {
using (var s = CreateSeleniumTester()) using (var s = CreateSeleniumTester())
@ -438,10 +439,10 @@ namespace BTCPayServer.Tests
s.Server.ActivateLightning(); s.Server.ActivateLightning();
await s.StartAsync(); await s.StartAsync();
s.GoToRegister(); s.GoToRegister();
s.RegisterNewUser(); s.RegisterNewUser(true);
s.CreateNewStore(); s.CreateNewStore();
s.AddDerivationScheme("BTC"); s.AddDerivationScheme("BTC");
s.EnableCheckout(Client.Models.CheckoutType.V1);
//check that there is no dropdown since only one payment method is set //check that there is no dropdown since only one payment method is set
var invoiceId = s.CreateInvoice(10, "USD", "a@g.com"); var invoiceId = s.CreateInvoice(10, "USD", "a@g.com");
s.GoToInvoiceCheckout(invoiceId); s.GoToInvoiceCheckout(invoiceId);
@ -454,15 +455,19 @@ namespace BTCPayServer.Tests
invoiceId = s.CreateInvoice(10, "USD", "a@g.com"); invoiceId = s.CreateInvoice(10, "USD", "a@g.com");
s.GoToInvoiceCheckout(invoiceId); s.GoToInvoiceCheckout(invoiceId);
var currencyDropdownButton = s.Driver.FindElement(By.ClassName("payment__currencies")); var currencyDropdownButton = s.Driver.FindElement(By.ClassName("payment__currencies"));
Assert.Contains("BTC", currencyDropdownButton.Text); Assert.Contains("Bitcoin", currencyDropdownButton.Text);
currencyDropdownButton.Click();
IEnumerable<IWebElement> elements = null;
TestUtils.Eventually(() =>
{
elements = s.Driver.FindElement(By.ClassName("vex-content")).FindElements(By.ClassName("vexmenuitem"));
Assert.Equal(3, elements.Count());
elements.Single(element => element.Text.Contains("Litecoin")).Click();
});
currencyDropdownButton = s.Driver.FindElement(By.ClassName("payment__currencies"));
Assert.Contains("Litecoin", currencyDropdownButton.Text);
currencyDropdownButton.Click(); currencyDropdownButton.Click();
var elements = s.Driver.FindElement(By.ClassName("vex-content")).FindElements(By.ClassName("vexmenuitem"));
Assert.Equal(3, elements.Count);
elements.Single(element => element.Text.Contains("LTC")).Click();
currencyDropdownButton = s.Driver.FindElement(By.ClassName("payment__currencies"));
Assert.Contains("LTC", currencyDropdownButton.Text);
currencyDropdownButton.Click();
elements = s.Driver.FindElement(By.ClassName("vex-content")).FindElements(By.ClassName("vexmenuitem")); elements = s.Driver.FindElement(By.ClassName("vex-content")).FindElements(By.ClassName("vexmenuitem"));
elements.Single(element => element.Text.Contains("Lightning")).Click(); elements.Single(element => element.Text.Contains("Lightning")).Click();

View file

@ -1480,6 +1480,7 @@ namespace BTCPayServer.Tests
[Fact] [Fact]
[Trait("Lightning", "Lightning")] [Trait("Lightning", "Lightning")]
[Trait("Integration", "Integration")]
public async Task CanSetPaymentMethodLimits() public async Task CanSetPaymentMethodLimits()
{ {
using var tester = CreateServerTester(); using var tester = CreateServerTester();
@ -1515,9 +1516,10 @@ namespace BTCPayServer.Tests
ItemDesc = "Some description", ItemDesc = "Some description",
FullNotifications = true FullNotifications = true
}, Facade.Merchant); }, Facade.Merchant);
// LN and LNURL
Assert.Single(invoice.CryptoInfo); Assert.Equal(2, invoice.CryptoInfo.Length);
Assert.Equal(PaymentTypes.LightningLike.ToString(), invoice.CryptoInfo[0].PaymentType); Assert.Contains(invoice.CryptoInfo, c => c.PaymentType == PaymentTypes.LNURLPay.ToString());
Assert.Contains(invoice.CryptoInfo, c => c.PaymentType == PaymentTypes.LightningLike.ToString());
// Let's replicate https://github.com/btcpayserver/btcpayserver/issues/2963 // Let's replicate https://github.com/btcpayserver/btcpayserver/issues/2963
// We allow BTC for more than 5 USD, and LN for less than 150. The default is LN, so the default // We allow BTC for more than 5 USD, and LN for less than 150. The default is LN, so the default