1


I am trying to run my CasperJS test using slimerJS, and it just do nothing, opened the FF browser and displayed the SlimerJS logo.
If I am trying to run a simple script like loading of Google homepage or something it works fine.
Attached the script below, can you please tell me what is wrong there?
Thanks!

// Simple messaging flow
action_helpers_v2    =         require('../v2_modules/action_helpers_v2.js');
helpers_v2           =     require('../v2_modules/helpers_v2.js');

var staging = casper.cli.get('staging'),
    unixTimeStamp = (Date.now()).toString().substring(4),
    currentTime = new Date(),
    currentHour = currentTime.getHours(),
    timeout = 15000;

var genereateText = function genereateText() {
    var text = "";
    var possible =     "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
           for( var i=0; i < 20; i++ ) {
               text += possible.charAt(Math.floor(Math.random() *     possible.length));
       }
    return text;
}

var mouse = require("mouse").create(casper);
var webPage = require('webpage');
var page = webPage.create();
var live = casper.cli.get("prod"),
    staging = casper.cli.get("staging"),
    localeTesting = casper.cli.get("localeTesting"),
    buyerUserName = 'settings120',
    buyerPassword = 123456,
    orders_array = [],
    numberOfTests = 0;



casper.test.begin("Test Name: simple messaging flow", function suite(test) {
casper.start('http://fiverr.com');
casper.then(function() {
    if (staging) {
        action_helpers_v2.enableStaging(staging);
    }
});

casper.then(function() {
    action_helpers_v2.navigateToHomepage();
});

casper.then(function() {
    action_helpers_v2.login(buyerUserName,buyerPassword);
    action_helpers_v2.navigateToConversation("yogev_a");
});

casper.wait(5000);
var message = genereateText();
casper.then(function() {
    casper.evaluate(function(message) {
        $('#message_body')[0].value = message;
    }, message);
});

casper.then(function() {
    casper.evaluate(function() {
        $('.btn-send-message')[0].click()
    });
});

casper.waitForText(message, function() {
    casper.test.pass("Message was sent");    
}, function() {
    helpers_v2.printScreenAndMessage('message_error', 'message_error');
    casper.test.fail("Message wasnt sent");
});

casper.run(function(){
    test.done();
});
 });
Artjom B.
  • 61,146
  • 24
  • 125
  • 222
  • Which Slimer.js version do you use? Have you tried to run your script with the `--ssl-protocol=any --ignore-ssl-errors=true` commandline flags? – Artjom B. Dec 07 '15 at 13:29
  • Yes I have tried. Here's my version: Innophi SlimerJS 0.10.0pre, Copyright 2012-2015 Laurent Jouanneau & Innophi. I think the issue might be related to my requires there, I have 2 modules that I require to my script. – Yogev Abergel Dec 07 '15 at 13:33
  • Your script looks fine to me. Please register to the `resource.error`, `page.error`, `remote.message` and `casper.page.onResourceTimeout` events ([Example](https://gist.github.com/artjomb/4cf43d16ce50d8674fdf#file-2_caspererrors-js)). Maybe there are errors. – Artjom B. Dec 07 '15 at 13:36
  • My output is empty, only the test title, I don't think that it gets to the part of starting the test.
    For example, If I commenting out the 2 requires at the top of the test, at least I see some errors regarding missing variables and stuff.
    – Yogev Abergel Dec 07 '15 at 13:44
  • Ah, try to remove the ".js" from the require strings ([reference](http://stackoverflow.com/a/27458182/1816580)). Maybe this helps. – Artjom B. Dec 07 '15 at 13:52
  • Tried it as well. as mentioned in the SlimerJS docuentation. I am really lost on this one. – Yogev Abergel Dec 07 '15 at 13:57

0 Answers0