You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem
Currently only one custom test instance can be provided via importTestFrom option. In many cases this is no enough. Depending on project structure, different groups of tests may require own auto-fixtures, not applicable for other tests. Even without auto-fixtures sometimes it's more convenient to keep fixtures separated instead of having all-in-one test.extend.
Imagine we have an app that has 3 main parts: user login, todo list and administration of uses. Each part could have own Page Object Models and fixtures. Example structure:
Currently to run such tests with playwright-bdd we need to combine all fixtures.ts into one and point to it with importTestFrom.
Describe the solution
The solution I'm thinking about - is to refuse using importTestFrom at all. Technically, when we know all steps used in particular feature file, we can detect what test instance should be imported. To achieve it we need to switch from Cucumber's steps loading to own implementation (that is already used for decorator steps). To make it backwards compatible I can add new config option steps: string | string[] that should point to all steps definitions including fixtures. When steps option is defined, no need for Cucumber's require or import options and also no need for importTestFrom. The config will look very simple:
Describe alternatives you've considered
Alternatively we can allow passing object to importTestFrom mapping different features with different test instances, e.g.:
Playwright-bdd v7 brings auto-detection of importTestFrom that allows to omit this option in most cases.
The importTestFrom option is not removed, because there still can be situations where it is required.
Feel free to create new issue if there are any problems with it.
Describe the problem
Currently only one custom test instance can be provided via
importTestFrom
option. In many cases this is no enough. Depending on project structure, different groups of tests may require own auto-fixtures, not applicable for other tests. Even without auto-fixtures sometimes it's more convenient to keep fixtures separated instead of having all-in-onetest.extend
.Imagine we have an app that has 3 main parts: user login, todo list and administration of uses. Each part could have own Page Object Models and fixtures. Example structure:
Currently to run such tests with playwright-bdd we need to combine all
fixtures.ts
into one and point to it withimportTestFrom
.Describe the solution
The solution I'm thinking about - is to refuse using
importTestFrom
at all. Technically, when we know all steps used in particular feature file, we can detect whattest
instance should be imported. To achieve it we need to switch from Cucumber's steps loading to own implementation (that is already used for decorator steps). To make it backwards compatible I can add new config optionsteps: string | string[]
that should point to all steps definitions including fixtures. Whensteps
option is defined, no need for Cucumber'srequire
orimport
options and also no need forimportTestFrom
. The config will look very simple:Describe alternatives you've considered
Alternatively we can allow passing object to
importTestFrom
mapping different features with different test instances, e.g.:This is less convenient as we need manually sync changes in files structure with config.
The text was updated successfully, but these errors were encountered: