-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Reverse mode: auto-generate BDD scenarios #30
Labels
Comments
I've also found that there is jsonl output for Playwright's codegen, that can be turned into BDD steps with less effort. {"browserName":"chromium","launchOptions":{"headless":false},"contextOptions":{}}
{"name":"openPage","url":"about:blank","signals":[],"pageAlias":"page"}
{"name":"navigate","url":"https://demo.playwright.dev/todomvc/","signals":[],"pageAlias":"page"}
{"name":"navigate","url":"https://demo.playwright.dev/todomvc/#/","signals":[],"pageAlias":"page"}
{"name":"fill","selector":"internal:attr=[placeholder=\"What needs to be done?\"i]","signals":[],"text":"todo 1","pageAlias":"page","locator":{"kind":"placeholder","body":"What needs to be done?","options":{"exact":false}}}
{"name":"press","selector":"internal:attr=[placeholder=\"What needs to be done?\"i]","signals":[],"key":"Enter","modifiers":0,"pageAlias":"page","locator":{"kind":"placeholder","body":"What needs to be done?","options":{"exact":false}}}
{"name":"fill","selector":"internal:attr=[placeholder=\"What needs to be done?\"i]","signals":[],"text":"todo 2","pageAlias":"page","locator":{"kind":"placeholder","body":"What needs to be done?","options":{"exact":false}}}
{"name":"press","selector":"internal:attr=[placeholder=\"What needs to be done?\"i]","signals":[],"key":"Enter","modifiers":0,"pageAlias":"page","locator":{"kind":"placeholder","body":"What needs to be done?","options":{"exact":false}}}
{"name":"check","selector":"internal:role=listitem >> internal:has-text=\"todo 1\"i >> internal:role=checkbox[name=\"Toggle Todo\"i]","signals":[],"pageAlias":"page","locator":{"kind":"role","body":"listitem","options":{"attrs":[]},"next":{"kind":"has-text","body":"todo 1","options":{"exact":false},"next":{"kind":"role","body":"checkbox","options":{"attrs":[],"exact":false,"name":"Toggle Todo"}}}}}
{"name":"click","selector":"internal:role=link[name=\"Completed\"i]","signals":[{"name":"navigation","url":"https://demo.playwright.dev/todomvc/#/completed"}],"button":"left","modifiers":0,"clickCount":1,"pageAlias":"page","locator":{"kind":"role","body":"link","options":{"attrs":[],"exact":false,"name":"Completed"}}} |
This feature looks really nice, unfortunatelly not every project/webpage have good locators, so could be tricky for implementation. |
Really awesome idea but could be tough to develop |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Playwright there is a codegen feature that generates test-code while you perform actions in browser. What I'm thinking about is to generate BDD code in some similar way.
Imagine the following scenario:
In codegen mode Playwright will generate the test:
The code looks rather structured and it would be possible to convert it into BDD scenario:
Necessary step definitions can be generated as well:
If I record second scenario existing step definitions can be reused.
I feel that there can be edge cases, but developer can always fix it manually.
In general having such easy way to generate BDD scenarios looks useful to define project requirements and behavior.
Would appreciate your thoughts on that :)
The text was updated successfully, but these errors were encountered: