xUnit test, runner, delete Playwright
This commit is contained in:
37
xUnit.NET/Tests/Google_Search.cs
Normal file
37
xUnit.NET/Tests/Google_Search.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Xunit;
|
||||
using System;
|
||||
using OpenQA.Selenium;
|
||||
using OpenQA.Selenium.Chrome;
|
||||
|
||||
namespace Google_Search_xUnit;
|
||||
|
||||
public class UnitTest1
|
||||
{
|
||||
|
||||
[Fact]
|
||||
public void Test1()
|
||||
|
||||
{
|
||||
|
||||
// Otevře stránku google
|
||||
IWebDriver driver = new ChromeDriver();
|
||||
driver.Navigate().GoToUrl("https://www.google.com");
|
||||
driver.Manage().Window.Maximize();
|
||||
|
||||
// zamítne cookies google (odmítnout vše)
|
||||
IWebElement addButton = driver.FindElement(By.Id("W0wltc"));
|
||||
addButton.Click();
|
||||
|
||||
// napíše slovo test do vyhledávání a potvrdí
|
||||
IWebElement searchBox = driver.FindElement(By.Name("q"));
|
||||
searchBox.SendKeys("test");
|
||||
searchBox.Submit();
|
||||
|
||||
Thread.Sleep(3000);
|
||||
|
||||
driver.Quit();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
24
xUnit.NET/Tests/lukan_search.cs
Normal file
24
xUnit.NET/Tests/lukan_search.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using OpenQA.Selenium;
|
||||
using OpenQA.Selenium.Chrome;
|
||||
using Xunit;
|
||||
|
||||
namespace Search;
|
||||
|
||||
public class UnitTest1
|
||||
{
|
||||
[Fact]
|
||||
public void Test1()
|
||||
{
|
||||
IWebDriver driver = new ChromeDriver();
|
||||
driver.Navigate().GoToUrl("https://www.lukan.cz");
|
||||
driver.Manage().Window.Maximize();
|
||||
|
||||
IWebElement searchBox = driver.FindElement(By.Name("s"));
|
||||
searchBox.SendKeys("test");
|
||||
searchBox.Submit();
|
||||
|
||||
Thread.Sleep(3000);
|
||||
|
||||
driver.Quit();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user