Skip to content
This repository was archived by the owner on Aug 7, 2019. It is now read-only.
This repository was archived by the owner on Aug 7, 2019. It is now read-only.

Investigate how CukeFarm should support providing Page Objects and helper functions access to the World #11

@thompsnm

Description

@thompsnm

The World section of the Cucumber.js README demonstrates two ways to set the World that will later be provided to Steps. CukeFarm is hard coded to follow the first example: telling Cucumber.js to instantiate a World object. This means that only the Steps have access to the World out of the box, which causes issues if you write helper functions or Page Objects that also need access to properties on the World. The following questions should be answered by this ticket:

  1. Should CukeFarm support the second example: providing an object and telling Cucumber.js to use it as the World?
  2. Should the CukeFarm Step Defs that instantiate Page Objects be modified to pass the World object by default?

Expected outcome of this issue:

  • If the answer to question 1 is Yes, a new issue should be filed to add the described functionality.
  • If the answer to question 2 is Yes, a new issue should be filed to add the described functionality.
  • If the answer to both question 1 and question 2 is No, no further work is needed.

Note:

  • The current best practice for providing a Page Object access to the World is to define a new Step Def in your project that passes the World to the Page Object's constructor when it is instantiated.
  • The current best practice for providing the World to helper functions that are used by Step Defs is to use the Function.prototype.call() function when calling such helper functions in a Step Def. This will allow you to set the scope of the helper function to that of the Step Def. In this way, the syntax of the helper function can match that of the Step Defs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions