playwright project

This commit is contained in:
Lukáš Kaňka 2023-08-24 22:18:22 +02:00
parent e31b2bd477
commit 37fc3e4933
39 changed files with 111 additions and 19 deletions

View File

@ -0,0 +1,41 @@
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
namespace LukanNUnitProject.Tests
{
internal class AcceptCookie
{
IWebDriver driver = new ChromeDriver();
[SetUp]
public void Setup()
{
driver.Navigate()
.GoToUrl("https://lukan.cz");
//Maximize the browser window
driver.Manage().Window.Maximize();
Console.WriteLine("Author: Lukáš Kaňka");
}
[Test]
public void ClickAcceptCookie()
{
// přijetí cookies
IWebElement cookies = driver.FindElement(By.XPath("//div[2]/span"));
cookies.Click();
}
[TearDown]
public void EndTest()
{
//close the browser
driver.Close();
}
}
}

View File

@ -0,0 +1,40 @@
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
namespace LukanNUnitProject.Tests
{
internal class DeclineCookie
{
IWebDriver driver = new ChromeDriver();
[SetUp]
public void Setup()
{
driver.Navigate()
.GoToUrl("https://lukan.cz");
driver.Manage().Window.Maximize();
Console.WriteLine("Author: Lukáš Kaňka");
}
[Test]
public void ClickDeclineCookie()
{
// přijetí cookies
IWebElement cookies = driver.FindElement(By.XPath("//div[3]/span"));
cookies.Click();
}
[TearDown]
public void EndTest()
{
driver.Close();
}
}
}

View File

@ -1 +1 @@
62d05e87b5c4b696db0251f8b60212e06f068668
e27b2c6719d9dae0abb0477aa00399fc92a9448b

View File

@ -0,0 +1,2 @@
{
}

View File

@ -1 +1 @@
953933157
1004409487

View File

@ -0,0 +1 @@
741957598

View File

@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = PlaywrightTests
build_property.ProjectDir = C:\Users\lukas\Nextcloud\GitHub\.Net_C.Sharp_Test\PlaywrightProject\PlaywrightTests\
build_property.ProjectDir = c:\Users\lukas\Nextcloud\GitHub\.Net_C.Sharp_Test\PlaywrightProject\PlaywrightTests\

View File

@ -1 +1 @@
f3ecb22e687cda2ef657b489fdd0fcb0d5d700a4
9c1b87ca2978f0a194f5bbcccaacd302eb0f0df1

View File

@ -1 +1 @@
c06f5417b12040fc61afae3e7aac936253c4f676
b7da205d9cf056a53d83d1956f1df5f1ecefda80

View File

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

View File

@ -1,8 +1,8 @@
{
"version": 2,
"dgSpecHash": "wNCD7gr1/dMUVxBk4hBWKXSW/kACRT9c+NQs+Ots9mvlpJl+jxEdCEXMxhSzg3qH7BMjWvAmnLBGWV8vaT/UQw==",
"dgSpecHash": "DNRbnAmjsyGYMkT3/Vyn5uB3j5P+O1ZMtkn7yzZ7ARdywChKdQa8xHvcmd5uF1vKVx70rr+NL2C9tQVUsxAF8Q==",
"success": true,
"projectFilePath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\PlaywrightProject\\PlaywrightTests\\PlaywrightTests.csproj",
"projectFilePath": "c:\\Users\\lukas\\Nextcloud\\GitHub\\.Net_C.Sharp_Test\\PlaywrightProject\\PlaywrightTests\\PlaywrightTests.csproj",
"expectedPackageFiles": [
"C:\\Users\\lukas\\.nuget\\packages\\coverlet.collector\\3.2.0\\coverlet.collector.3.2.0.nupkg.sha512",
"C:\\Users\\lukas\\.nuget\\packages\\microsoft.bcl.asyncinterfaces\\7.0.0\\microsoft.bcl.asyncinterfaces.7.0.0.nupkg.sha512",

View File

@ -11,6 +11,7 @@ namespace PageObjects.PageObjects
{
// locators
IWebElement TextArea => driver.FindElement(By.Name("my-textarea"));
IWebElement SubmitBtn => driver.FindElement(By.TagName("button"));
IWebDriver driver;

View File

@ -6,10 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="Tests\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="NUnit" Version="3.13.3" />

View File

@ -1,12 +1,23 @@
using System;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tests.Common;
namespace Tests.Tests
{
internal class WebFormTests
internal class WebFormTests : TestBase
{
[Test]
public void WriteToTextAreaTest()
{
var text = Guid.NewGuid().ToString();
WebForm
.WriteTextToTextArea(text);
}
}
}