Pom
This commit is contained in:
parent
7634250751
commit
bec7a83b2e
@ -16,29 +16,39 @@ namespace LukanPOM.PageObjects
|
|||||||
{
|
{
|
||||||
public class HomePage
|
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")]
|
IWebElement ClickAcceptCookie => driver.FindElement(By.XPath("//div[2]/span"));
|
||||||
private IWebElement _clickzasadyochrany;
|
IWebElement ClickZasady => driver.FindElement(By.Id("menu-item-439"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public HomePage(IWebDriver driver)
|
public HomePage(IWebDriver driver)
|
||||||
{
|
{
|
||||||
_driver = driver;
|
this.driver = driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AcceptCookie()
|
public void AcceptCookie()
|
||||||
{
|
{
|
||||||
_clickcookieaccept.Click();
|
ClickAcceptCookie.Click();
|
||||||
|
|
||||||
}
|
}
|
||||||
public void ZasadyOchrany()
|
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 WebDriverManager.DriverConfigs.Impl;
|
||||||
using OpenQA.Selenium.Chrome;
|
using OpenQA.Selenium.Chrome;
|
||||||
using LukanPOM.PageObjects;
|
using LukanPOM.PageObjects;
|
||||||
|
using LukanPOM.Common;
|
||||||
|
|
||||||
namespace LukanPOM.Tests
|
namespace LukanPOM.Tests
|
||||||
{
|
{
|
||||||
public class AcceptCookie
|
|
||||||
{
|
|
||||||
private IWebDriver? _driver;
|
//private IWebDriver? _driver;
|
||||||
[SetUp]
|
internal class HomePage : TestBase
|
||||||
public void InitScript()
|
|
||||||
{
|
{
|
||||||
new DriverManager().SetUpDriver(new ChromeConfig());
|
[Test]
|
||||||
_driver = new ChromeDriver();
|
public void AcceptCookieTest()
|
||||||
_driver.Manage().Window.Maximize();
|
|
||||||
}
|
|
||||||
[Test]
|
|
||||||
public void TestCookie()
|
|
||||||
{
|
{
|
||||||
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