-
Notifications
You must be signed in to change notification settings - Fork 36
Pin the selenium-webdriver version so that it correctly matches protractor. #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pin the selenium-webdriver version so that it correctly matches protractor. #43
Conversation
Isn't this a case for peer dependencies? |
@sjelin Sounds like peer deps might be a good fit. I'm not sure I get the implication though. In my example, I had a project with a dependency graph like:
which resulted in a directory structure like: If I add peerDeps to jasminewd2 0.0.8 -> selenium-webdriver 2.48.2, do I get an error because the module search path reaches selenium-webdriver 2.52.0 ahead of 2.48.2? An error at npm dependency resolution time would be better than the silent failures in the tests at runtime, but I'm not really sure how I would configure the project so that I can use both benchpress and protractor (which seems like a reasonable thing if I'm building an angular app). Or am I missing something and peerDeps will actually resolve the correct version in this case? |
Honestly I'm not that sure about the details of
Also, are you sure this actually solves the problem you're thinking of? Wouldn't you get:
And surely benchpress and Protractor have to use the same instance (or at least version) of webdriver? Doesn't benchpress use Protractor and benchpress? @juliemr I could use your help on this one as my benchpress knowledge is extremely limited. But regardless, you do seem right that peerDependencies are not a solution |
We should avoid peer-deps, they've historically caused problems and are being deprecated. benchpress does NOT depend on Protractor, it directly depends on selenium-webdriver. So, with the new flat node_modules directory introduced in the latest npm (default if you are using node v5), you can get into a situation where if you do, e.g.
I think @sjelin is right that adding the dep would just cause other problems (two instances of selenium-webdriver at the same version) as listed above. What we want is to explicitly use the same instance of selenium-webdriver that Protractor is using. I think the only way to ensure this is to have protractor pass it in. Let me make a new PR to do that. |
See, in particular, this comment about why peer dependencies are not a match for what we're trying to do: Also |
@sjelin The node_modules tree you describe is certainly possible. I agree it is messy looking, but I believe it will also result in correct execution of protractor because both protractor and jasminewd2 (which are peers) will resolve 2.48.2 of webdriver from their respective child node_modules directories (before they start searching up higher in the tree). As Julie points out, the real requirement is for jasminewd2 to use the same version of selenium-webdriver as protractor for everything to function correctly. @juliemr Having protractor pass the selenium-webdriver dep into jasminewd sounds like a good approach. Happy to close this PR in favour of that approach. Feel free to close this one when you're ready. |
This is fixed by #52 |
My team experienced problems running protractor with symptoms as described in angular/protractor#2790. We were able to trace it down to a situation where a bad combination of dependencies (angular, protractor, and benchpress) introduced multiple copies of selenium webdriver into the node_modules tree. This then caused jasminewd2 to resolve the wrong version of selenium webdriver, fail to actually execute anything, and silently return success for all our protractor test cases.
The problem is described in more detail in angular/protractor#2790.
This is the simplest and safest fix I could come up with. Maybe there is another way to achieve the same thing?