Pom
This commit is contained in:
1
zaloha/GlobalUsings.cs
Normal file
1
zaloha/GlobalUsings.cs
Normal file
@ -0,0 +1 @@
|
||||
global using NUnit.Framework;
|
25
zaloha/LukanPOM.csproj
Normal file
25
zaloha/LukanPOM.csproj
Normal file
@ -0,0 +1,25 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DotNetSeleniumExtras.PageObjects.Core" Version="4.3.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
|
||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
||||
<PackageReference Include="NUnit.ConsoleRunner" Version="3.16.3" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="NUnit.Analyzers" Version="3.6.1" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.2.0" />
|
||||
<PackageReference Include="Selenium.Support" Version="4.11.0" />
|
||||
<PackageReference Include="Selenium.WebDriver" Version="4.11.0" />
|
||||
<PackageReference Include="WebDriverManager" Version="2.17.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
33
zaloha/Source/Pages/HomePage.cs
Normal file
33
zaloha/Source/Pages/HomePage.cs
Normal file
@ -0,0 +1,33 @@
|
||||
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
|
||||
{
|
||||
private IWebDriver _driver;
|
||||
|
||||
[FindsBy(How = How.XPath, Using = "//div[2]/span")]
|
||||
private IWebElement _clickcookieaccept;
|
||||
public HomePage(IWebDriver driver)
|
||||
{
|
||||
_driver = driver;
|
||||
}
|
||||
|
||||
public void AcceptCookie()
|
||||
{
|
||||
_clickcookieaccept.Click();
|
||||
}
|
||||
}
|
||||
}
|
40
zaloha/Tests/AcceptCookie.cs
Normal file
40
zaloha/Tests/AcceptCookie.cs
Normal file
@ -0,0 +1,40 @@
|
||||
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;
|
||||
using WebDriverManager;
|
||||
using WebDriverManager.DriverConfigs.Impl;
|
||||
using OpenQA.Selenium.Chrome;
|
||||
using LukanPOM.PageObjects;
|
||||
|
||||
namespace LukanPOM.Tests
|
||||
{
|
||||
public class AcceptCookie
|
||||
{
|
||||
private IWebDriver _driver;
|
||||
[SetUp]
|
||||
public void InitScript()
|
||||
{
|
||||
new DriverManager().SetUpDriver(new ChromeConfig());
|
||||
_driver = new ChromeDriver();
|
||||
}
|
||||
[Test]
|
||||
public void TestCookie()
|
||||
{
|
||||
HomePage hp = new HomePage(_driver);
|
||||
_driver.Navigate().GoToUrl("http://lukan.cz");
|
||||
hp.AcceptCookie();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
2
zaloha/bash.bat
Normal file
2
zaloha/bash.bat
Normal file
@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
dotnet test
|
Reference in New Issue
Block a user