Skip to content

Conversation

wojtkowiak
Copy link
Contributor

@wojtkowiak wojtkowiak commented Apr 16, 2020

Motivation/Description of the PR

I was looking for a way to create a better BDD reporter but could not get a hook to a bdd steps. This adds a way to hook before/after a bdd step. Hope I did not mess this up as this is my first try here.

Applicable helpers:

  • WebDriver
  • Puppeteer
  • Nightmare
  • REST
  • FileHelper
  • Appium
  • Protractor
  • TestCafe
  • Playwright

Applicable plugins:

  • allure
  • autoDelay
  • autoLogin
  • customLocator
  • pauseOnFail
  • puppeteerCoverage
  • retryFailedStep
  • screenshotOnFail
  • selenoid
  • stepByStepReport
  • wdio

Type of change

  • 🔥 Breaking changes
  • 🚀 New functionality
  • 🐛 Bug fix
  • 📋 Documentation changes/updates
  • ♨️ Hot fix
  • 🔨 Markdown files fix - not related to source code
  • 💅 Polish code

Checklist:

  • Tests have been added
  • Documentation has been added (Run npm run docs)
  • Lint checking (Run npm run lint)
  • Local tests are passed (Run npm test)

@DavertMik
Copy link
Contributor

Yeah, actually there is a way to get BDD step out there.
step object has metaStep property which will be either a page object or gherkin step.
this is how we present nested structure:

step -> pageObject -> BDD step

or

step -> bddStep

so you can get on upper level by checking metaStep property.

Maybe your API is cleaner than that. I agree.

But I have the following questions:

  1. why do you need that API
  2. does it really work?

@wojtkowiak
Copy link
Contributor Author

wojtkowiak commented Apr 21, 2020

step object has metaStep property which will be either a page object or gherkin step.

Yes, but this only works when you have any I methods in the gherkin step, I do have some gherkin steps that only run queries and the step.before is not fired then (maybe I've messed sth up)

But I have the following questions:

why do you need that API
does it really work?

I was lacking a report in which I would see only gherkin steps passed/failed.
It does work on my fork that is used in our tests.

@DavertMik
Copy link
Contributor

Hi, after thinking a lot on this, I think this is a good idea and nice implementation.
I am going to take this into CodeceptJS 3.0 branch so we could present this as major feature

@DavertMik DavertMik changed the base branch from master to codeceptjs-v3.0 May 13, 2020 19:45
@DavertMik DavertMik merged commit 499df6e into codeceptjs:codeceptjs-v3.0 May 13, 2020
@ktryniszewski-mdsol
Copy link
Contributor

@wojtkowiak Was also looking into better bdd reporting. Curious tho, if no helper methods such as I are in bdd step, how do you check pass/fail status for step? Since no event listener fired for pass/fail?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants