File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -64,9 +64,12 @@ function consoleInfo() {
6464 console . log ( output ) ;
6565}
6666
67- function World ( ) {
67+ /**
68+ * Creates a list of variables to expose globally and therefore accessible within each step definition
69+ * @returns {void }
70+ */
71+ function createWorld ( ) {
6872
69- // create a list of variables to expose globally and therefore accessible within each step definition
7073 var runtime = {
7174 driver : null , // the browser object
7275 selenium : selenium , // the raw nodejs selenium driver
@@ -88,7 +91,11 @@ function World() {
8891 } ) ;
8992}
9093
91- function createGlobalObjects ( ) {
94+ /**
95+ * Import shared objects, pages object and helpers into global scope
96+ * @returns {void }
97+ */
98+ function importSupportObjects ( ) {
9299
93100 // import shared objects from multiple paths (after global vars have been created)
94101 if ( global . sharedObjectPaths && Array . isArray ( global . sharedObjectPaths ) && global . sharedObjectPaths . length > 0 ) {
@@ -127,10 +134,12 @@ function createGlobalObjects() {
127134
128135// export the "World" required by cucumber to allow it to expose methods within step def's
129136module . exports = function ( ) {
130- World ( ) ;
131- createGlobalObjects ( ) ;
132137
133- this . World = World ;
138+ createWorld ( ) ;
139+ importSupportObjects ( ) ;
140+
141+ // this.World must be set!
142+ this . World = createWorld ;
134143
135144 // set the default timeout for all tests
136145 this . setDefaultTimeout ( global . DEFAULT_TIMEOUT ) ;
You can’t perform that action at this time.
0 commit comments