I have the following code, which occasionally, when placing an order, I skip a window pop-up indicating the same user that has orders in progress, you accept and continue with the order, but I do not the test ends
Method _Productos.PedirProducto();
does not do anything if I use _Pedido.ComprobarPedidoEnCurso();
Thanks
Class Order
public class Pedido : PageObjectBase, IPedido
{
//AceptarPedidoEnCurso
[FindsBy(How = How.XPath, Using = "//div[@id='popup']/div[3]/p[2]/a/span")]
private IWebElement _aceptarPedidoEnCurso;
public Pedido()
{
PageFactory.InitElements(this.WebDriver, this);
}
public void ComprobarPedidoEnCurso()
{
try
{
if (this._aceptarPedidoEnCurso != null)
{
this._aceptarPedidoEnCurso.Click();
}
}
catch
{
}
}
Product Class
public class Productos : PageObjectBase, IProductos
{
//PedirProducto
[FindsBy(How = How.XPath, Using = "//div[@id='999990010430687']/div[2]/span/span")]
private IWebElement _pedirProducto;
}
public void PedirProducto()
{
this._pedirProducto.Click();
Thread.Sleep(TimeSpan.FromSeconds(3));
}
Test Class
[TestClass]
public class TestPedido : AutofacContainer
{
private readonly IHome _Home;
private readonly IPedido _Pedido;
private readonly IProductos _Productos;
public Test()
{
this._Home = AutofacContainer.AContainer.Resolve<IHome>();
this._Pedido = AutofacContainer.AContainer.Resolve<IPedido>();
this._Productos = AutofacContainer.AContainer.Resolve<IProductos>();
}
[TestMethod]
public void Test_12()
{
_Home.GoToHome();
_Home.Login1();
_Pedido.RepartoADomicilioConRegistro();
_Pedido.ComprobarPedidoEnCurso();
_Productos.PedirProducto();
}
[TestCleanup]
public void EndTest()
{
_Home.CloseWebDriver();
}
}
}