Skip to content

Consider string as a scope #408

@ro0gr

Description

@ro0gr

This is a feature request to slightly improve ergonomic of the Page Object Components definition.

Currently the shortest form of a component definition would look something like:

{
  someField: {
    scope: 'some-field-selector'
  }
}

When I define few components on a page object it gets a bit noisy because we need to define an object with a scope option to create a component. For me the most used building blocks of the Page Object are Components. I think it's great to have a shorthand syntax for component definitions like we do have for collections, e.g collection('items-selector').

I propose to consider all the string values of a page object definition as a component selectors, so the minimal syntax to define a page object would look something like:

create({
  header: 'header',
  body: 'article',
  header: 'footer',  
  signOut: '[data-test-logout]',
  breadcrumbs: collection('[date-test-breadcrumb]')
});

This change might break some existing page objects but honestly I can't imagine a use case for the need to store string values in the page object definition 🤔 Probably the feature (if)should be included in v2.

Would appreciate any thoughts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions