Skip to content
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

Rule proposal: no-browser, to complement no-browser-driver #97

Open
dietergeerts opened this issue Oct 11, 2019 · 6 comments
Open

Rule proposal: no-browser, to complement no-browser-driver #97

dietergeerts opened this issue Oct 11, 2019 · 6 comments

Comments

@dietergeerts
Copy link

dietergeerts commented Oct 11, 2019

While searching for reasons to use the one or the other, I found this: angular/protractor#634. I can conclude from there that depending on the used libraries in your webapp, the one is better than the other to use. Therefore, I think that OR we need a rule to complement the already existing no-browser-driver, OR we need a more general rule that is configurable to have either the one or the other as preferred.

I'm not creating a PR yet, as I first want to know what is preferred to do: adding a new rule, or make the current rule configurable (though naming wise it will be a little bit off then).

@alecxe
Copy link
Owner

alecxe commented Oct 11, 2019

@dietergeerts thanks for the idea!

I am leaning towards having no-browser as a separate new rule turned off by default for 3 main reasons:

  • backwards compatibility - to keep existing rule set up
  • from my experience working on Protractor projects and seeing what people usually do with Protractor on StackOverflow and elsewhere - browser is generally a more popular choice for general protractor use cases than browser.driver
  • this way we'll give the choice to an end developer having sensible general defaults

Please let me know if this makes sense. Thanks again.

@dietergeerts
Copy link
Author

Yes, sounds a good choice. Do I give it a try?

@alecxe
Copy link
Owner

alecxe commented Oct 29, 2019

@dietergeerts yes, please. Let me know if you have any questions or need help.

@dietergeerts
Copy link
Author

dietergeerts commented Nov 11, 2019

Ok, I'll give it a shot. It will be a bit more work, as I first have to check which functions are being wrapped by the driver, as all need to be restricted by it. I can't tell a time estimate yet, as due to limited time and sickness, I can't always do some extra work, but I would love to try this one.

@Prabhs2
Copy link

Prabhs2 commented Nov 14, 2019

I observed something different while testing the non-angular application. The experiment that I did on my sample framework is as below

  1. I used browser.get() initially to test non-angular app and I got an error saying "Angular could not be found......"
  2. I included browser.waitForAngularEnabled(false) inside onPrepare function of the config file and this it worked without any error
  3. I now changed browser.get() to browser.driver.get() and this worked too
  4. Now I removed browser.waitForAngularEnabled(false) and my scripts were still working

Now to test any non-angular application I would either add browser.waitForAngularEnabled(false) in onPrepeare function or just use browser.driver.get()

@dietergeerts
Copy link
Author

@Prabhs2 , that's exactly what this linting rule will be for. The wrapper functions of browser adds Angular(JS) magic, and thus will not always be ideal, and thus it's preferred to use browser.driver directly instead if your page is not Angular(JS). Even with Angular(JS), using browser.driver will work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants