2

I have an website which need to be need to be tested after every deployment. To smoke test the application automatically, i thought of using casperjs.But the difficulty is that it only runs on top IE.By default casperjs only supports PhantomJS in built browser. Is there any plugin exists for casperjs as similar to DalekJS(dalek-browser-chrome) or something similar to this?

Enclosed below the complete code snippet.

Casper Code:

var LOGIN_URL, LOGIN_USERNAME, LOGIN_PASSWORD, casper;
var fs = require('fs');
casper = require('casper').create({
    waitTimeout: 20000,
    viewportSize: {
        width: 1024,
        height: 768
    },
    verbose: true,
    logLevel: 'debug'
});

if (!casper.cli.has('url') && !casper.cli.has('username') && !casper.cli.has('password')) {
    casper.echo('Usage: $ casperjs test.js --url=URL --username=USERNAME --password=PASSWORD').exit(-1);
}

LOGIN_URL = casper.cli.get('url');
LOGIN_USERNAME = casper.cli.get('username');
LOGIN_PASSWORD = casper.cli.get('password');

phantom.cookiesEnabled = true;

casper.start(LOGIN_URL, function () {
    this.log('Logging in', 'debug');
    this.fillSelectors('#login_form', {
        '#temp_username': LOGIN_USERNAME,
        '#temp_password': LOGIN_PASSWORD
    }, true);
})
.wait(20000,function(){
      fs.write("content.html",casper.getPageContent(), 'w');
})
.then(function(){
     this.click('#some-id');
})
.wait(20000,function(){
})   
.then(function(){
    this.capture("application.png");
    this.exit();
})
.run();

References:

http://dalekjs.com/pages/getStarted.html

Artjom B.
  • 58,311
  • 24
  • 111
  • 196
Thiru Arasu
  • 49
  • 1
  • 6

1 Answers1

2

It is currently not possible to drive Internet Explorer from CasperJS. There is TrifleJS which has the same API as PhantomJS, but it isn't integated into CasperJS and it isn't known if it ever will.

If you really want multi-browser support, you should write your tests with for the language of your choice.

For reference:
IE support through TrifleJS?
Remove spurious fs calls
Add support to CasperJS

Artjom B.
  • 58,311
  • 24
  • 111
  • 196