Question

I got protractor and selenium-standalone-server to work, however I don't see any documentation on where to specify the js files I am testing. I know how to specify spec files and my tests run, but I am still confused on where html might be served from, or if html even needs to be served if I'm just testing javascript with HTML-DOM. So these are my questions:

1) Where do I specify the actual js files that are being tested?
2) Where do I specify the HTML that needs to be tested? Can this be done in protractor or does it need to be done in selenium?
3) Where does Selenium-Standalone-Server look for files to serve and how do you specify the url for the content being served.

Thanks

Was it helpful?

Solution

To be clear, selenium server is not what's serving your application files. Instead, what selenium does is it listens for commands to send to the browser instance that it's controlling (those commands originate from your protractor tests).

Your own application server, and selenium server are two entirely separate servers, and it is still up to you to launch both before running protractor.

So to answer pretty much all of your questions, you don't need to tell protractor or selenium which specific HTML/JS files are being tested; rather, you simply tell protractor which URLs it should fetch by calling browser.get(url) (or browser.driver.get(url) if it's a non-Angular page) in your tests.

Note that your app server and selenium don't necessarily have to be running on the same machine, or even locally - it's possible to configure protractor so that it connects to an already-running remote instance of selenium by setting the seleniumAddress property in protractor's configuration file. And likewise, you can tell protractor the base URL where your app is running by setting the baseUrl property in that same file - however, in this case, make sure you're using that base URL in your tests by doing something like browser.get(ptor.baseUrl + '/path') instead of hardcoding localhost.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top