How to implement base page object and inherit it.
using Atata;
namespace SampleApp.UITests
{
public class BasePage<TOwner> : Page<TOwner>
where TOwner : BasePage<TOwner>
{
public TextInput<TOwner> SomeInput { get; private set; }
public TOwner SomeMethod()
{
// TODO: Do something.
return (TOwner)this;
}
}
}
using Atata;
namespace SampleApp.UITests
{
using _ = InheritedPage;
public class InheritedPage : BasePage<_>
{
public TextInput<_> SomeOtherInput { get; private set; }
}
}
using Atata;
namespace SampleApp.UITests
{
using _ = InheritedPage;
[VerifyTitle("Some Title")]
public class InheritedPage : BasePage<_>
{
protected override void OnInit()
{
base.OnInit();
SomeInput.Triggers.Add(new PressEnterAttribute(TriggerEvents.AfterSet));
}
}
}
using Atata;
namespace SampleApp.UITests
{
public class BasePage<TOwner> : Page<TOwner>
where TOwner : BasePage<TOwner>
{
public FooterSection Footer { get; private set; }
[ControlDefinition("footer")]
public class FooterSection : Control<TOwner>
{
}
}
}