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:
- Install Selenium
- Make it running
- Use Protractor which wraps WebDriverJS etc.
Any hint and/or approach to reach my target?
-
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– Mike Pot2018年11月20日 03:25:08 +00:00Commented Nov 20, 2018 at 3:25
2 Answers 2
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 ofWebDriverJS
adding a lot of convenient and handy functionality on top. And, at the same time, you can still use everything available inWebDriverJS
- e.g.browser
is Protractor's wrapper around a driver object, but you can get the underlying driver fromWebDriverJS
by accessingbrowser.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.
-
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– k.vincent2017年12月20日 08:06:11 +00:00Commented 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– alecxe2017年12月20日 13:34:57 +00:00Commented Dec 20, 2017 at 13:34
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.
-
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
andapp.po.ts
. In the other handangular-cli
did also generate a file for Protractor settings:protractor.conf.js
. And I can also run theng e2e
test on terminal (mac user).k.vincent– k.vincent2017年12月20日 08:02:16 +00:00Commented Dec 20, 2017 at 8:02
Explore related questions
See similar questions with these tags.