mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
Adding selenium test for store hints
This commit is contained in:
parent
1646241dfb
commit
ef99eeb300
@ -303,7 +303,7 @@ namespace BTCPayServer.Tests
|
||||
public string CreateInvoice(string storeName, decimal amount = 100, string currency = "USD", string refundEmail = "")
|
||||
{
|
||||
GoToInvoices();
|
||||
Driver.FindElement(By.Id("CreateNewInvoice")).Click();
|
||||
Driver.FindElement(By.Id("CreateNewInvoice")).Click(); // ocassionally gets stuck for some reason, tried force click and wait for element
|
||||
Driver.FindElement(By.Id("Amount")).SendKeys(amount.ToString(CultureInfo.InvariantCulture));
|
||||
var currencyEl = Driver.FindElement(By.Id("Currency"));
|
||||
currencyEl.Clear();
|
||||
|
@ -301,8 +301,19 @@ namespace BTCPayServer.Tests
|
||||
await s.StartAsync();
|
||||
var alice = s.RegisterNewUser();
|
||||
var store = s.CreateNewStore().storeName;
|
||||
s.AddDerivationScheme();
|
||||
// verify that hints are displayed on the store page
|
||||
Assert.True(s.Driver.PageSource.Contains("Wallet not setup for the store, please provide Derviation Scheme"),
|
||||
"Wallet hint not present");
|
||||
Assert.True(s.Driver.PageSource.Contains("Review settings if you want to receive Lightning payments"),
|
||||
"Lightning hint not present");
|
||||
|
||||
s.AddDerivationScheme(); // wallet hint should be dismissed
|
||||
s.Driver.AssertNoError();
|
||||
Assert.False(s.Driver.PageSource.Contains("Wallet not setup for the store, please provide Derviation Scheme"),
|
||||
"Wallet hint not dismissed on derivation scheme add");
|
||||
|
||||
s.Driver.FindElement(By.Id("dismissLightningHint")).Click(); // dismiss lightning hint
|
||||
|
||||
Assert.Contains(store, s.Driver.PageSource);
|
||||
var storeUrl = s.Driver.Url;
|
||||
s.ClickOnAllSideMenus();
|
||||
@ -362,6 +373,11 @@ namespace BTCPayServer.Tests
|
||||
s.Logout();
|
||||
LogIn(s, alice);
|
||||
s.Driver.FindElement(By.Id("Stores")).Click();
|
||||
|
||||
// there shouldn't be any hints now
|
||||
Assert.False(s.Driver.PageSource.Contains("Review settings if you want to receive Lightning payments"),
|
||||
"Lightning hint should be dismissed at this point");
|
||||
|
||||
s.Driver.FindElement(By.LinkText("Remove")).Click();
|
||||
s.Driver.FindElement(By.Id("continue")).Click();
|
||||
s.Driver.FindElement(By.Id("Stores")).Click();
|
||||
|
@ -167,7 +167,7 @@ namespace BTCPayServer.Controllers
|
||||
(vm.Confirmation && !string.IsNullOrWhiteSpace(vm.HintAddress)) ||
|
||||
// - The user is clicking on continue after changing the config
|
||||
(!vm.Confirmation && oldConfig != vm.Config) ||
|
||||
// - The user is clickingon continue without changing config nor enabling/disabling
|
||||
// - The user is clicking on continue without changing config nor enabling/disabling
|
||||
(!vm.Confirmation && oldConfig == vm.Config && willBeExcluded == wasExcluded);
|
||||
|
||||
showAddress = showAddress && strategy != null;
|
||||
@ -179,6 +179,7 @@ namespace BTCPayServer.Controllers
|
||||
await wallet.TrackAsync(strategy.AccountDerivation);
|
||||
store.SetSupportedPaymentMethod(paymentMethodId, strategy);
|
||||
storeBlob.SetExcluded(paymentMethodId, willBeExcluded);
|
||||
storeBlob.Hints.Wallet = false;
|
||||
store.SetStoreBlob(storeBlob);
|
||||
}
|
||||
catch
|
||||
@ -202,6 +203,7 @@ namespace BTCPayServer.Controllers
|
||||
{
|
||||
TempData[WellKnownTempData.SuccessMessage] = $"Derivation settings for {network.CryptoCode} has been modified.";
|
||||
}
|
||||
// This is success case when derivation scheme is added to the store
|
||||
return RedirectToAction(nameof(UpdateStore), new { storeId = storeId });
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(vm.HintAddress))
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-4 col-lg-6 mb-3">
|
||||
<a asp-action="CreateInvoice" class="btn btn-primary mb-1" role="button" id="CreateNewInvoice">
|
||||
<a id="CreateNewInvoice" asp-action="CreateInvoice" class="btn btn-primary mb-1">
|
||||
<span class="fa fa-plus"></span>
|
||||
Create an invoice
|
||||
</a>
|
||||
|
@ -24,7 +24,7 @@
|
||||
{
|
||||
<p class="alert alert-warning">
|
||||
<span class="fa fa-warning"></span>
|
||||
Wallet not setup for the store. Please provide Derviation Scheme
|
||||
Wallet not setup for the store, please provide Derviation Scheme
|
||||
<button type="button" class="close only-for-js" data-dismiss="alert" aria-label="Close"
|
||||
onclick="return dismissHint('Wallet', '@Model.Id');">
|
||||
<span aria-hidden="true">×</span>
|
||||
@ -108,7 +108,7 @@
|
||||
<p class="alert alert-warning">
|
||||
<span class="fa fa-warning"></span>
|
||||
Review settings if you want to receive Lightning payments
|
||||
<button type="button" class="close only-for-js" data-dismiss="alert" aria-label="Close"
|
||||
<button id="dismissLightningHint" type="button" class="close only-for-js" data-dismiss="alert" aria-label="Close"
|
||||
onclick="return dismissHint('Lightning', '@Model.Id');">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
|
Loading…
Reference in New Issue
Block a user