2023-08-24 13:25:35 +02:00
|
|
|
using System;
|
|
|
|
using OpenQA.Selenium;
|
|
|
|
using OpenQA.Selenium.Remote;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using OpenQA.Selenium.Support.UI;
|
|
|
|
using SeleniumExtras.PageObjects;
|
|
|
|
using System.Net;
|
|
|
|
|
|
|
|
|
|
|
|
namespace LukanPOM.PageObjects
|
|
|
|
{
|
|
|
|
public class HomePage
|
|
|
|
{
|
2023-08-24 17:12:11 +02:00
|
|
|
private IWebDriver driver;
|
2023-08-24 15:39:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-24 17:12:11 +02:00
|
|
|
IWebElement ClickAcceptCookie => driver.FindElement(By.XPath("//div[2]/span"));
|
2023-08-24 17:50:51 +02:00
|
|
|
IWebElement ClickDeclineCookie => driver.FindElement(By.XPath("//div[3]/span"));
|
2023-08-25 07:41:57 +02:00
|
|
|
|
2023-08-24 17:12:11 +02:00
|
|
|
IWebElement ClickZasady => driver.FindElement(By.Id("menu-item-439"));
|
2023-08-25 10:19:53 +02:00
|
|
|
|
|
|
|
|
2023-08-24 17:12:11 +02:00
|
|
|
|
|
|
|
|
2023-08-24 13:25:35 +02:00
|
|
|
|
|
|
|
public HomePage(IWebDriver driver)
|
|
|
|
{
|
2023-08-24 17:12:11 +02:00
|
|
|
this.driver = driver;
|
2023-08-24 13:25:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void AcceptCookie()
|
|
|
|
{
|
2023-08-24 17:12:11 +02:00
|
|
|
ClickAcceptCookie.Click();
|
2023-08-24 15:39:29 +02:00
|
|
|
|
|
|
|
}
|
2023-08-25 07:41:57 +02:00
|
|
|
public void DeclineCookie()
|
2023-08-24 17:50:51 +02:00
|
|
|
{
|
|
|
|
ClickDeclineCookie.Click();
|
|
|
|
}
|
2023-08-24 15:39:29 +02:00
|
|
|
public void ZasadyOchrany()
|
|
|
|
{
|
|
|
|
|
2023-08-24 17:12:11 +02:00
|
|
|
ClickZasady.Click();
|
|
|
|
}
|
|
|
|
|
2023-08-24 17:50:51 +02:00
|
|
|
public HomePage Titulek()
|
|
|
|
{
|
|
|
|
string actualTitle = driver.Title;
|
|
|
|
string expectedTitle = "Lukáš bloguje - Blog o všem možném i nemožném";
|
|
|
|
Assert.AreEqual(expectedTitle, actualTitle);
|
|
|
|
return this;
|
|
|
|
}
|
2023-08-24 18:01:03 +02:00
|
|
|
public HomePage Screnshot()
|
|
|
|
{
|
|
|
|
string fileName = "example_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".png";
|
|
|
|
Screenshot screenshot = ((ITakesScreenshot)driver).GetScreenshot();
|
|
|
|
screenshot.SaveAsFile(@"C:\Users\lukas\Nextcloud\GitHub\.Net_C.Sharp_Test\LukanNUnitProject\LukanNUnitProject\Foto\" + fileName, ScreenshotImageFormat.Png);
|
|
|
|
return this;
|
|
|
|
}
|
2023-08-24 17:50:51 +02:00
|
|
|
|
|
|
|
public HomePage TestProsel()
|
2023-08-24 17:12:11 +02:00
|
|
|
{
|
2023-08-24 18:01:03 +02:00
|
|
|
Console.WriteLine("Test prošel");
|
2023-08-24 17:50:51 +02:00
|
|
|
return this;
|
2023-08-24 13:25:35 +02:00
|
|
|
}
|
2023-08-25 10:19:53 +02:00
|
|
|
|
|
|
|
|
2023-08-24 17:12:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-24 13:25:35 +02:00
|
|
|
}
|