elmekiesIsrael elmekiesIsrael - 3 months ago 14
AngularJS Question

Running protractor tests as part of the Maven build process

I have a Maven project and I wan't to change the POM so that when I build the project (Clean + Install), after the compilation part, a set of protractor tests will start (opening selenium and doing several things), and only if the tests pass, the build itself passes.

I can't seem to find something that gives me this kind of functionality. Is is possible? and if so, How do I use it?
We are currently using the 'com.github.eirslett' maven plugin for building and I was wondering if it is possible to add the protractor tests as a stage in this plugin. I can see that it supports unit testing with 'Karma' but not anything related to protractor.

Any help will be much appreciated!! Thanks :)

Answer

You can use following maven plugin https://github.com/greengerong/maven-ng-protractor

and you can use it like this

<plugin>
  <groupId>com.github.greengerong</groupId>
  <artifactId>maven-ng-protractor</artifactId>
  <version>0.0.2</version>
  <configuration>
    <protractor>protractor</protractor>
    <configFile>yourconfig.js</configFile>
  </configuration>
  <executions>
    <execution>
    <id>ng-protractor</id>
    <phase>integration-test</phase>
    <goals>
       <goal>run</goal>
    </goals>
    </execution>
  </executions>
</plugin>
Comments