john-doherty / selenium-cucumber-js

Browser automation framework written in pure JavaScript using official selenium-webdriver and cucumber-js
ISC License
120 stars 89 forks source link

Any strong reason why page object get created before shared objects? #21

Closed danyg closed 7 years ago

danyg commented 7 years ago

As in this part of the code world.js:100 the page objects are created before the shared object, therefore if a shared property / method is needed inside of a page object n definition time the system crashes with a not defined error.

Is there is any specific reason why this is done in this way?

I think has more sense to do it in the other way around. Think in the scenario where you would like to create some abstract shared object.

In my case I was trying to augment the object by adding a customised locator, I defined in a utils shared object and when trying to use my customised locator in a page object as defined in the how to, it fails due the page object get created before shared objects.

john-doherty commented 7 years ago

Hi @danyg, no - there is no strong reason, looks like you found a bug. Thanks for the fix!