Is there a way for me to do silent testing with Protractor when I use the Windows platform?

I use Protractor for testing. Can someone tell me if there is a way to change it using Chrome to conduct silent tests. I have seen a number of articles about this seem to suggest that I am using Linux. I am using a windows machine for testing.

+6
source share
4 answers

Yes phantomjs works with protractor on Windows. I also found almost all of the online documentation as * nix specific, but getting it to work on Windows is very simple. Assuming you already have a protractor working with chrome:

Add phantoms. You can either install the Windows version or install the node module. I suggest the node module because it will simplify the build configuration if you need to configure another development environment:

npm install phantomjs --save-dev 

Then update the protractor.conf.js file to point to phantomjs:

 capabilities: { browserName: 'phantomjs', 'phantomjs.binary.path': require('phantomjs').path }, 

Pay attention to the value of phantomjs.binary.path. All online documentation today hardcodes the value of this path for * nix corresponding values. Using these hard-coded paths in Windows will not be allowed for the correct binary. Since we rely on the path property, this configuration will work on both Windows and * nix!

+9
source

Protractor can be used with PhantomJS Headless WebKit. The following section is an excerpt of protractor documentation:


To test locally with PhantomJS, you need to either install it globally or relative to your project. For a global installation, see PhantomJS Download Page . For relative installation start: npm install --save-dev phantomjs .

Add phantomjs to the driver features and include the path to the binary if using a local installation:

 capabilities: { 'browserName': 'phantomjs', /* * Can be used to specify the phantomjs binary path. * This can generally be ommitted if you installed phantomjs globally. */ 'phantomjs.binary.path':'./node_modules/phantomjs/bin/phantomjs', /* * Command line arugments to pass to phantomjs. * Can be ommitted if no arguments need to be passed. * Acceptable cli arugments: https://github.com/ariya/phantomjs/wiki/API- Reference#wiki-command-line-options */ 'phantomjs.cli.args':['--logfile=PATH', '--loglevel=DEBUG'] } 

The main workflow can be running tests on phantomjs on a development machine. This allows you to run e2e without the annoying browser window. Tests on other browsers can be run on the continuous integration server. When you develop, you run the test with phantom js before you go. Then you click, the assembly runs on the ci server and runs the tests against different browsers. If one of the tests does not work in a specific browser, you can run it on your dev machine. For example, with chrome:

 protractor --browser=chrome 
+2
source

You should check out PhantomJS (v8 headless browser) and Selenium. Here is an article that is useful to get you started.

https://www.exratione.com/2013/12/angularjs-headless-end-to-end-testing-with-protractor-and-selenium/

+1
source

The selenium server is Java based and should work fine on a Windows machine.

http://docs.seleniumhq.org/download/

This YouTube video explains how to set up protractor and selenium to work together.

https://www.youtube.com/watch?v=idb6hOxlyb8

+1
source

Source: https://habr.com/ru/post/970115/


All Articles