Pom
This commit is contained in:
parent
be08de1d95
commit
7634250751
@ -17,11 +17,14 @@ namespace LukanPOM.PageObjects
|
||||
public class HomePage
|
||||
{
|
||||
private IWebDriver _driver;
|
||||
/*
|
||||
[FindsBy(How = How.XPath, Using = "//div[2]/span")]
|
||||
*/
|
||||
|
||||
[FindsBy(How = How.ClassName, Using = "eu-cookies-bar-tick")]
|
||||
|
||||
private IWebElement _clickcookieaccept;
|
||||
|
||||
[FindsBy(How = How.Id, Using = "menu-item-439")]
|
||||
private IWebElement _clickzasadyochrany;
|
||||
|
||||
public HomePage(IWebDriver driver)
|
||||
{
|
||||
_driver = driver;
|
||||
@ -29,7 +32,13 @@ namespace LukanPOM.PageObjects
|
||||
|
||||
public void AcceptCookie()
|
||||
{
|
||||
_clickcookieaccept.FindElement(By.XPath("//div[2]/span")).Click();
|
||||
_clickcookieaccept.Click();
|
||||
|
||||
}
|
||||
public void ZasadyOchrany()
|
||||
{
|
||||
_clickzasadyochrany.Click();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,13 +25,14 @@ namespace LukanPOM.Tests
|
||||
{
|
||||
new DriverManager().SetUpDriver(new ChromeConfig());
|
||||
_driver = new ChromeDriver();
|
||||
_driver.Manage().Window.Maximize();
|
||||
}
|
||||
[Test]
|
||||
public void TestCookie()
|
||||
{
|
||||
HomePage hp = new HomePage(_driver);
|
||||
_driver.Navigate().GoToUrl("https://lukan.cz");
|
||||
hp.AcceptCookie();
|
||||
hp.ZasadyOchrany();
|
||||
|
||||
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
1071702459
|
||||
385966025
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
1079435842
|
||||
1431067145
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
37
SeleniumNunitProject/Tests/TestBase/TestBase.cs
Normal file
37
SeleniumNunitProject/Tests/TestBase/TestBase.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using NUnit.Framework;
|
||||
using OpenQA.Selenium;
|
||||
using OpenQA.Selenium.Firefox;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PageObjects.PageObjects;
|
||||
|
||||
namespace Tests.Common
|
||||
{
|
||||
internal class TestBase
|
||||
{
|
||||
public WebFormPage WebForm { get; private set; }
|
||||
protected IWebDriver Driver { get; private set; }
|
||||
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Driver = new FirefoxDriver();
|
||||
Driver.Manage().Window.Maximize();
|
||||
Driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/web-form.html");
|
||||
Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
|
||||
|
||||
WebForm = new WebFormPage(Driver);
|
||||
}
|
||||
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
Driver.Quit();
|
||||
}
|
||||
}
|
||||
}
|
@ -7,8 +7,18 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="TestBase\" />
|
||||
<Folder Include="Tests\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
|
||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="Selenium.Support" Version="4.11.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PageObjects\PageObjects.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
12
SeleniumNunitProject/Tests/Tests/WebFormTests.cs
Normal file
12
SeleniumNunitProject/Tests/Tests/WebFormTests.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tests.Tests
|
||||
{
|
||||
internal class WebFormTests
|
||||
{
|
||||
}
|
||||
}
|
@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = Tests
|
||||
build_property.ProjectDir = c:\Users\lukas\Nextcloud\GitHub\.Net_C.Sharp_Test\SeleniumNunitProject\Tests\
|
||||
build_property.ProjectDir = C:\Users\lukas\Nextcloud\GitHub\.Net_C.Sharp_Test\SeleniumNunitProject\Tests\
|
||||
|
Binary file not shown.
Binary file not shown.
@ -4,14 +4,14 @@
|
||||
"C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\SeleniumNunitProject\\Tests\\Tests.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\SeleniumNunitProject\\Tests\\Tests.csproj": {
|
||||
"C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\SeleniumNunitProject\\PageObjects\\PageObjects.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\SeleniumNunitProject\\Tests\\Tests.csproj",
|
||||
"projectName": "Tests",
|
||||
"projectPath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\SeleniumNunitProject\\Tests\\Tests.csproj",
|
||||
"projectUniqueName": "C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\SeleniumNunitProject\\PageObjects\\PageObjects.csproj",
|
||||
"projectName": "PageObjects",
|
||||
"projectPath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\SeleniumNunitProject\\PageObjects\\PageObjects.csproj",
|
||||
"packagesPath": "C:\\Users\\lukas\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\SeleniumNunitProject\\Tests\\obj\\",
|
||||
"outputPath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\SeleniumNunitProject\\PageObjects\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\lukas\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
@ -39,6 +39,117 @@
|
||||
"frameworks": {
|
||||
"net6.0": {
|
||||
"targetAlias": "net6.0",
|
||||
"dependencies": {
|
||||
"DotNetSeleniumExtras.PageObjects.Core": {
|
||||
"target": "Package",
|
||||
"version": "[4.3.0, )"
|
||||
},
|
||||
"Microsoft.NET.Test.Sdk": {
|
||||
"target": "Package",
|
||||
"version": "[17.5.0, )"
|
||||
},
|
||||
"NUnit": {
|
||||
"target": "Package",
|
||||
"version": "[3.13.3, )"
|
||||
},
|
||||
"NUnit.Analyzers": {
|
||||
"target": "Package",
|
||||
"version": "[3.6.1, )"
|
||||
},
|
||||
"NUnit3TestAdapter": {
|
||||
"target": "Package",
|
||||
"version": "[4.4.2, )"
|
||||
},
|
||||
"Selenium.Support": {
|
||||
"target": "Package",
|
||||
"version": "[4.11.0, )"
|
||||
},
|
||||
"Selenium.WebDriver": {
|
||||
"target": "Package",
|
||||
"version": "[4.11.0, )"
|
||||
},
|
||||
"coverlet.collector": {
|
||||
"target": "Package",
|
||||
"version": "[3.2.0, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.400\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\SeleniumNunitProject\\Tests\\Tests.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\SeleniumNunitProject\\Tests\\Tests.csproj",
|
||||
"projectName": "Tests",
|
||||
"projectPath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\SeleniumNunitProject\\Tests\\Tests.csproj",
|
||||
"packagesPath": "C:\\Users\\lukas\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\SeleniumNunitProject\\Tests\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\lukas\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net6.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net6.0": {
|
||||
"targetAlias": "net6.0",
|
||||
"projectReferences": {
|
||||
"C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\SeleniumNunitProject\\PageObjects\\PageObjects.csproj": {
|
||||
"projectPath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\SeleniumNunitProject\\PageObjects\\PageObjects.csproj"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net6.0": {
|
||||
"targetAlias": "net6.0",
|
||||
"dependencies": {
|
||||
"Microsoft.NET.Test.Sdk": {
|
||||
"target": "Package",
|
||||
"version": "[17.7.1, )"
|
||||
},
|
||||
"NUnit": {
|
||||
"target": "Package",
|
||||
"version": "[3.13.3, )"
|
||||
},
|
||||
"NUnit3TestAdapter": {
|
||||
"target": "Package",
|
||||
"version": "[4.5.0, )"
|
||||
},
|
||||
"Selenium.Support": {
|
||||
"target": "Package",
|
||||
"version": "[4.11.0, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
|
@ -12,4 +12,14 @@
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\lukas\.nuget\packages\" />
|
||||
</ItemGroup>
|
||||
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<Import Project="$(NuGetPackageRoot)nunit3testadapter\4.5.0\build\netcoreapp3.1\NUnit3TestAdapter.props" Condition="Exists('$(NuGetPackageRoot)nunit3testadapter\4.5.0\build\netcoreapp3.1\NUnit3TestAdapter.props')" />
|
||||
<Import Project="$(NuGetPackageRoot)nunit\3.13.3\build\NUnit.props" Condition="Exists('$(NuGetPackageRoot)nunit\3.13.3\build\NUnit.props')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.testplatform.testhost\17.7.1\build\netcoreapp3.1\Microsoft.TestPlatform.TestHost.props" Condition="Exists('$(NuGetPackageRoot)microsoft.testplatform.testhost\17.7.1\build\netcoreapp3.1\Microsoft.TestPlatform.TestHost.props')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.codecoverage\17.7.1\build\netstandard2.0\Microsoft.CodeCoverage.props" Condition="Exists('$(NuGetPackageRoot)microsoft.codecoverage\17.7.1\build\netstandard2.0\Microsoft.CodeCoverage.props')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.net.test.sdk\17.7.1\build\netcoreapp3.1\Microsoft.NET.Test.Sdk.props" Condition="Exists('$(NuGetPackageRoot)microsoft.net.test.sdk\17.7.1\build\netcoreapp3.1\Microsoft.NET.Test.Sdk.props')" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<PkgNUnit_Analyzers Condition=" '$(PkgNUnit_Analyzers)' == '' ">C:\Users\lukas\.nuget\packages\nunit.analyzers\3.6.1</PkgNUnit_Analyzers>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -1,2 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<Import Project="$(NuGetPackageRoot)selenium.webdriver\4.11.0\buildTransitive\Selenium.WebDriver.targets" Condition="Exists('$(NuGetPackageRoot)selenium.webdriver\4.11.0\buildTransitive\Selenium.WebDriver.targets')" />
|
||||
<Import Project="$(NuGetPackageRoot)netstandard.library\2.0.0\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('$(NuGetPackageRoot)netstandard.library\2.0.0\build\netstandard2.0\NETStandard.Library.targets')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.codecoverage\17.7.1\build\netstandard2.0\Microsoft.CodeCoverage.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.codecoverage\17.7.1\build\netstandard2.0\Microsoft.CodeCoverage.targets')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.net.test.sdk\17.7.1\build\netcoreapp3.1\Microsoft.NET.Test.Sdk.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.net.test.sdk\17.7.1\build\netcoreapp3.1\Microsoft.NET.Test.Sdk.targets')" />
|
||||
</ImportGroup>
|
||||
</Project>
|
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,25 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "vFLRFkBzZ3EQHuMjpNU8WzVeCXiXTPC8OqP4qgrVYKXh7Lstix1Neve4y8Mn+JeKj6WBXg7qB5bRL0PDjJWhQg==",
|
||||
"dgSpecHash": "JqgqG2o0+QRFq/7NMUbxth10Cldhde7CjWWMb4XuVeC7s663hf/jyr5aHDjEYehsNQR8KRZochn5Jh8TK+Rdtg==",
|
||||
"success": true,
|
||||
"projectFilePath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\SeleniumNunitProject\\Tests\\Tests.csproj",
|
||||
"expectedPackageFiles": [],
|
||||
"expectedPackageFiles": [
|
||||
"C:\\Users\\lukas\\.nuget\\packages\\coverlet.collector\\3.2.0\\coverlet.collector.3.2.0.nupkg.sha512",
|
||||
"C:\\Users\\lukas\\.nuget\\packages\\dotnetseleniumextras.pageobjects.core\\4.3.0\\dotnetseleniumextras.pageobjects.core.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\lukas\\.nuget\\packages\\microsoft.codecoverage\\17.7.1\\microsoft.codecoverage.17.7.1.nupkg.sha512",
|
||||
"C:\\Users\\lukas\\.nuget\\packages\\microsoft.net.test.sdk\\17.7.1\\microsoft.net.test.sdk.17.7.1.nupkg.sha512",
|
||||
"C:\\Users\\lukas\\.nuget\\packages\\microsoft.netcore.platforms\\1.1.0\\microsoft.netcore.platforms.1.1.0.nupkg.sha512",
|
||||
"C:\\Users\\lukas\\.nuget\\packages\\microsoft.testplatform.objectmodel\\17.7.1\\microsoft.testplatform.objectmodel.17.7.1.nupkg.sha512",
|
||||
"C:\\Users\\lukas\\.nuget\\packages\\microsoft.testplatform.testhost\\17.7.1\\microsoft.testplatform.testhost.17.7.1.nupkg.sha512",
|
||||
"C:\\Users\\lukas\\.nuget\\packages\\netstandard.library\\2.0.0\\netstandard.library.2.0.0.nupkg.sha512",
|
||||
"C:\\Users\\lukas\\.nuget\\packages\\newtonsoft.json\\13.0.1\\newtonsoft.json.13.0.1.nupkg.sha512",
|
||||
"C:\\Users\\lukas\\.nuget\\packages\\nuget.frameworks\\6.5.0\\nuget.frameworks.6.5.0.nupkg.sha512",
|
||||
"C:\\Users\\lukas\\.nuget\\packages\\nunit\\3.13.3\\nunit.3.13.3.nupkg.sha512",
|
||||
"C:\\Users\\lukas\\.nuget\\packages\\nunit.analyzers\\3.6.1\\nunit.analyzers.3.6.1.nupkg.sha512",
|
||||
"C:\\Users\\lukas\\.nuget\\packages\\nunit3testadapter\\4.5.0\\nunit3testadapter.4.5.0.nupkg.sha512",
|
||||
"C:\\Users\\lukas\\.nuget\\packages\\selenium.support\\4.11.0\\selenium.support.4.11.0.nupkg.sha512",
|
||||
"C:\\Users\\lukas\\.nuget\\packages\\selenium.webdriver\\4.11.0\\selenium.webdriver.4.11.0.nupkg.sha512",
|
||||
"C:\\Users\\lukas\\.nuget\\packages\\system.reflection.metadata\\1.6.0\\system.reflection.metadata.1.6.0.nupkg.sha512"
|
||||
],
|
||||
"logs": []
|
||||
}
|
@ -1 +1,5 @@
|
||||
New Project --> Class Library
|
||||
|
||||
Do instalovat package --> tento projekt vzor
|
||||
|
||||
WebFormPage v TestBase inicializovat using PageObjects.PageObjects;
|
@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = ZiveNUnitProject
|
||||
build_property.ProjectDir = C:\Users\lukas\Nextcloud\GitHub\.Net_C.Sharp_Test\ZiveNUnitProject\ZiveNUnitProject\
|
||||
build_property.ProjectDir = c:\Users\lukas\Nextcloud\GitHub\.Net_C.Sharp_Test\ZiveNUnitProject\ZiveNUnitProject\
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user