I've got a ASP.NET Core Project based on the angular2 template from the core template pack. I added a second project with xunit and protractor to run unit test against my main app.
Both work nicely alone, there is just one small thing I miss:
When I want to run the protractor tests I need to host the main project somewhere manually. If I don't host the main project manually it does not run, so all the Tests fail because my page is unreachable.
I probably need to start the main app / project somehow from the test, but I got no idea how. All examples for protractor run against some already running Homepages, none does run against some other project.
How do I start the main ASP.NET Core Project from my test Project, so it is running for testing?
Weird thing is: after I started the main app once using Strg+F5 protractor with ChromeDriver will find the homepage of the app. But I need to run it once manually for the tests to work...
public class EndToEndTests : IDisposable
{
private const string Url = "https://localhost:44391/";
private readonly IWebDriver _driver;
private readonly NgWebDriver _browser;
public EndToEndTests()
{
// TODO: somehow get the ASP.NET Core project up and running
_driver = new ChromeDriver(@"\test\ChromeDriver");
_driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(10));
_browser = new NgWebDriver(_driver);
}
public void Dispose()
{
_driver.Quit();
}
[Fact(DisplayName = "Has a title")]
public void HasATitle()
{
_browser.Url = Url;
Assert.Equal("My page", _browser.Title);
}