mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-19 05:33:31 +01:00
Cleanups, remove WaitForPageLoad hack
This commit is contained in:
parent
e567f7a80c
commit
8bea1505dd
@ -7,29 +7,14 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
using OpenQA.Selenium;
|
using OpenQA.Selenium;
|
||||||
using OpenQA.Selenium.Support.UI;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace BTCPayServer.Tests
|
namespace BTCPayServer.Tests
|
||||||
{
|
{
|
||||||
public static class Extensions
|
public static class Extensions
|
||||||
{
|
{
|
||||||
private static readonly JsonSerializerSettings jsonSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() };
|
private static readonly JsonSerializerSettings JsonSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() };
|
||||||
public static string ToJson(this object o)
|
public static string ToJson(this object o) => JsonConvert.SerializeObject(o, Formatting.None, JsonSettings);
|
||||||
{
|
|
||||||
var res = JsonConvert.SerializeObject(o, Formatting.None, jsonSettings);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void WaitForPageLoad(this IWebDriver driver)
|
|
||||||
{
|
|
||||||
// Yes, this sucks big time, but it ensures that the JS after it
|
|
||||||
// does not get executed in the old page context. Bad, I know.
|
|
||||||
// Thread.Sleep(TimeSpan.FromMilliseconds(250));
|
|
||||||
//
|
|
||||||
// new WebDriverWait(driver, SeleniumTester.ImplicitWait)
|
|
||||||
// .Until(d=>((IJavaScriptExecutor)d).ExecuteScript("return (document.readyState === 'complete' && (typeof(jQuery) === 'undefined' || jQuery.isReady))").Equals(true));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void LogIn(this SeleniumTester s, string email)
|
public static void LogIn(this SeleniumTester s, string email)
|
||||||
{
|
{
|
||||||
@ -65,14 +50,18 @@ namespace BTCPayServer.Tests
|
|||||||
builder.AppendLine($"[{entry.Level}]: {entry.Message}");
|
builder.AppendLine($"[{entry.Level}]: {entry.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { }
|
catch
|
||||||
builder.AppendLine($"---------");
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.AppendLine("---------");
|
||||||
}
|
}
|
||||||
Logs.Tester.LogInformation(builder.ToString());
|
Logs.Tester.LogInformation(builder.ToString());
|
||||||
builder = new StringBuilder();
|
builder = new StringBuilder();
|
||||||
builder.AppendLine($"Selenium [Sources]:");
|
builder.AppendLine("Selenium [Sources]:");
|
||||||
builder.AppendLine(driver.PageSource);
|
builder.AppendLine(driver.PageSource);
|
||||||
builder.AppendLine($"---------");
|
builder.AppendLine("---------");
|
||||||
Logs.Tester.LogInformation(builder.ToString());
|
Logs.Tester.LogInformation(builder.ToString());
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
@ -260,13 +260,9 @@ namespace BTCPayServer.Tests
|
|||||||
Assert.False(string.IsNullOrEmpty(s.Driver.FindElement(By.Id("PayJoinBIP21"))
|
Assert.False(string.IsNullOrEmpty(s.Driver.FindElement(By.Id("PayJoinBIP21"))
|
||||||
.GetAttribute("value")));
|
.GetAttribute("value")));
|
||||||
s.Driver.FindElement(By.Id("SendMenu")).Click();
|
s.Driver.FindElement(By.Id("SendMenu")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
var nbxSeedButton = s.Driver.FindElement(By.CssSelector("button[value=nbx-seed]"));
|
var nbxSeedButton = s.Driver.FindElement(By.CssSelector("button[value=nbx-seed]"));
|
||||||
new WebDriverWait(s.Driver, SeleniumTester.ImplicitWait).Until(d=> nbxSeedButton.Enabled);
|
new WebDriverWait(s.Driver, SeleniumTester.ImplicitWait).Until(d=> nbxSeedButton.Enabled);
|
||||||
nbxSeedButton.Click();
|
nbxSeedButton.Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
await s.Server.WaitForEvent<NewOnChainTransactionEvent>(() =>
|
await s.Server.WaitForEvent<NewOnChainTransactionEvent>(() =>
|
||||||
{
|
{
|
||||||
s.Driver.FindElement(By.CssSelector("button[value=payjoin]")).Click();
|
s.Driver.FindElement(By.CssSelector("button[value=payjoin]")).Click();
|
||||||
|
@ -3,13 +3,10 @@ using System.Globalization;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using BTCPayServer;
|
|
||||||
using BTCPayServer.Abstractions.Models;
|
using BTCPayServer.Abstractions.Models;
|
||||||
using BTCPayServer.Lightning;
|
using BTCPayServer.Lightning;
|
||||||
using BTCPayServer.Lightning.CLightning;
|
using BTCPayServer.Lightning.CLightning;
|
||||||
using BTCPayServer.Models;
|
|
||||||
using BTCPayServer.Services;
|
using BTCPayServer.Services;
|
||||||
using BTCPayServer.Tests.Logging;
|
using BTCPayServer.Tests.Logging;
|
||||||
using BTCPayServer.Views.Manage;
|
using BTCPayServer.Views.Manage;
|
||||||
@ -19,8 +16,6 @@ using BTCPayServer.Views.Wallets;
|
|||||||
using NBitcoin;
|
using NBitcoin;
|
||||||
using OpenQA.Selenium;
|
using OpenQA.Selenium;
|
||||||
using OpenQA.Selenium.Chrome;
|
using OpenQA.Selenium.Chrome;
|
||||||
using OpenQA.Selenium.Interactions;
|
|
||||||
using OpenQA.Selenium.Support.UI;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace BTCPayServer.Tests
|
namespace BTCPayServer.Tests
|
||||||
@ -31,6 +26,8 @@ namespace BTCPayServer.Tests
|
|||||||
public ServerTester Server { get; set; }
|
public ServerTester Server { get; set; }
|
||||||
public WalletId WalletId { get; set; }
|
public WalletId WalletId { get; set; }
|
||||||
|
|
||||||
|
public string StoreId { get; set; }
|
||||||
|
|
||||||
public static SeleniumTester Create([CallerMemberNameAttribute] string scope = null, bool newDb = false) =>
|
public static SeleniumTester Create([CallerMemberNameAttribute] string scope = null, bool newDb = false) =>
|
||||||
new SeleniumTester { Server = ServerTester.Create(scope, newDb) };
|
new SeleniumTester { Server = ServerTester.Create(scope, newDb) };
|
||||||
|
|
||||||
@ -95,26 +92,17 @@ namespace BTCPayServer.Tests
|
|||||||
public (string storeName, string storeId) CreateNewStore()
|
public (string storeName, string storeId) CreateNewStore()
|
||||||
{
|
{
|
||||||
Driver.FindElement(By.Id("Stores")).Click();
|
Driver.FindElement(By.Id("Stores")).Click();
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
Driver.FindElement(By.Id("CreateStore")).Click();
|
Driver.FindElement(By.Id("CreateStore")).Click();
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
var name = "Store" + RandomUtils.GetUInt64();
|
var name = "Store" + RandomUtils.GetUInt64();
|
||||||
Driver.FindElement(By.Id("Name")).SendKeys(name);
|
Driver.FindElement(By.Id("Name")).SendKeys(name);
|
||||||
Driver.FindElement(By.Id("Create")).Click();
|
Driver.FindElement(By.Id("Create")).Click();
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
StoreId = Driver.FindElement(By.Id("Id")).GetAttribute("value");
|
StoreId = Driver.FindElement(By.Id("Id")).GetAttribute("value");
|
||||||
return (name, StoreId);
|
return (name, StoreId);
|
||||||
}
|
}
|
||||||
public string StoreId { get; set; }
|
|
||||||
|
|
||||||
public Mnemonic GenerateWallet(string cryptoCode = "BTC", string seed = "", bool importkeys = false, bool privkeys = false, ScriptPubKeyType format = ScriptPubKeyType.Segwit)
|
public Mnemonic GenerateWallet(string cryptoCode = "BTC", string seed = "", bool importkeys = false, bool privkeys = false, ScriptPubKeyType format = ScriptPubKeyType.Segwit)
|
||||||
{
|
{
|
||||||
Driver.FindElement(By.Id($"Modify{cryptoCode}")).Click();
|
Driver.FindElement(By.Id($"Modify{cryptoCode}")).Click();
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
Driver.FindElement(By.Id("import-from-btn")).Click();
|
Driver.FindElement(By.Id("import-from-btn")).Click();
|
||||||
Driver.FindElement(By.Id("nbxplorergeneratewalletbtn")).Click();
|
Driver.FindElement(By.Id("nbxplorergeneratewalletbtn")).Click();
|
||||||
Driver.FindElement(By.Id("ExistingMnemonic")).SendKeys(seed);
|
Driver.FindElement(By.Id("ExistingMnemonic")).SendKeys(seed);
|
||||||
@ -141,21 +129,15 @@ namespace BTCPayServer.Tests
|
|||||||
public void AddDerivationScheme(string cryptoCode = "BTC", string derivationScheme = "xpub661MyMwAqRbcGABgHMUXDzPzH1tU7eZaAaJQXhDXsSxsqyQzQeU6kznNfSuAyqAK9UaWSaZaMFdNiY5BCF4zBPAzSnwfUAwUhwttuAKwfRX-[legacy]")
|
public void AddDerivationScheme(string cryptoCode = "BTC", string derivationScheme = "xpub661MyMwAqRbcGABgHMUXDzPzH1tU7eZaAaJQXhDXsSxsqyQzQeU6kznNfSuAyqAK9UaWSaZaMFdNiY5BCF4zBPAzSnwfUAwUhwttuAKwfRX-[legacy]")
|
||||||
{
|
{
|
||||||
Driver.FindElement(By.Id($"Modify{cryptoCode}")).Click();
|
Driver.FindElement(By.Id($"Modify{cryptoCode}")).Click();
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
Driver.FindElement(By.ClassName("store-derivation-scheme")).SendKeys(derivationScheme);
|
Driver.FindElement(By.ClassName("store-derivation-scheme")).SendKeys(derivationScheme);
|
||||||
Driver.FindElement(By.Id("Continue")).Click();
|
Driver.FindElement(By.Id("Continue")).Click();
|
||||||
Driver.WaitForPageLoad();
|
Driver.FindElement(By.Id("Confirm")).Click();
|
||||||
|
|
||||||
var confirmButton = Driver.FindElement(By.Id("Confirm"));
|
|
||||||
new WebDriverWait(Driver, ImplicitWait).Until(d=>confirmButton.Enabled);
|
|
||||||
confirmButton.Click();
|
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
FindAlertMessage();
|
FindAlertMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddLightningNode(string cryptoCode, LightningConnectionType connectionType)
|
public void AddLightningNode(string cryptoCode, LightningConnectionType connectionType)
|
||||||
{
|
{
|
||||||
string connectionString = null;
|
string connectionString;
|
||||||
if (connectionType == LightningConnectionType.Charge)
|
if (connectionType == LightningConnectionType.Charge)
|
||||||
connectionString = $"type=charge;server={Server.MerchantCharge.Client.Uri.AbsoluteUri};allowinsecure=true";
|
connectionString = $"type=charge;server={Server.MerchantCharge.Client.Uri.AbsoluteUri};allowinsecure=true";
|
||||||
else if (connectionType == LightningConnectionType.CLightning)
|
else if (connectionType == LightningConnectionType.CLightning)
|
||||||
@ -186,7 +168,6 @@ namespace BTCPayServer.Tests
|
|||||||
{
|
{
|
||||||
Logs.Tester.LogInformation($"Checking no error on {l}");
|
Logs.Tester.LogInformation($"Checking no error on {l}");
|
||||||
Driver.Navigate().GoToUrl(l);
|
Driver.Navigate().GoToUrl(l);
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
Driver.AssertNoError();
|
Driver.AssertNoError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,11 +180,15 @@ namespace BTCPayServer.Tests
|
|||||||
{
|
{
|
||||||
Driver.Quit();
|
Driver.Quit();
|
||||||
}
|
}
|
||||||
catch { }
|
catch
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
|
||||||
Driver.Dispose();
|
Driver.Dispose();
|
||||||
}
|
}
|
||||||
if (Server != null)
|
|
||||||
Server.Dispose();
|
Server?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void AssertNotFound()
|
internal void AssertNotFound()
|
||||||
@ -236,24 +221,18 @@ namespace BTCPayServer.Tests
|
|||||||
public void GoToStore(string storeId, StoreNavPages storeNavPage = StoreNavPages.Index)
|
public void GoToStore(string storeId, StoreNavPages storeNavPage = StoreNavPages.Index)
|
||||||
{
|
{
|
||||||
Driver.FindElement(By.Id("Stores")).Click();
|
Driver.FindElement(By.Id("Stores")).Click();
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
Driver.FindElement(By.Id($"update-store-{storeId}")).Click();
|
Driver.FindElement(By.Id($"update-store-{storeId}")).Click();
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
if (storeNavPage != StoreNavPages.Index)
|
if (storeNavPage != StoreNavPages.Index)
|
||||||
{
|
{
|
||||||
Driver.FindElement(By.Id(storeNavPage.ToString())).Click();
|
Driver.FindElement(By.Id(storeNavPage.ToString())).Click();
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GoToInvoiceCheckout(string invoiceId)
|
public void GoToInvoiceCheckout(string invoiceId)
|
||||||
{
|
{
|
||||||
Driver.FindElement(By.Id("Invoices")).Click();
|
Driver.FindElement(By.Id("Invoices")).Click();
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
Driver.FindElement(By.Id($"invoice-checkout-{invoiceId}")).Click();
|
Driver.FindElement(By.Id($"invoice-checkout-{invoiceId}")).Click();
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
CheckForJSErrors();
|
CheckForJSErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,7 +279,6 @@ namespace BTCPayServer.Tests
|
|||||||
{
|
{
|
||||||
GoToInvoices();
|
GoToInvoices();
|
||||||
Driver.FindElement(By.Id("CreateNewInvoice")).Click();
|
Driver.FindElement(By.Id("CreateNewInvoice")).Click();
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
Driver.FindElement(By.Id("Amount")).SendKeys(amount.ToString(CultureInfo.InvariantCulture));
|
Driver.FindElement(By.Id("Amount")).SendKeys(amount.ToString(CultureInfo.InvariantCulture));
|
||||||
var currencyEl = Driver.FindElement(By.Id("Currency"));
|
var currencyEl = Driver.FindElement(By.Id("Currency"));
|
||||||
currencyEl.Clear();
|
currencyEl.Clear();
|
||||||
@ -335,7 +313,7 @@ namespace BTCPayServer.Tests
|
|||||||
.GetAttribute("href");
|
.GetAttribute("href");
|
||||||
Assert.Contains($"{PayjoinClient.BIP21EndpointKey}", bip21);
|
Assert.Contains($"{PayjoinClient.BIP21EndpointKey}", bip21);
|
||||||
|
|
||||||
GoToWallet(walletId, WalletsNavPages.Send);
|
GoToWallet(walletId);
|
||||||
Driver.FindElement(By.Id("bip21parse")).Click();
|
Driver.FindElement(By.Id("bip21parse")).Click();
|
||||||
Driver.SwitchTo().Alert().SendKeys(bip21);
|
Driver.SwitchTo().Alert().SendKeys(bip21);
|
||||||
Driver.SwitchTo().Alert().Accept();
|
Driver.SwitchTo().Alert().Accept();
|
||||||
@ -371,28 +349,23 @@ namespace BTCPayServer.Tests
|
|||||||
{
|
{
|
||||||
walletId ??= WalletId;
|
walletId ??= WalletId;
|
||||||
Driver.Navigate().GoToUrl(new Uri(Server.PayTester.ServerUri, $"wallets/{walletId}"));
|
Driver.Navigate().GoToUrl(new Uri(Server.PayTester.ServerUri, $"wallets/{walletId}"));
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
if (navPages != WalletsNavPages.Transactions)
|
if (navPages != WalletsNavPages.Transactions)
|
||||||
{
|
{
|
||||||
Driver.FindElement(By.Id($"Wallet{navPages}")).Click();
|
Driver.FindElement(By.Id($"Wallet{navPages}")).Click();
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GoToUrl(string relativeUrl)
|
public void GoToUrl(string relativeUrl)
|
||||||
{
|
{
|
||||||
Driver.Navigate().GoToUrl(new Uri(Server.PayTester.ServerUri, relativeUrl));
|
Driver.Navigate().GoToUrl(new Uri(Server.PayTester.ServerUri, relativeUrl));
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GoToServer(ServerNavPages navPages = ServerNavPages.Index)
|
public void GoToServer(ServerNavPages navPages = ServerNavPages.Index)
|
||||||
{
|
{
|
||||||
Driver.FindElement(By.Id("ServerSettings")).Click();
|
Driver.FindElement(By.Id("ServerSettings")).Click();
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
if (navPages != ServerNavPages.Index)
|
if (navPages != ServerNavPages.Index)
|
||||||
{
|
{
|
||||||
Driver.FindElement(By.Id($"Server-{navPages}")).Click();
|
Driver.FindElement(By.Id($"Server-{navPages}")).Click();
|
||||||
Driver.WaitForPageLoad();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,12 +3,10 @@ using System.Globalization;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using BTCPayServer.Abstractions.Models;
|
using BTCPayServer.Abstractions.Models;
|
||||||
using BTCPayServer.Client.Models;
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
using BTCPayServer.Models;
|
|
||||||
using BTCPayServer.Services.Wallets;
|
using BTCPayServer.Services.Wallets;
|
||||||
using BTCPayServer.Tests.Logging;
|
using BTCPayServer.Tests.Logging;
|
||||||
using BTCPayServer.Views.Server;
|
using BTCPayServer.Views.Server;
|
||||||
@ -17,16 +15,13 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using NBitcoin;
|
using NBitcoin;
|
||||||
using NBitcoin.DataEncoders;
|
using NBitcoin.DataEncoders;
|
||||||
using NBitcoin.Payment;
|
using NBitcoin.Payment;
|
||||||
using NBitpayClient;
|
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using OpenQA.Selenium;
|
using OpenQA.Selenium;
|
||||||
using OpenQA.Selenium.Support.Extensions;
|
using OpenQA.Selenium.Support.Extensions;
|
||||||
using OpenQA.Selenium.Support.UI;
|
using OpenQA.Selenium.Support.UI;
|
||||||
using Org.BouncyCastle.Ocsp;
|
|
||||||
using Renci.SshNet.Security.Cryptography;
|
using Renci.SshNet.Security.Cryptography;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
using Xunit.Sdk;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Tests
|
namespace BTCPayServer.Tests
|
||||||
{
|
{
|
||||||
@ -144,7 +139,7 @@ namespace BTCPayServer.Tests
|
|||||||
//let's test invite link
|
//let's test invite link
|
||||||
s.Logout();
|
s.Logout();
|
||||||
s.GoToRegister();
|
s.GoToRegister();
|
||||||
var newAdminUser = s.RegisterNewUser(true);
|
s.RegisterNewUser(true);
|
||||||
s.GoToServer(ServerNavPages.Users);
|
s.GoToServer(ServerNavPages.Users);
|
||||||
s.Driver.FindElement(By.Id("CreateUser")).Click();
|
s.Driver.FindElement(By.Id("CreateUser")).Click();
|
||||||
|
|
||||||
@ -152,7 +147,7 @@ namespace BTCPayServer.Tests
|
|||||||
s.Driver.FindElement(By.Id("Email")).SendKeys(usr);
|
s.Driver.FindElement(By.Id("Email")).SendKeys(usr);
|
||||||
s.Driver.FindElement(By.Id("Save")).Click();
|
s.Driver.FindElement(By.Id("Save")).Click();
|
||||||
var url = s.FindAlertMessage().FindElement(By.TagName("a")).Text;
|
var url = s.FindAlertMessage().FindElement(By.TagName("a")).Text;
|
||||||
;
|
|
||||||
s.Logout();
|
s.Logout();
|
||||||
s.Driver.Navigate().GoToUrl(url);
|
s.Driver.Navigate().GoToUrl(url);
|
||||||
Assert.Equal("hidden", s.Driver.FindElement(By.Id("Email")).GetAttribute("type"));
|
Assert.Equal("hidden", s.Driver.FindElement(By.Id("Email")).GetAttribute("type"));
|
||||||
@ -177,9 +172,8 @@ namespace BTCPayServer.Tests
|
|||||||
using (var s = SeleniumTester.Create())
|
using (var s = SeleniumTester.Create())
|
||||||
{
|
{
|
||||||
await s.StartAsync();
|
await s.StartAsync();
|
||||||
var alice = s.RegisterNewUser(isAdmin: true);
|
s.RegisterNewUser(isAdmin: true);
|
||||||
s.Driver.Navigate().GoToUrl(s.Link("/server/services"));
|
s.Driver.Navigate().GoToUrl(s.Link("/server/services"));
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
Assert.Contains("server/services/ssh", s.Driver.PageSource);
|
Assert.Contains("server/services/ssh", s.Driver.PageSource);
|
||||||
using (var client = await s.Server.PayTester.GetService<Configuration.BTCPayServerOptions>().SSHSettings.ConnectAsync())
|
using (var client = await s.Server.PayTester.GetService<Configuration.BTCPayServerOptions>().SSHSettings.ConnectAsync())
|
||||||
{
|
{
|
||||||
@ -215,7 +209,7 @@ namespace BTCPayServer.Tests
|
|||||||
using (var s = SeleniumTester.Create())
|
using (var s = SeleniumTester.Create())
|
||||||
{
|
{
|
||||||
await s.StartAsync();
|
await s.StartAsync();
|
||||||
var alice = s.RegisterNewUser(isAdmin: true);
|
s.RegisterNewUser(isAdmin: true);
|
||||||
s.Driver.Navigate().GoToUrl(s.Link("/server/emails"));
|
s.Driver.Navigate().GoToUrl(s.Link("/server/emails"));
|
||||||
if (s.Driver.PageSource.Contains("Configured"))
|
if (s.Driver.PageSource.Contains("Configured"))
|
||||||
{
|
{
|
||||||
@ -235,7 +229,7 @@ namespace BTCPayServer.Tests
|
|||||||
using (var s = SeleniumTester.Create())
|
using (var s = SeleniumTester.Create())
|
||||||
{
|
{
|
||||||
await s.StartAsync();
|
await s.StartAsync();
|
||||||
var alice = s.RegisterNewUser(isAdmin: true);
|
s.RegisterNewUser(isAdmin: true);
|
||||||
s.Driver.Navigate().GoToUrl(s.Link("/server/services"));
|
s.Driver.Navigate().GoToUrl(s.Link("/server/services"));
|
||||||
Assert.Contains("Dynamic DNS", s.Driver.PageSource);
|
Assert.Contains("Dynamic DNS", s.Driver.PageSource);
|
||||||
|
|
||||||
@ -265,7 +259,6 @@ namespace BTCPayServer.Tests
|
|||||||
s.Driver.FindElement(By.Id("Settings_Hostname")).SendKeys("pouet.hello.com");
|
s.Driver.FindElement(By.Id("Settings_Hostname")).SendKeys("pouet.hello.com");
|
||||||
s.Driver.FindElement(By.Id("Settings_Login")).SendKeys("MyLog");
|
s.Driver.FindElement(By.Id("Settings_Login")).SendKeys("MyLog");
|
||||||
s.Driver.FindElement(By.Id("Settings_Password")).SendKeys("MyLog" + Keys.Enter);
|
s.Driver.FindElement(By.Id("Settings_Password")).SendKeys("MyLog" + Keys.Enter);
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
s.Driver.AssertNoError();
|
s.Driver.AssertNoError();
|
||||||
Assert.Contains("This hostname already exists", s.Driver.PageSource);
|
Assert.Contains("This hostname already exists", s.Driver.PageSource);
|
||||||
|
|
||||||
@ -314,14 +307,12 @@ namespace BTCPayServer.Tests
|
|||||||
s.GoToInvoices();
|
s.GoToInvoices();
|
||||||
var invoiceId = s.CreateInvoice(storeData.storeName);
|
var invoiceId = s.CreateInvoice(storeData.storeName);
|
||||||
s.FindAlertMessage();
|
s.FindAlertMessage();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
s.Driver.FindElement(By.ClassName("invoice-details-link")).Click();
|
s.Driver.FindElement(By.ClassName("invoice-details-link")).Click();
|
||||||
var invoiceUrl = s.Driver.Url;
|
var invoiceUrl = s.Driver.Url;
|
||||||
|
|
||||||
//let's test archiving an invoice
|
//let's test archiving an invoice
|
||||||
Assert.DoesNotContain("Archived", s.Driver.FindElement(By.Id("btn-archive-toggle")).Text);
|
Assert.DoesNotContain("Archived", s.Driver.FindElement(By.Id("btn-archive-toggle")).Text);
|
||||||
s.Driver.FindElement(By.Id("btn-archive-toggle")).Click();
|
s.Driver.FindElement(By.Id("btn-archive-toggle")).Click();
|
||||||
s.FindAlertMessage();
|
|
||||||
Assert.Contains("Archived", s.Driver.FindElement(By.Id("btn-archive-toggle")).Text);
|
Assert.Contains("Archived", s.Driver.FindElement(By.Id("btn-archive-toggle")).Text);
|
||||||
//check that it no longer appears in list
|
//check that it no longer appears in list
|
||||||
s.GoToInvoices();
|
s.GoToInvoices();
|
||||||
@ -369,7 +360,6 @@ namespace BTCPayServer.Tests
|
|||||||
s.Logout();
|
s.Logout();
|
||||||
s.LogIn(alice);
|
s.LogIn(alice);
|
||||||
s.Driver.FindElement(By.Id("Stores")).Click();
|
s.Driver.FindElement(By.Id("Stores")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
// there shouldn't be any hints now
|
// there shouldn't be any hints now
|
||||||
Assert.False(s.Driver.PageSource.Contains(offchainHint), "Lightning hint should be dismissed at this point");
|
Assert.False(s.Driver.PageSource.Contains(offchainHint), "Lightning hint should be dismissed at this point");
|
||||||
@ -391,14 +381,14 @@ namespace BTCPayServer.Tests
|
|||||||
s.Driver.Navigate().GoToUrl(s.Link("/api-access-request"));
|
s.Driver.Navigate().GoToUrl(s.Link("/api-access-request"));
|
||||||
Assert.Contains("ReturnUrl", s.Driver.Url);
|
Assert.Contains("ReturnUrl", s.Driver.Url);
|
||||||
s.GoToRegister();
|
s.GoToRegister();
|
||||||
var alice = s.RegisterNewUser();
|
s.RegisterNewUser();
|
||||||
var store = s.CreateNewStore().storeName;
|
s.CreateNewStore();
|
||||||
s.AddDerivationScheme();
|
s.AddDerivationScheme();
|
||||||
|
|
||||||
s.Driver.FindElement(By.Id("Tokens")).Click();
|
s.Driver.FindElement(By.Id("Tokens")).Click();
|
||||||
s.Driver.FindElement(By.Id("CreateNewToken")).Click();
|
s.Driver.FindElement(By.Id("CreateNewToken")).Click();
|
||||||
s.Driver.FindElement(By.Id("RequestPairing")).Click();
|
s.Driver.FindElement(By.Id("RequestPairing")).Click();
|
||||||
string pairingCode = AssertUrlHasPairingCode(s);
|
var pairingCode = AssertUrlHasPairingCode(s);
|
||||||
|
|
||||||
s.Driver.FindElement(By.Id("ApprovePairing")).Click();
|
s.Driver.FindElement(By.Id("ApprovePairing")).Click();
|
||||||
s.FindAlertMessage();
|
s.FindAlertMessage();
|
||||||
@ -444,8 +434,6 @@ namespace BTCPayServer.Tests
|
|||||||
|
|
||||||
s.Driver.FindElement(By.Id("Apps")).Click();
|
s.Driver.FindElement(By.Id("Apps")).Click();
|
||||||
s.Driver.FindElement(By.Id("CreateNewApp")).Click();
|
s.Driver.FindElement(By.Id("CreateNewApp")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
s.Driver.FindElement(By.Name("Name")).SendKeys("PoS" + Guid.NewGuid());
|
s.Driver.FindElement(By.Name("Name")).SendKeys("PoS" + Guid.NewGuid());
|
||||||
s.Driver.FindElement(By.Id("SelectedAppType")).SendKeys("PointOfSale");
|
s.Driver.FindElement(By.Id("SelectedAppType")).SendKeys("PointOfSale");
|
||||||
s.Driver.FindElement(By.Id("SelectedStore")).SendKeys(storeName);
|
s.Driver.FindElement(By.Id("SelectedStore")).SendKeys(storeName);
|
||||||
@ -459,17 +447,15 @@ namespace BTCPayServer.Tests
|
|||||||
Assert.True(s.Driver.PageSource.Contains("Cart"), "PoS not showing correct default view");
|
Assert.True(s.Driver.PageSource.Contains("Cart"), "PoS not showing correct default view");
|
||||||
|
|
||||||
s.Driver.Url = posBaseUrl + "/static";
|
s.Driver.Url = posBaseUrl + "/static";
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
Assert.False(s.Driver.PageSource.Contains("Cart"), "Static PoS not showing correct view");
|
Assert.False(s.Driver.PageSource.Contains("Cart"), "Static PoS not showing correct view");
|
||||||
|
|
||||||
s.Driver.Url = posBaseUrl + "/cart";
|
s.Driver.Url = posBaseUrl + "/cart";
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
Assert.True(s.Driver.PageSource.Contains("Cart"), "Cart PoS not showing correct view");
|
Assert.True(s.Driver.PageSource.Contains("Cart"), "Cart PoS not showing correct view");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact(Timeout = TestTimeout)]
|
[Fact(Timeout = TestTimeout)]
|
||||||
public async Task CanCreateAppCF()
|
public async Task CanCreateCrowdfundingApp()
|
||||||
{
|
{
|
||||||
using (var s = SeleniumTester.Create())
|
using (var s = SeleniumTester.Create())
|
||||||
{
|
{
|
||||||
@ -480,12 +466,10 @@ namespace BTCPayServer.Tests
|
|||||||
|
|
||||||
s.Driver.FindElement(By.Id("Apps")).Click();
|
s.Driver.FindElement(By.Id("Apps")).Click();
|
||||||
s.Driver.FindElement(By.Id("CreateNewApp")).Click();
|
s.Driver.FindElement(By.Id("CreateNewApp")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
s.Driver.FindElement(By.Name("Name")).SendKeys("CF" + Guid.NewGuid());
|
s.Driver.FindElement(By.Name("Name")).SendKeys("CF" + Guid.NewGuid());
|
||||||
s.Driver.FindElement(By.Id("SelectedAppType")).SendKeys("Crowdfund");
|
s.Driver.FindElement(By.Id("SelectedAppType")).SendKeys("Crowdfund");
|
||||||
s.Driver.FindElement(By.Id("SelectedStore")).SendKeys(storeName);
|
s.Driver.FindElement(By.Id("SelectedStore")).SendKeys(storeName);
|
||||||
s.Driver.FindElement(By.Id("Create")).Click();
|
s.Driver.FindElement(By.Id("Create")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
s.Driver.FindElement(By.Id("Title")).SendKeys("Kukkstarter");
|
s.Driver.FindElement(By.Id("Title")).SendKeys("Kukkstarter");
|
||||||
s.Driver.FindElement(By.CssSelector("div.note-editable.card-block")).SendKeys("1BTC = 1BTC");
|
s.Driver.FindElement(By.CssSelector("div.note-editable.card-block")).SendKeys("1BTC = 1BTC");
|
||||||
s.Driver.FindElement(By.Id("TargetCurrency")).SendKeys("JPY");
|
s.Driver.FindElement(By.Id("TargetCurrency")).SendKeys("JPY");
|
||||||
@ -512,11 +496,8 @@ namespace BTCPayServer.Tests
|
|||||||
s.Driver.FindElement(By.Id("Amount")).SendKeys("700");
|
s.Driver.FindElement(By.Id("Amount")).SendKeys("700");
|
||||||
s.Driver.FindElement(By.Id("Currency")).SendKeys("BTC");
|
s.Driver.FindElement(By.Id("Currency")).SendKeys("BTC");
|
||||||
s.Driver.FindElement(By.Id("SaveButton")).Click();
|
s.Driver.FindElement(By.Id("SaveButton")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
s.Driver.FindElement(By.Name("ViewAppButton")).Click();
|
s.Driver.FindElement(By.Name("ViewAppButton")).Click();
|
||||||
s.Driver.SwitchTo().Window(s.Driver.WindowHandles.Last());
|
s.Driver.SwitchTo().Window(s.Driver.WindowHandles.Last());
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
Assert.Equal("Amount due", s.Driver.FindElement(By.CssSelector("[data-test='amount-due-title']")).Text);
|
Assert.Equal("Amount due", s.Driver.FindElement(By.CssSelector("[data-test='amount-due-title']")).Text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -528,13 +509,12 @@ namespace BTCPayServer.Tests
|
|||||||
using (var s = SeleniumTester.Create())
|
using (var s = SeleniumTester.Create())
|
||||||
{
|
{
|
||||||
await s.StartAsync();
|
await s.StartAsync();
|
||||||
var userId = s.RegisterNewUser(true);
|
s.RegisterNewUser(true);
|
||||||
var storeId = s.CreateNewStore().storeId;
|
var (_, storeId) = s.CreateNewStore();
|
||||||
s.GenerateWallet("BTC", "", false, true);
|
s.GenerateWallet("BTC", "", false, true);
|
||||||
var walletId = new WalletId(storeId, "BTC");
|
var walletId = new WalletId(storeId, "BTC");
|
||||||
s.GoToWallet(walletId, WalletsNavPages.Receive);
|
s.GoToWallet(walletId, WalletsNavPages.Receive);
|
||||||
s.Driver.FindElement(By.Id("generateButton")).Click();
|
s.Driver.FindElement(By.Id("generateButton")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
var addressStr = s.Driver.FindElement(By.Id("address")).GetProperty("value");
|
var addressStr = s.Driver.FindElement(By.Id("address")).GetProperty("value");
|
||||||
var address = BitcoinAddress.Create(addressStr, ((BTCPayNetwork)s.Server.NetworkProvider.GetNetwork("BTC")).NBitcoinNetwork);
|
var address = BitcoinAddress.Create(addressStr, ((BTCPayNetwork)s.Server.NetworkProvider.GetNetwork("BTC")).NBitcoinNetwork);
|
||||||
await s.Server.ExplorerNode.GenerateAsync(1);
|
await s.Server.ExplorerNode.GenerateAsync(1);
|
||||||
@ -557,15 +537,13 @@ namespace BTCPayServer.Tests
|
|||||||
coin => coin.OutPoint == spentOutpoint);
|
coin => coin.OutPoint == spentOutpoint);
|
||||||
});
|
});
|
||||||
await s.Server.ExplorerNode.GenerateAsync(1);
|
await s.Server.ExplorerNode.GenerateAsync(1);
|
||||||
s.GoToWallet(walletId, WalletsNavPages.Send);
|
s.GoToWallet(walletId);
|
||||||
s.Driver.FindElement(By.Id("advancedSettings")).Click();
|
s.Driver.FindElement(By.Id("advancedSettings")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
s.Driver.FindElement(By.Id("toggleInputSelection")).Click();
|
s.Driver.FindElement(By.Id("toggleInputSelection")).Click();
|
||||||
s.Driver.FindElement(By.Id(spentOutpoint.ToString()));
|
s.Driver.FindElement(By.Id(spentOutpoint.ToString()));
|
||||||
Assert.Equal("true", s.Driver.FindElement(By.Name("InputSelection")).GetAttribute("value").ToLowerInvariant());
|
Assert.Equal("true", s.Driver.FindElement(By.Name("InputSelection")).GetAttribute("value").ToLowerInvariant());
|
||||||
var el = s.Driver.FindElement(By.Id(spentOutpoint.ToString()));
|
var el = s.Driver.FindElement(By.Id(spentOutpoint.ToString()));
|
||||||
s.Driver.FindElement(By.Id(spentOutpoint.ToString())).Click();
|
s.Driver.FindElement(By.Id(spentOutpoint.ToString())).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
var inputSelectionSelect = s.Driver.FindElement(By.Name("SelectedInputs"));
|
var inputSelectionSelect = s.Driver.FindElement(By.Name("SelectedInputs"));
|
||||||
Assert.Single(inputSelectionSelect.FindElements(By.CssSelector("[selected]")));
|
Assert.Single(inputSelectionSelect.FindElements(By.CssSelector("[selected]")));
|
||||||
|
|
||||||
@ -598,7 +576,6 @@ namespace BTCPayServer.Tests
|
|||||||
for (var i = 0; i < 2; i++)
|
for (var i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
s.Driver.FindElement(By.Id("CreateWebhook")).Click();
|
s.Driver.FindElement(By.Id("CreateWebhook")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
s.Driver.FindElement(By.Name("PayloadUrl")).SendKeys($"http://127.0.0.1/callback{i}");
|
s.Driver.FindElement(By.Name("PayloadUrl")).SendKeys($"http://127.0.0.1/callback{i}");
|
||||||
new SelectElement(s.Driver.FindElement(By.Name("Everything")))
|
new SelectElement(s.Driver.FindElement(By.Name("Everything")))
|
||||||
.SelectByValue("false");
|
.SelectByValue("false");
|
||||||
@ -673,7 +650,6 @@ namespace BTCPayServer.Tests
|
|||||||
s.Driver.FindElement(By.ClassName("fa-times"));
|
s.Driver.FindElement(By.ClassName("fa-times"));
|
||||||
s.Driver.FindElement(By.ClassName("fa-check"));
|
s.Driver.FindElement(By.ClassName("fa-check"));
|
||||||
elements[0].Click();
|
elements[0].Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
s.FindAlertMessage();
|
s.FindAlertMessage();
|
||||||
request = await server.GetNextRequest();
|
request = await server.GetNextRequest();
|
||||||
@ -688,7 +664,6 @@ namespace BTCPayServer.Tests
|
|||||||
CanBrowseContent(s);
|
CanBrowseContent(s);
|
||||||
var element = s.Driver.FindElement(By.ClassName("redeliver"));
|
var element = s.Driver.FindElement(By.ClassName("redeliver"));
|
||||||
element.Click();
|
element.Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
s.FindAlertMessage();
|
s.FindAlertMessage();
|
||||||
request = await server.GetNextRequest();
|
request = await server.GetNextRequest();
|
||||||
@ -716,38 +691,26 @@ namespace BTCPayServer.Tests
|
|||||||
|
|
||||||
// In this test, we try to spend from a manual seed. We import the xpub 49'/0'/0', then try to use the seed
|
// In this test, we try to spend from a manual seed. We import the xpub 49'/0'/0', then try to use the seed
|
||||||
// to sign the transaction
|
// to sign the transaction
|
||||||
s.GenerateWallet("BTC", "", true, false);
|
s.GenerateWallet("BTC", "", true);
|
||||||
|
|
||||||
//let's test quickly the receive wallet page
|
//let's test quickly the receive wallet page
|
||||||
s.Driver.FindElement(By.Id("Wallets")).Click();
|
s.Driver.FindElement(By.Id("Wallets")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
s.Driver.FindElement(By.LinkText("Manage")).Click();
|
s.Driver.FindElement(By.LinkText("Manage")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
s.Driver.FindElement(By.Id("WalletSend")).Click();
|
s.Driver.FindElement(By.Id("WalletSend")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
s.Driver.FindElement(By.Id("SendMenu")).Click();
|
s.Driver.FindElement(By.Id("SendMenu")).Click();
|
||||||
|
|
||||||
//you cant use the Sign with NBX option without saving private keys when generating the wallet.
|
//you cant use the Sign with NBX option without saving private keys when generating the wallet.
|
||||||
Assert.DoesNotContain("nbx-seed", s.Driver.PageSource);
|
Assert.DoesNotContain("nbx-seed", s.Driver.PageSource);
|
||||||
|
|
||||||
s.Driver.FindElement(By.Id("WalletReceive")).Click();
|
s.Driver.FindElement(By.Id("WalletReceive")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
//generate a receiving address
|
//generate a receiving address
|
||||||
s.Driver.FindElement(By.CssSelector("button[value=generate-new-address]")).Click();
|
s.Driver.FindElement(By.CssSelector("button[value=generate-new-address]")).Click();
|
||||||
Assert.True(s.Driver.FindElement(By.ClassName("qr-container")).Displayed);
|
Assert.True(s.Driver.FindElement(By.ClassName("qr-container")).Displayed);
|
||||||
var receiveAddr = s.Driver.FindElement(By.Id("address")).GetAttribute("value");
|
var receiveAddr = s.Driver.FindElement(By.Id("address")).GetAttribute("value");
|
||||||
|
|
||||||
//unreserve
|
//unreserve
|
||||||
s.Driver.FindElement(By.CssSelector("button[value=unreserve-current-address]")).Click();
|
s.Driver.FindElement(By.CssSelector("button[value=unreserve-current-address]")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
//generate it again, should be the same one as before as nothing got used in the meantime
|
//generate it again, should be the same one as before as nothing got used in the meantime
|
||||||
s.Driver.FindElement(By.CssSelector("button[value=generate-new-address]")).Click();
|
s.Driver.FindElement(By.CssSelector("button[value=generate-new-address]")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
Assert.True(s.Driver.FindElement(By.ClassName("qr-container")).Displayed);
|
Assert.True(s.Driver.FindElement(By.ClassName("qr-container")).Displayed);
|
||||||
Assert.Equal(receiveAddr, s.Driver.FindElement(By.Id("address")).GetAttribute("value"));
|
Assert.Equal(receiveAddr, s.Driver.FindElement(By.Id("address")).GetAttribute("value"));
|
||||||
|
|
||||||
@ -761,21 +724,16 @@ namespace BTCPayServer.Tests
|
|||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
s.Driver.Navigate().Refresh();
|
s.Driver.Navigate().Refresh();
|
||||||
s.Driver.FindElement(By.CssSelector("button[value=generate-new-address]")).Click();
|
s.Driver.FindElement(By.CssSelector("button[value=generate-new-address]")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
Assert.NotEqual(receiveAddr, s.Driver.FindElement(By.Id("address")).GetAttribute("value"));
|
Assert.NotEqual(receiveAddr, s.Driver.FindElement(By.Id("address")).GetAttribute("value"));
|
||||||
receiveAddr = s.Driver.FindElement(By.Id("address")).GetAttribute("value");
|
receiveAddr = s.Driver.FindElement(By.Id("address")).GetAttribute("value");
|
||||||
|
|
||||||
//change the wallet and ensure old address is not there and generating a new one does not result in the prev one
|
//change the wallet and ensure old address is not there and generating a new one does not result in the prev one
|
||||||
s.GoToStore(storeId.storeId);
|
s.GoToStore(storeId.storeId);
|
||||||
s.GenerateWallet("BTC", "", true, false);
|
s.GenerateWallet("BTC", "", true);
|
||||||
s.Driver.FindElement(By.Id("Wallets")).Click();
|
s.Driver.FindElement(By.Id("Wallets")).Click();
|
||||||
s.Driver.FindElement(By.LinkText("Manage")).Click();
|
s.Driver.FindElement(By.LinkText("Manage")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
s.Driver.FindElement(By.Id("WalletReceive")).Click();
|
s.Driver.FindElement(By.Id("WalletReceive")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
s.Driver.FindElement(By.CssSelector("button[value=generate-new-address]")).Click();
|
s.Driver.FindElement(By.CssSelector("button[value=generate-new-address]")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
Assert.NotEqual(receiveAddr, s.Driver.FindElement(By.Id("address")).GetAttribute("value"));
|
Assert.NotEqual(receiveAddr, s.Driver.FindElement(By.Id("address")).GetAttribute("value"));
|
||||||
|
|
||||||
@ -798,7 +756,7 @@ namespace BTCPayServer.Tests
|
|||||||
//spendable from bitcoin core wallet!
|
//spendable from bitcoin core wallet!
|
||||||
Assert.False(result.IsWatchOnly);
|
Assert.False(result.IsWatchOnly);
|
||||||
var tx = s.Server.ExplorerNode.SendToAddress(BitcoinAddress.Create(address, Network.RegTest), Money.Coins(3.0m));
|
var tx = s.Server.ExplorerNode.SendToAddress(BitcoinAddress.Create(address, Network.RegTest), Money.Coins(3.0m));
|
||||||
s.Server.ExplorerNode.Generate(1);
|
await s.Server.ExplorerNode.GenerateAsync(1);
|
||||||
|
|
||||||
s.Driver.FindElement(By.Id("Wallets")).Click();
|
s.Driver.FindElement(By.Id("Wallets")).Click();
|
||||||
s.Driver.FindElement(By.LinkText("Manage")).Click();
|
s.Driver.FindElement(By.LinkText("Manage")).Click();
|
||||||
@ -816,7 +774,6 @@ namespace BTCPayServer.Tests
|
|||||||
|
|
||||||
// Check the tx sent earlier arrived
|
// Check the tx sent earlier arrived
|
||||||
s.Driver.FindElement(By.Id("WalletTransactions")).Click();
|
s.Driver.FindElement(By.Id("WalletTransactions")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
var walletTransactionLink = s.Driver.Url;
|
var walletTransactionLink = s.Driver.Url;
|
||||||
Assert.Contains(tx.ToString(), s.Driver.PageSource);
|
Assert.Contains(tx.ToString(), s.Driver.PageSource);
|
||||||
@ -830,7 +787,6 @@ namespace BTCPayServer.Tests
|
|||||||
SetTransactionOutput(s, 0, bob, 1);
|
SetTransactionOutput(s, 0, bob, 1);
|
||||||
s.Driver.FindElement(By.Id("SendMenu")).Click();
|
s.Driver.FindElement(By.Id("SendMenu")).Click();
|
||||||
s.Driver.FindElement(By.CssSelector("button[value=seed]")).Click();
|
s.Driver.FindElement(By.CssSelector("button[value=seed]")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
// Input the seed
|
// Input the seed
|
||||||
s.Driver.FindElement(By.Id("SeedOrKey")).SendKeys(signingSource + Keys.Enter);
|
s.Driver.FindElement(By.Id("SeedOrKey")).SendKeys(signingSource + Keys.Enter);
|
||||||
@ -839,7 +795,6 @@ namespace BTCPayServer.Tests
|
|||||||
Assert.Contains(bob.ToString(), s.Driver.PageSource);
|
Assert.Contains(bob.ToString(), s.Driver.PageSource);
|
||||||
Assert.Contains("1.00000000", s.Driver.PageSource);
|
Assert.Contains("1.00000000", s.Driver.PageSource);
|
||||||
s.Driver.FindElement(By.CssSelector("button[value=broadcast]")).Click();
|
s.Driver.FindElement(By.CssSelector("button[value=broadcast]")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
Assert.Equal(walletTransactionLink, s.Driver.Url);
|
Assert.Equal(walletTransactionLink, s.Driver.Url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -904,37 +859,29 @@ namespace BTCPayServer.Tests
|
|||||||
{
|
{
|
||||||
await s.StartAsync();
|
await s.StartAsync();
|
||||||
s.RegisterNewUser(true);
|
s.RegisterNewUser(true);
|
||||||
var receiver = s.CreateNewStore();
|
s.CreateNewStore();
|
||||||
var receiverSeed = s.GenerateWallet("BTC", "", true, true, ScriptPubKeyType.Segwit);
|
s.GenerateWallet("BTC", "", true, true);
|
||||||
|
|
||||||
await s.Server.ExplorerNode.GenerateAsync(1);
|
await s.Server.ExplorerNode.GenerateAsync(1);
|
||||||
await s.FundStoreWallet(denomination: 50.0m);
|
await s.FundStoreWallet(denomination: 50.0m);
|
||||||
s.GoToWallet(navPages: WalletsNavPages.PullPayments);
|
s.GoToWallet(navPages: WalletsNavPages.PullPayments);
|
||||||
s.Driver.FindElement(By.Id("NewPullPayment")).Click();
|
s.Driver.FindElement(By.Id("NewPullPayment")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
s.Driver.FindElement(By.Id("Name")).SendKeys("PP1");
|
s.Driver.FindElement(By.Id("Name")).SendKeys("PP1");
|
||||||
s.Driver.FindElement(By.Id("Amount")).Clear();
|
s.Driver.FindElement(By.Id("Amount")).Clear();
|
||||||
s.Driver.FindElement(By.Id("Amount")).SendKeys("99.0");;
|
s.Driver.FindElement(By.Id("Amount")).SendKeys("99.0");;
|
||||||
s.Driver.FindElement(By.Id("Create")).Click();
|
s.Driver.FindElement(By.Id("Create")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
s.Driver.FindElement(By.LinkText("View")).Click();
|
s.Driver.FindElement(By.LinkText("View")).Click();
|
||||||
|
|
||||||
s.GoToWallet(navPages: WalletsNavPages.PullPayments);
|
s.GoToWallet(navPages: WalletsNavPages.PullPayments);
|
||||||
|
|
||||||
s.Driver.FindElement(By.Id("NewPullPayment")).Click();
|
s.Driver.FindElement(By.Id("NewPullPayment")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
s.Driver.FindElement(By.Id("Name")).SendKeys("PP2");
|
s.Driver.FindElement(By.Id("Name")).SendKeys("PP2");
|
||||||
s.Driver.FindElement(By.Id("Amount")).Clear();
|
s.Driver.FindElement(By.Id("Amount")).Clear();
|
||||||
s.Driver.FindElement(By.Id("Amount")).SendKeys("100.0");
|
s.Driver.FindElement(By.Id("Amount")).SendKeys("100.0");
|
||||||
s.Driver.FindElement(By.Id("Create")).Click();
|
s.Driver.FindElement(By.Id("Create")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
// This should select the first View, ie, the last one PP2
|
// This should select the first View, ie, the last one PP2
|
||||||
s.Driver.FindElement(By.LinkText("View")).Click();
|
s.Driver.FindElement(By.LinkText("View")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
var address = await s.Server.ExplorerNode.GetNewAddressAsync();
|
var address = await s.Server.ExplorerNode.GetNewAddressAsync();
|
||||||
s.Driver.FindElement(By.Id("Destination")).SendKeys(address.ToString());
|
s.Driver.FindElement(By.Id("Destination")).SendKeys(address.ToString());
|
||||||
s.Driver.FindElement(By.Id("ClaimedAmount")).Clear();
|
s.Driver.FindElement(By.Id("ClaimedAmount")).Clear();
|
||||||
@ -970,16 +917,9 @@ namespace BTCPayServer.Tests
|
|||||||
Assert.DoesNotContain("No payout waiting for approval", s.Driver.PageSource);
|
Assert.DoesNotContain("No payout waiting for approval", s.Driver.PageSource);
|
||||||
s.Driver.FindElement(By.Id("selectAllCheckbox")).Click();
|
s.Driver.FindElement(By.Id("selectAllCheckbox")).Click();
|
||||||
s.Driver.FindElement(By.Id("payCommand")).Click();
|
s.Driver.FindElement(By.Id("payCommand")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
s.Driver.FindElement(By.Id("SendMenu")).Click();
|
s.Driver.FindElement(By.Id("SendMenu")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
s.Driver.FindElement(By.CssSelector("button[value=nbx-seed]")).Click();
|
s.Driver.FindElement(By.CssSelector("button[value=nbx-seed]")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
s.Driver.FindElement(By.CssSelector("button[value=broadcast]")).Click();
|
s.Driver.FindElement(By.CssSelector("button[value=broadcast]")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
|
|
||||||
s.FindAlertMessage();
|
s.FindAlertMessage();
|
||||||
|
|
||||||
@ -1026,7 +966,6 @@ namespace BTCPayServer.Tests
|
|||||||
private static void CanBrowseContent(SeleniumTester s)
|
private static void CanBrowseContent(SeleniumTester s)
|
||||||
{
|
{
|
||||||
s.Driver.FindElement(By.ClassName("delivery-content")).Click();
|
s.Driver.FindElement(By.ClassName("delivery-content")).Click();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
var windows = s.Driver.WindowHandles;
|
var windows = s.Driver.WindowHandles;
|
||||||
Assert.Equal(2, windows.Count);
|
Assert.Equal(2, windows.Count);
|
||||||
s.Driver.SwitchTo().Window(windows[1]);
|
s.Driver.SwitchTo().Window(windows[1]);
|
||||||
@ -1047,7 +986,6 @@ namespace BTCPayServer.Tests
|
|||||||
Assert.Contains("Configured", s.Driver.PageSource);
|
Assert.Contains("Configured", s.Driver.PageSource);
|
||||||
s.Driver.FindElement(By.Id("Settings_Login")).SendKeys("test_fix@gmail.com");
|
s.Driver.FindElement(By.Id("Settings_Login")).SendKeys("test_fix@gmail.com");
|
||||||
s.Driver.FindElement(By.CssSelector("button[value=\"Save\"]")).Submit();
|
s.Driver.FindElement(By.CssSelector("button[value=\"Save\"]")).Submit();
|
||||||
s.Driver.WaitForPageLoad();
|
|
||||||
Assert.Contains("Configured", s.Driver.PageSource);
|
Assert.Contains("Configured", s.Driver.PageSource);
|
||||||
Assert.Contains("test_fix", s.Driver.PageSource);
|
Assert.Contains("test_fix", s.Driver.PageSource);
|
||||||
s.Driver.FindElement(By.CssSelector("button[value=\"ResetPassword\"]")).Submit();
|
s.Driver.FindElement(By.CssSelector("button[value=\"ResetPassword\"]")).Submit();
|
||||||
|
Loading…
Reference in New Issue
Block a user