SlimerJS没有运行我的脚本

时间:2015-12-07 12:45:49

标签: javascript casperjs slimerjs


我正在尝试使用slimerJS运行我的CasperJS测试,它什么都不做,打开FF浏览器并显示SlimerJS徽标。
如果我试图运行一个简单的脚本,如加载谷歌主页或其他东西,它的工作正常。
附上下面的剧本,请你告诉我那里有什么问题?
谢谢!

// 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();
});
 });

0 个答案:

没有答案