36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using EATestFramework.Driver;
|
|
using EATestFramework.Extensions;
|
|
using EATestProject.Model;
|
|
using OpenQA.Selenium;
|
|
using OpenQA.Selenium.Support.UI;
|
|
|
|
namespace EATestProject.Pages
|
|
{
|
|
public interface ICreateProductPage
|
|
{
|
|
void EnterProductDetails(Product product);
|
|
}
|
|
|
|
public class CreateProductPage : ICreateProductPage
|
|
{
|
|
private readonly IWebDriver _driver;
|
|
public CreateProductPage(IDriverFixture driver) => _driver = driver.Driver;
|
|
|
|
IWebElement txtName => _driver.FindElement(By.Id("Name"));
|
|
IWebElement txtDescription => _driver.FindElement(By.Id("Description"));
|
|
IWebElement txtPrice => _driver.FindElement(By.Id("Price"));
|
|
IWebElement ddlProductType => _driver.FindElement(By.Id("ProductType"));
|
|
IWebElement btnCreate => _driver.FindElement(By.Id("Create"));
|
|
|
|
public void EnterProductDetails(Product product)
|
|
{
|
|
txtName.SendKeys(product.Name);
|
|
txtDescription.SendKeys(product.Description);
|
|
txtPrice.SendKeys(product.Price.ToString());
|
|
ddlProductType.SelectDropDownByText(product.ProductType.ToString());
|
|
btnCreate.Click();
|
|
}
|
|
|
|
}
|
|
}
|