Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PageObjectVerificationProvider<TPageObject> for PageObject<TOwner> #271

Closed
YevgeniyShunevych opened this issue May 23, 2019 · 0 comments

Comments

1 participant
@YevgeniyShunevych
Copy link
Member

commented May 23, 2019

This feature should give an easier ability to create custom verification extension methods for page objects.

Changes

Create:

  • PageObjectVerificationProvider<TPageObject>
  • IPageObjectVerificationProvider<TPageObject>

Add property to PageObject:

public new PageObjectVerificationProvider<TOwner> Should { get; }

Usage

Custom verification extension methods:

public static class IPageObjectVerificationProviderExtensions
{
    // For generic page object.
    public static TPageObject BeOnEditPage<TPageObject>(this IPageObjectVerificationProvider<TPageObject> should)
        where TPageObject : PageObject<TPageObject>
    {
        return should.Component.PageUrl.Should.WithSettings(should).Contain("/Edit.aspx");
    }

    // For specific page object.
    public static SomePage HaveSomething(this IPageObjectVerificationProvider<SomePage> should)
    {
        return should.Component.SomeProperty.Should.WithSettings(should).Equal("...");
    }
}

Using of extension methods:

Go.To<SomePage>().
    Should.BeOnEditPage().
    Should.HaveSomething();

@YevgeniyShunevych YevgeniyShunevych added this to the 1.2.0 milestone May 23, 2019

@YevgeniyShunevych YevgeniyShunevych self-assigned this May 23, 2019

YevgeniyShunevych added a commit that referenced this issue May 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.