4

The question seems to be asked in some other Postings here, but I'am relative new to testing with selenium. I would like to use it for testing an angular app - E2E.

I have been reading few postings here and found some interesting ideas and hints... also regarding Protractor etc. but I'am somehow confused. Does it mean that we should either use selenium or Protractor and can't use them both where Protractor wraps WebDriverJS

I would like first start with installing, using selenium and might then use Protractor. What I need is what would be the steps I should go for?

So, I'am thinking about following steps:

  1. Install Selenium
  2. Make it running
  3. Use Protractor which wraps WebDriverJS etc.

Any hint and/or approach to reach my target?

1
  • HaC, since you have known a lot on Protractor, did anyone ask you about how to stand up Protractor behind a corporate firewall? 'Webdriver-Manager update' needs to extract files from somewhere outside every time, which is prohibited. Is there a open source solution that doesn't go external to fetch each time, or at least specifies where it goes?
    – Mike Pot
    Nov 20, 2018 at 3:25

2 Answers 2

4

Let's first wrap our heads around the definitions:

  • a lot of different languages have selenium bindings. And JavaScript is no exception - WebDriverJS are javascript selenium bindings - a selenium client written in JavaScript
  • Protractor is a library that is built on top of WebDriverJS adding a lot of convenient and handy functionality on top. And, at the same time, you can still use everything available in WebDriverJS - e.g. browser is Protractor's wrapper around a driver object, but you can get the underlying driver from WebDriverJS by accessing browser.driver

When you install Protractor (see Protractor Setup), it comes with the Protractor library itself, protractor command line tool (which you'll use to execute the tests) and webdriver-manager tool - which you'll use to manage selenium webdrivers or start a selenium server if needed.

After you install Protractor, you need to run webdriver-manager update.

Then, you can either start a local selenium server with webdriver-manager start or work in a "direct connect" mode with your driver.

Please follow this step-by-step tutorial.

2
  • The background of my question is that I should implement Selenium UI test on/for the Production Sever. In other words, the app is being pushed on docker (prod server) and the docker image which creates a container should run a selenium UI test. Does it make more sense in this case to just use ng e2e on the docker image and there is no need adding/implementing Selenium as test-platform?
    – k.vincent
    Dec 20, 2017 at 8:06
  • 2
    @k.vincent depending on what are your target browsers I think, if it's going to be Chrome or Firefox - then you can just work in the "direct connect" mode without the need to start a selenium server. If you need other browsers and capabilities, you can start your local selenium server with webdriver-manager start and wrap the whole execution into, for instance, a grunt or gulp task. Or, you can also use remote selenium servers somewhere - third-party like BrowserStack or Sauce Labs or start your own on other machine if needed. Hope that helps.
    – alecxe
    Dec 20, 2017 at 13:34
3

The tutorials on Protractor's site is pretty self-explanatory and assumes no webdriver experience. So there's no need to try to start with Selenium/WebdriverJs first.

Another great thing with Protractor is the ability to co-locate your test code along with the app's development code and have them run at build time. If the app was built with angular cli, it would have already built a skeleton Protractor test for you. That's a start.

Also take a look at some suggested style guides (see protractor-styleguide) to design your test structure etc.

1
  • Great! ..and yes, The app is being build via angular-cli and there is already a generated folder: e2e containing tow files; app.e2e-spec.ts and app.po.ts. In the other hand angular-cli did also generate a file for Protractor settings: protractor.conf.js. And I can also run the ng e2e test on terminal (mac user).
    – k.vincent
    Dec 20, 2017 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.