mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Revert "Share same browser for all selenium tests"
This reverts commit 2ce0749bb6.
This commit is contained in:
@@ -27,42 +27,20 @@ namespace BTCPayServer.Tests
|
||||
{
|
||||
public class SeleniumTester : IDisposable
|
||||
{
|
||||
private IWebDriver _Driver;
|
||||
public IWebDriver Driver
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Driver == null)
|
||||
{
|
||||
Start();
|
||||
}
|
||||
return _Driver;
|
||||
}
|
||||
}
|
||||
private ServerTester _Server;
|
||||
public ServerTester Server
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Server == null)
|
||||
{
|
||||
_Server = ServerTester.Create("Default Scope");
|
||||
Start();
|
||||
}
|
||||
return _Server;
|
||||
}
|
||||
}
|
||||
public IWebDriver Driver { get; set; }
|
||||
public ServerTester Server { get; set; }
|
||||
|
||||
public static SeleniumTester Create([CallerMemberNameAttribute] string scope = null)
|
||||
{
|
||||
var server = ServerTester.Create(scope);
|
||||
return new SeleniumTester()
|
||||
{
|
||||
_Server = ServerTester.Create(scope)
|
||||
Server = server
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
void Start()
|
||||
public void Start()
|
||||
{
|
||||
Server.Start();
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
@@ -78,7 +56,7 @@ namespace BTCPayServer.Tests
|
||||
{
|
||||
options.AddArgument("no-sandbox");
|
||||
}
|
||||
_Driver = new ChromeDriver(Server.PayTester.InContainer ? "/usr/bin" : Directory.GetCurrentDirectory(), options);
|
||||
Driver = new ChromeDriver(Server.PayTester.InContainer ? "/usr/bin" : Directory.GetCurrentDirectory(), options);
|
||||
if (isDebug)
|
||||
{
|
||||
//when running locally, depending on your resolution, the website may go into mobile responsive mode and screw with navigation of tests
|
||||
@@ -99,10 +77,7 @@ namespace BTCPayServer.Tests
|
||||
|
||||
public string RegisterNewUser(bool isAdmin = false)
|
||||
{
|
||||
GoToHome();
|
||||
if (Driver.PageSource.Contains("id=\"Logout\""))
|
||||
Logout();
|
||||
var usr = RandomUtils.GetUInt256().ToString().Substring(20) + "@a.com";
|
||||
var usr = RandomUtils.GetUInt256().ToString() + "@a.com";
|
||||
Driver.FindElement(By.Id("Register")).Click();
|
||||
Driver.FindElement(By.Id("Email")).SendKeys(usr);
|
||||
Driver.FindElement(By.Id("Password")).SendKeys("123456");
|
||||
|
||||
Reference in New Issue
Block a user