What is the difference between Link and DelegateLink on the Atata platform?
I couldn't understand from the documentation the difference between components Link
and LinkDelegate
.
https://atata-framework.github.io/components/#link
Can someone please explain in what scenarios you will use each of these?
+3
source to share
1 answer
The main difference is the syntax of use.
using _ = SamplePage;
public class SamplePage : Page<SamplePage>
{
public Link<_> Save1 { get; private set; }
public LinkDelegate<_> Save2 { get; private set; }
public Link<SamplePage2, _> Navigate1 { get; private set; }
public LinkDelegate<SamplePage2, _> Navigate2 { get; private set; }
}
For internal links without navigation:
Go.To<SamplePage>().
// To click:
Save1.Click().
Save2(). // As it delegate, use it like a method. Provides shorter syntax.
// To verify:
Save1.Should.Exist().
Save2.Should().Exist(); // Should() is extension method.
For navigation links:
Go.To<SamplePage>().
Navigate1.ClickAndGo();
Go.To<SamplePage>().
Navigate2(); // Shorter syntax.
The same applies to Button
and ButtonDelegate
.
So, if you often need to call a link / button and not check its state, you can use a delegate to keep the calling syntax short.
+3
source to share