Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Forked browsers execute plugins incorrectly #4054

Closed
sjelin opened this issue Feb 2, 2017 · 0 comments · Fixed by Jakub41/Flights-Scraper-CPH-Kastrup#46
Closed

Forked browsers execute plugins incorrectly #4054

sjelin opened this issue Feb 2, 2017 · 0 comments · Fixed by Jakub41/Flights-Scraper-CPH-Kastrup#46

Comments

@sjelin
Copy link
Contributor

sjelin commented Feb 2, 2017

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.

sjelin added a commit to sjelin/protractor that referenced this issue Feb 4, 2017
sjelin added a commit to sjelin/protractor that referenced this issue Feb 4, 2017
igniteram pushed a commit to igniteram/protractor that referenced this issue Feb 21, 2017
bodyduardU pushed a commit to bodyduardU/protractor that referenced this issue Dec 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant