-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
68 additions
and
69 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
.../Classwork/3. Approvals/ApprovalsTests.cs → ...swork/3. ApprovalsTests/ApprovalsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...dvanced/Classwork/3. Approvals/Product.cs → ...ed/Classwork/3. ApprovalsTests/Product.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...vanced/Classwork/3. Approvals/Puzzle15.cs → ...d/Classwork/3. ApprovalsTests/Puzzle15.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.