Rafael, obrigado pelo retorno, fiz exatamento o que você sugeriu, mas o erro abaixo ainda persiste:
====================
Message: System.AggregateException : One or more errors occurred. (The chromedriver.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html.) (The following constructor parameters did not have matching fixture data: TestFixture fixture)
---- OpenQA.Selenium.DriverServiceNotFoundException : The chromedriver.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html.
---- The following constructor parameters did not have matching fixture data: TestFixture fixture
=====
Os drivers instalados são:
Microsoft.Asp.NeCore.App (2.2.6)
Microsoft.Net.Test.Sdk(16.2.0)
Selenium.Chrome.WebDriver(76.0.0)
Selenium.Support(3.141.0)
Selenium.WebDriver.ChromeDriver(76...)
xunit(2.4.1)
xunit.runner.visualstudio(2.4.1)
=============== Classe TestHelpers
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
namespace Alura.LeilaoOnline.Selenium2.Helpers
{
public static class TestHelpers
{
public static string PastaDoExecutavel => Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
}
}
========= classe TestFixture.cs
using Alura.LeilaoOnline.Selenium2.Helpers;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;
namespace Alura.LeilaoOnline.Selenium2.Fixtures
{
class TestFixture:IDisposable
{
public IWebDriver Driver { get; private set; }
//Setup -> de inicialização do Navegador que será compartilhada para todos os testes
public TestFixture()
{
Driver = new ChromeDriver(TestHelpers.PastaDoExecutavel);
}
//TearsDown ->
public void Dispose()
{
Driver.Quit();
}
}
}
========= classe de teste: AoNavegarParaHome.cs
using Alura.LeilaoOnline.Selenium.Fixtures;
using OpenQA.Selenium;
using Xunit;
namespace Alura.LeilaoOnline.Selenium2
{
public class AoNavegarParaHome: IClassFixture
{
private IWebDriver driver;
//Setup -> local de inicialização do navegador
public AoNavegarParaHome(TestFixture fixture)
{
driver = fixture.Driver;
}
[Fact]
public void DadoChromeAbertoDeveMostrarLeiloesNoTitulo()
{
//arrange
//act
driver.Navigate().GoToUrl("http://localhost:5000");
//assert
Assert.Contains("Leilões", driver.Title);
//driver.Quit();
}
[Fact]
public void DadoChromeAbertoDeveMostrarProximosLeiloes()
{
//arrange
//act
driver.Navigate().GoToUrl("http://localhost:5000");
//assert
Assert.Contains("Próximos Leilões", driver.PageSource);
//driver.Quit();
}
}
}