E2E testing with PhantomJS and Angular CLI

Question!

I need to run my E2E tests with PhantomJS because we use a continuous integration server that doesn't have any browsers installed. I use Protractor with Angular CLI but I haven't found any examples of configuration for PhantomJS. Any ideas?



Answers

I'm running protractor tests against chrome inside a docker container using xvbf. It's arguably closer to a production like environment than PhantomJS and you can still run it "headless".

This is the docker image I'm using https://hub.docker.com/r/shusson/chrome-tester/ which is based on https://hub.docker.com/r/webnicer/protractor-headless/

By : shusson


Use keydown event instead!

With keyup, value of the input is already cleared hence value=='' will always be true.

$("input").on('keydown', function(ev) {
  if (ev.which === 8 && this.value == '') {
    alert('when you pressed backspace, the input was empty already');
  }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" />

By : Rayon


This video can help you solving your question :)
By: admin