Forked browsers execute plugins incorrectly #4054
Description
Plugin hooks onPageLoad
, onPageStable
, onPageLoad
and onPageStable
are all supposed to run against a specific ProtractorBrowser
instance, not necessarily the global browser
object. But these functions aren't being passed any information about what browser instance they're supposed to run against. Plugin authors generally just use the global browser object, which will execute plugins incorrectly on forked browsers.
Luckily, this is extremely easy to fix. Just pass the this
object when you call these plugin functions. So this.plugins_.onPageLoad()
becomes this.plugins_.onPageLoad(this)
. The infrastructure for passing parameters this way is already built (the postTest
hook uses it).
I briefly considered sticking the ProtractorBrowser
instance on the context object with all the utility functions, but I don't think that makes sense. You'd need multiple copies of the context object, one for each forked browser, and that could turn into a mess.