pom object zive, visual studio 2022

This commit is contained in:
Lukáš Kaňka
2023-08-31 21:26:24 +02:00
parent a19045ea77
commit 994b1ae271
122 changed files with 985 additions and 20 deletions

View File

@ -0,0 +1,3 @@
{
"dotnet.defaultSolution": "ZiveNUnitProject.sln"
}

View File

@ -0,0 +1,56 @@
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 ZiveNunitProject.PageObjects
{
public class HomePage
{
private IWebDriver driver;
IWebElement cookiesAccept => driver.FindElement(By.XPath("//button[@id='didomi-notice-agree-button']/span"));
public HomePage(IWebDriver driver)
{
this.driver = driver;
}
public HomePage Titulek()
{
string actualTitle = driver.Title;
string expectedTitle = "<22>iv<69>.cz <20> O po<70><6F>ta<74><61>ch, internetu, v<>d<EFBFBD> a technice";
Assert.AreEqual(expectedTitle, actualTitle);
return this;
}
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;
}
public void AcceptCoockies()
{
cookiesAccept.Click();
}
}
}

View File

@ -0,0 +1,39 @@
using OpenQA.Selenium.Chrome;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using ZiveNunitProject.PageObjects;
namespace ZiveNunitProject.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://zive.cz");
Console.WriteLine("Author: Luk<75><6B> Ka<4B>ka");
Home = new HomePage(Driver);
}
[TearDown]
public void TearDown()
{
Driver.Quit();
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZiveNunitProject.Common;
namespace ZiveNUnitProject.Tests;
internal class AcceptCookie : TestBase
{
[Test]
public void AcceptCookiesTest()
{
Home.AcceptCoockies();
}
}

View File

@ -20,8 +20,4 @@
<PackageReference Include="Selenium.WebDriver" Version="4.11.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Tests\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZiveNUnitProject", "ZiveNUnitProject.csproj", "{60251703-ED97-4CC2-81FD-ABC2D06EA7A2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{60251703-ED97-4CC2-81FD-ABC2D06EA7A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60251703-ED97-4CC2-81FD-ABC2D06EA7A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60251703-ED97-4CC2-81FD-ABC2D06EA7A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60251703-ED97-4CC2-81FD-ABC2D06EA7A2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5D4E8C89-F803-4D94-A812-BFFAD7636DA5}
EndGlobalSection
EndGlobal

View File

@ -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\

View File

@ -1 +1 @@
28723541a3b84690ed33d3c6cc11d1fc2eb278cc
48c99b10dfa7386438d40762cff6d30dd1fdc4f7

View File

@ -1 +1 @@
5e8a55eff8a7a352aed09574268f644c93ea2c11
c3bc808626d25481ce433edc68867da35a3e1faf

View File

@ -1,17 +1,17 @@
{
"format": 1,
"restore": {
"c:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\ZiveNUnitProject\\ZiveNUnitProject\\ZiveNUnitProject.csproj": {}
"C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\ZiveNUnitProject\\ZiveNUnitProject\\ZiveNUnitProject.csproj": {}
},
"projects": {
"c:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\ZiveNUnitProject\\ZiveNUnitProject\\ZiveNUnitProject.csproj": {
"C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\ZiveNUnitProject\\ZiveNUnitProject\\ZiveNUnitProject.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "c:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\ZiveNUnitProject\\ZiveNUnitProject\\ZiveNUnitProject.csproj",
"projectUniqueName": "C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\ZiveNUnitProject\\ZiveNUnitProject\\ZiveNUnitProject.csproj",
"projectName": "ZiveNUnitProject",
"projectPath": "c:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\ZiveNUnitProject\\ZiveNUnitProject\\ZiveNUnitProject.csproj",
"projectPath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\ZiveNUnitProject\\ZiveNUnitProject\\ZiveNUnitProject.csproj",
"packagesPath": "C:\\Users\\lukas\\.nuget\\packages\\",
"outputPath": "c:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\ZiveNUnitProject\\ZiveNUnitProject\\obj\\",
"outputPath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\ZiveNUnitProject\\ZiveNUnitProject\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\lukas\\AppData\\Roaming\\NuGet\\NuGet.Config",

View File

@ -1,8 +1,8 @@
{
"version": 2,
"dgSpecHash": "Mpt3rrrr3aIv172iP52qKEveddp9Y7qv5ocYa2pGtcSCmU7FH4PiBhg2cSWUYsqqLGP7pWJwwnImsfx/cenLeQ==",
"dgSpecHash": "Mhiytn3E4+Z+qSd0pZxzVJsw7NiqJt6gsbujYmipuD3hpBTcZrzy2q6HxmmACx39kgVS5HDW24KLxkyyttIM3Q==",
"success": true,
"projectFilePath": "c:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\ZiveNUnitProject\\ZiveNUnitProject\\ZiveNUnitProject.csproj",
"projectFilePath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\ZiveNUnitProject\\ZiveNUnitProject\\ZiveNUnitProject.csproj",
"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",