Problem is that my test is setting up behind "the real application" with real implementations
public class SeleniumTests : IDisposable { private readonly Context _ctx; private readonly IWebHost _host;
public void Dispose()
{
_ctx.Database.EnsureDeleted();
_host.Dispose();
}
public SeleniumTests()
{
var o = new DbContextOptionsBuilder<Context>();
o.UseInMemoryDatabase(Guid.NewGuid().ToString());
_ctx = new Context(o.Options);
_ctx.Database.EnsureDeleted();
_ctx.Database.EnsureCreated();
_host = new WebHostBuilder()
.UseKestrel()
.UseConfiguration
(
new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.Build()
)
.UseUrls($"http://localhost:5000/", $"https://localhost:5001/")
.UseStartup<Startup>()
.Build();
_host.Start();
}
[Fact]
public async void MainPage()
{
var driver = new FirefoxDriver($@".\SeleniumEngines\");
try
{
driver.Navigate().GoToUrl("http://localhost:5000");
await Task.Delay(50000);
todo:
_userService.AddUser("abc", "abc");
driver.Navigate.GoToUrl("http://localhost:5000/login);
driver fill login/password
driver click submit
}
catch
{
driver.Quit();
throw;
}
finally
{
driver.Quit();
}
}
}