Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialise browser lazily so that web server can start before web dri… #253

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/TestStack.Seleno/Configuration/SelenoApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ internal class SelenoApplication : ISelenoApplication
private bool _disposed;

private readonly IContainer _container;
private IWebDriver _browser;

public IWebDriver Browser
{
get { return _browser ?? (_browser = _container.Resolve<IWebDriver>()); }
}

public IWebDriver Browser { get; }
public ICamera Camera { get; }
public IDomCapture DomCapture { get; }
public ILogger Logger { get; }
Expand All @@ -33,7 +38,6 @@ internal class SelenoApplication : ISelenoApplication
public SelenoApplication(IContainer container)
{
_container = container;
Browser = _container.Resolve<IWebDriver>();
Camera = _container.Resolve<ICamera>();
DomCapture = _container.Resolve<IDomCapture>();
Logger = _container.Resolve<ILoggerFactory>().Create(GetType());
Expand Down
8 changes: 1 addition & 7 deletions src/TestStack.Seleno/Configuration/SelenoHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,7 @@ public void Run(WebApplication app, Action<IAppConfigurator> configure)
/// <param name="configure">Any configuration changes you would like to make</param>
public void Run(Action<IAppConfigurator> configure)
{
Action<IAppConfigurator> action = x =>
{
if (configure != null)
configure(x);
};

Application = CreateApplication(action);
Application = CreateApplication(x => configure?.Invoke(x));
AppDomain.CurrentDomain.DomainUnload += CurrentDomainDomainUnload;
}

Expand Down