Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is the difference between Link and DelegateLink on Atata framework?

I could not figure out from the documentation the difference between Link and LinkDelegate components.

https://atata-framework.github.io/components/#link

Could someone explain on which scenarios would you use each one?

like image 203
Reuel Ribeiro Avatar asked Oct 17 '25 03:10

Reuel Ribeiro


1 Answers

The main difference is a usage syntax.

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 don't verify it's state, you can use delegate option, to keep short call syntax.

like image 63
Yevgeniy Shunevych Avatar answered Oct 18 '25 18:10

Yevgeniy Shunevych