Formwright
    Preparing search index...

    Variable selectorsConst

    selectors: {
        field: (path: string) => string;
        form: (name?: string) => string;
        option: (key: string) => string;
    } = ...

    Harnesses drive a Formwright form the way a user would, through the normalized data-test-fw-* selectors every Formwright form renders:

    data-test-fw-form="<name>"      the <form> (or a nested form's <fieldset>)
    data-test-fw-field="<path>" a field, by its normalized model path
    data-test-fw-path="<a.b.path>" the field's path from the root form
    data-test-fw-type="<control>" the field's control name
    data-test-fw-label | -hint | -error | -display | -commit | -cancel
    data-test-fw-option="<key>" one option of a select, radio or checkbox group
    data-test-fw-submit | -reset | -button

    Describe a form once as a class, and its fields and nested forms with decorators:

    class SignupForm extends FormHarness {
    static formName = 'signup'
    @field(InputHarness) declare email: InputHarness
    @field(SelectHarness, 'plan.id') declare plan: SelectHarness
    @form(AddressForm) declare address: AddressForm
    }

    Child harnesses are created on first use and kept, so signup.email is one object for the life of signup. Only the DOM lookup behind it is live, so it survives re-renders.

    Type Declaration

    • field: (path: string) => string
    • form: (name?: string) => string
    • option: (key: string) => string