Pom
This commit is contained in:
parent
7634250751
commit
bec7a83b2e
@ -16,29 +16,39 @@ namespace LukanPOM.PageObjects
|
||||
{
|
||||
public class HomePage
|
||||
{
|
||||
private IWebDriver _driver;
|
||||
private IWebDriver driver;
|
||||
|
||||
[FindsBy(How = How.ClassName, Using = "eu-cookies-bar-tick")]
|
||||
|
||||
private IWebElement _clickcookieaccept;
|
||||
|
||||
[FindsBy(How = How.Id, Using = "menu-item-439")]
|
||||
private IWebElement _clickzasadyochrany;
|
||||
IWebElement ClickAcceptCookie => driver.FindElement(By.XPath("//div[2]/span"));
|
||||
IWebElement ClickZasady => driver.FindElement(By.Id("menu-item-439"));
|
||||
|
||||
|
||||
|
||||
public HomePage(IWebDriver driver)
|
||||
{
|
||||
_driver = driver;
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void AcceptCookie()
|
||||
{
|
||||
_clickcookieaccept.Click();
|
||||
ClickAcceptCookie.Click();
|
||||
|
||||
}
|
||||
public void ZasadyOchrany()
|
||||
{
|
||||
_clickzasadyochrany.Click();
|
||||
|
||||
ClickZasady.Click();
|
||||
}
|
||||
|
||||
public void TitleTest()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
35
LukanNUnitProject/LukanPOM/TestBase/TestBase.cs
Normal file
35
LukanNUnitProject/LukanPOM/TestBase/TestBase.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using OpenQA.Selenium.Chrome;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenQA.Selenium;
|
||||
using LukanPOM.PageObjects;
|
||||
|
||||
namespace LukanPOM.Common
|
||||
{
|
||||
internal class TestBase
|
||||
{
|
||||
public HomePage home { get; private set; }
|
||||
protected IWebDriver Driver { get; private set; }
|
||||
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Driver = new ChromeDriver();
|
||||
Driver.Manage().Window.Maximize();
|
||||
Driver.Navigate().GoToUrl("https://lukan.cz");
|
||||
Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
|
||||
home = new HomePage(Driver);
|
||||
}
|
||||
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
Driver.Quit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -14,28 +14,27 @@ using WebDriverManager;
|
||||
using WebDriverManager.DriverConfigs.Impl;
|
||||
using OpenQA.Selenium.Chrome;
|
||||
using LukanPOM.PageObjects;
|
||||
using LukanPOM.Common;
|
||||
|
||||
namespace LukanPOM.Tests
|
||||
{
|
||||
public class AcceptCookie
|
||||
{
|
||||
private IWebDriver? _driver;
|
||||
[SetUp]
|
||||
public void InitScript()
|
||||
|
||||
|
||||
//private IWebDriver? _driver;
|
||||
internal class HomePage : TestBase
|
||||
{
|
||||
new DriverManager().SetUpDriver(new ChromeConfig());
|
||||
_driver = new ChromeDriver();
|
||||
_driver.Manage().Window.Maximize();
|
||||
}
|
||||
[Test]
|
||||
public void TestCookie()
|
||||
[Test]
|
||||
public void AcceptCookieTest()
|
||||
{
|
||||
HomePage hp = new HomePage(_driver);
|
||||
_driver.Navigate().GoToUrl("https://lukan.cz");
|
||||
hp.ZasadyOchrany();
|
||||
|
||||
|
||||
home.AcceptCookie();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
385966025
|
||||
1695163839
|
@ -1 +1 @@
|
||||
63e5f0709ae68783c6bfd06ea17d01dfba94d2d4
|
||||
cc6aed74361c6473bdc4ce34a0da9dfb4ecb0290
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user