Skip to content

Commit

Permalink
поправил структуру
Browse files Browse the repository at this point in the history
  • Loading branch information
lgnv committed Dec 8, 2024
1 parent bebdc6d commit 7f9c45a
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 69 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Newtonsoft.Json;
using NUnit.Framework;

namespace Advanced.Classwork.Approvals;
namespace Advanced.Classwork.ApprovalsTests;

[TestFixture]
[Explicit]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text.Json.Serialization;

namespace Advanced.Classwork.Approvals;
namespace Advanced.Classwork.ApprovalsTests;

public class Product
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Drawing;

namespace Advanced.Classwork.Approvals;
namespace Advanced.Classwork.ApprovalsTests;

public class Puzzle15
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using log4net.Config;
using NUnit.Framework;

namespace Advanced.Samples.ApprovalsSample;
namespace Advanced.Samples.ApprovalsTests;

[TestFixture]
[Explicit]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using ApprovalTests.Reporters;
using NUnit.Framework;

namespace Advanced.Samples.ApprovalsSample;
namespace Advanced.Samples.ApprovalsTests;

[TestFixture]
[Explicit]
Expand Down
63 changes: 63 additions & 0 deletions Testing/Advanced/Samples/3. InterfaceTests/Silenium.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using FluentAssertions;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;

namespace Advanced.Samples.Interface;

[TestFixture]
[Explicit]
internal class Silenium
{
private ChromeDriver webDriver;

[SetUp]
public void SetUp()
{
webDriver = new ChromeDriver();
}

[TearDown]
public void TearDown()
{
webDriver.Dispose();
}

/*
* Для поиска местоположения веб-элемента из DOM используются локатор.
* Дальнейшее взаимодейтействием выполняется относительно найденого элемента.
* Несколько популярных локаторов в Selenium - ID, Name, Link Text, Partial Link Text, CSS Selectors, XPath, TagName и т.д.
*/

[Test]
public void Google()
{
webDriver.Url = "https://www.google.com";

/*
* В HTML у инпута поиска такая верстка:
* <textarea ... title="Search" name="q"></textarea>
*/
var searchControl = webDriver.FindElement(By.Name("q"));

searchControl.SendKeys("Контур");
searchControl.SendKeys(Keys.Enter);

webDriver.Title.Should().Be("Контур - Поиск в Google");
}

[Test]
public void Wikipedia_KonturCreatedDate_ShouldBe1988()
{
webDriver.Url = "https://www.wikipedia.org/";

var searchControl = webDriver.FindElement(By.Name("search"));
searchControl.SendKeys("СКБ Контур");
searchControl.SendKeys(Keys.Enter);

// Как получился такой локатор? Стоит ли использовать такие локаторы для тестирования?
var locator = By.CssSelector("#mw-content-text > div.mw-content-ltr.mw-parser-output > table.infobox.infobox-3578c39699877354 > tbody > tr:nth-child(5)");
var createdYearCell = webDriver.FindElement(locator);
createdYearCell.Text.Should().Contain("Основание 1988");
}
}
64 changes: 0 additions & 64 deletions Testing/Advanced/Samples/Silenium.cs

This file was deleted.

0 comments on commit 7f9c45a

Please sign in to comment.