r/dotnet•
Ill_Dragonfly4346

Gherkin-based framework for autotests with Playwright integration

Hello, .NET Community

I want to present new Gherkin-based framework for autotests that allow you to write your Playwright based web tests

Syntax:

Feature: CheckoutForm

Scenario: checkout form validation test
    Given navigate to '@Data.Common.HomePageUrl'
    When set following values:
    | Name                  | Value      |
    | checkout > first name | first_name |
    | checkout > last name  | last_name  |
    And click on 'checkout > continue to checkout'
    Then should be visible:
    | Name                              |
    | checkout > username error message |
    And should have following values:
    | Name                              | Value                      |
    | checkout > username error message | Your username is required. |

Page objects:

using AutoTests.Framework.Pages;

namespace Bootstrap.Tests.Pages;

internal sealed class BootstrapApplication
{
    [Route("checkout")]
    public required Checkout Checkout { get; init; }
}

internal sealed class Checkout
{
    [Route("continue to checkout")]
    [Options(".btn-primary")]
    public required Button ContinueToCheckout { get; init; }

    [Route("first name")]
    [Options("#firstName")]
    public required Input FirstName { get; init; }

    [Route("last name")]
    [Options("#lastName")]
    public required Input LastName { get; init; }

    [Route("username error message")]
    [Options("#username ~ .invalid-feedback")]
    public required Label UsernameErrorMessage { get; init; }
}

Github:
[https://github.com/Romfos/AutoTests.Framework](https://github.com/Romfos/AutoTests.Framework)

Posted Nov 28, 2025, 5:46 PM UTC

35
Loading comments…