Closed reece-white closed 1 year ago
The world object is not exposed intentionally. It might be available during a step function, but it is not guaranteed (it probably won't be exposed for long).
The World object has four uses:
world-parameters
cucumber optionSharing data is supported with context injection. If you want your data to be shared between all your steps you can use the same context type for all your bindings: https://github.com/timjroberts/cucumber-js-tsflow/blob/818aa9edcac244e058d1a12c0a918c4039a9f2e8/cucumber-tsflow-specs/features/custom-context-objects.feature#L18-L53
The three other functionalities of the World object are exposed through the three provided context types.
To attach a screenshot you can use the CucumberAttachments
like shown here:
https://github.com/timjroberts/cucumber-js-tsflow/blob/818aa9edcac244e058d1a12c0a918c4039a9f2e8/cucumber-tsflow-specs/features/provided-context-objects.feature#L46-L61
To be sure, and to prevent future regressions, I just added an extra scenario testing attachments on both before
and after
hooks here: https://github.com/timjroberts/cucumber-js-tsflow/commit/979a0c8600ff4bfb5a37a3e3e109c4f01769fd70
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.
There hasn't been any activity on this issue for 67 days. Closing it as Spoiled.
The world obj is undefined in the before/after hooks so it is unable to attach a screenshot.
Example fix: https://github.com/timjroberts/cucumber-js-tsflow/pull/112