Skip to content

Instantly share code, notes, and snippets.

View YevgeniyShunevych's full-sized avatar

Yevgeniy Shunevych YevgeniyShunevych

View GitHub Profile
@YevgeniyShunevych
YevgeniyShunevych / LabeledRadioButton`1.cs
Created November 21, 2018 21:00
Atata control for radio button wrapped by label. Direct click on radio button is not allowed so need to click on label.
namespace Atata
{
[ControlDefinition("input[@type='radio'][parent::label]", ComponentTypeName = "radio button", Visibility = Visibility.Any, IgnoreNameEndings = "RadioButton,Radio,Button,Option")]
public class LabeledRadioButton<TOwner> : RadioButton<TOwner>
where TOwner : PageObject<TOwner>
{
[FindFirst(OuterXPath = "parent::")]
[TraceLog]
public Label<TOwner> WrapperLabel { get; private set; }
@YevgeniyShunevych
YevgeniyShunevych / LabelList`1.cs
Created November 23, 2018 19:28
Atata approach to get associated labels
using System;
namespace Atata
{
public class LabelList<TOwner> : ControlList<Label<TOwner>, TOwner>
where TOwner : PageObject<TOwner>
{
public Label<TOwner> this[Func<TOwner, Control<TOwner>> controlSelector]
{
get { return For(controlSelector); }
@YevgeniyShunevych
YevgeniyShunevych / LabelContainerList`1.cs
Created November 23, 2018 20:29
Atata approach to get associated label container elements
using System;
namespace Atata
{
public class LabelContainerList<TOwner> : ControlList<Text<TOwner>, TOwner>
where TOwner : PageObject<TOwner>
{
public Text<TOwner> this[Func<TOwner, Control<TOwner>> controlSelector]
{
get { return For(controlSelector); }
@YevgeniyShunevych
YevgeniyShunevych / PageObjectExtensions.cs
Last active November 30, 2018 15:30
Atata - refresh page and wait until condition is met
using System;
namespace Atata
{
public static class PageObjectExtensions
{
public static TOwner RefreshPageAndWaitUntil<TOwner>(this TOwner pageObject, Func<TOwner, bool> predicate, double timeout, double retryInterval)
where TOwner : PageObject<TOwner>
{
TOwner activePageObject = pageObject;
@YevgeniyShunevych
YevgeniyShunevych / SampleTests.cs
Created March 5, 2019 13:34
Atata dynamic URL navigation using argument
using Atata;
using NUnit.Framework;
namespace SampleApp.UITests
{
public class SampleTests : UITestFixture
{
[Test]
public void GoToWorkspacePageById()
{
@YevgeniyShunevych
YevgeniyShunevych / SampleTests.cs
Created March 5, 2019 13:38
Atata dynamic URL navigation using argument #2
using Atata;
using NUnit.Framework;
namespace SampleApp.UITests
{
public class SampleTests : UITestFixture
{
[Test]
public void GoToWorkspacePageById()
{
@YevgeniyShunevych
YevgeniyShunevych / MDDialog`1.cs
Last active March 11, 2019 10:59
Atata component for AngularJS Material Dialog
namespace Atata.AngularJS.Material
{
[PageObjectDefinition("md-dialog", ComponentTypeName = "dialog", IgnoreNameEndings = "PopupWindow,Window,Popup,Modal,Dialog,DialogWindow")]
[WindowTitleElementDefinition(TitleXPath)]
[WaitFor(Until.MissingOrHidden, TriggerEvents.DeInit)]
public class MDDialog<TOwner> : PopupWindow<TOwner>
where TOwner : MDDialog<TOwner>
{
private const string TitleXPath = "*[contains(concat(' ', normalize-space(@class), ' '), ' md-title ') or self::h2]";
@YevgeniyShunevych
YevgeniyShunevych / FindByPrecedingSpanAttribute.cs
Last active March 18, 2019 10:39
Custom Atata FindByXPathAttribute
namespace Atata
{
public class FindByPrecedingSpanAttribute : FindByXPathAttribute
{
public FindByPrecedingSpanAttribute(params string[] terms)
: this(TermMatch.Equals, terms)
{
}
public FindByPrecedingSpanAttribute(TermMatch match, params string[] terms)
@YevgeniyShunevych
YevgeniyShunevych / SamplePage.cs
Created March 18, 2019 10:54
How to get Atata control using variable
using Atata;
namespace SomeApp.UITests
{
using _ = SamplePage;
public class SamplePage : Page<_>
{
public Control<_> GetSomeSpecificControl(string text)
{
@YevgeniyShunevych
YevgeniyShunevych / SamplePage.cs
Created July 2, 2019 12:18
How to get Atata control by attribute using variable
using Atata;
namespace SomeApp.UITests
{
using _ = SamplePage;
public class SamplePage : Page<_>
{
public Control<_> GetSomeControl(string attributeValue)
{