у меня есть тестовый скрипт upload.js, который выглядит, как это -casperjs тестовый скрипт не экспортирующие XML-файл правильно
casper.test.comment('upload test!');
var casper=require('casper').create({
waitTimeout: 30000, //max out upload time
});
var fileName='/Users/steven/test.png';
casper.start('http://steven.dev/', function() {
casper.thenClick('#btn_upload', function() {
this.test.assertUrlMatch ('http://steven.dev/upload', 'on upload page ');
});
casper.then(function(){
this.evaluate(function(fileName)
{__utils__.findOne('input[type="file"]').setAttribute('value',fileName)},
{fileName:fileName});
this.echo('Name='+this.evaluate(function() {return
__utils__.findOne('input[type="file"]').getAttribute('name')}));
this.echo('Value='+this.evaluate(function() {return
__utils__.findOne('input[type="file"]').getAttribute('value')}));
this.page.uploadFile('input[type="file"]',fileName);
});
casper.then(function() {
this.click('#submit_button');
});
casper.waitForSelector('.upload_progress', function() {
this.echo('uploading...');
});
casper.waitForText("Done!", function() {
this.echo('success!');
});
casper.then(function() {
this.test.assertVisible ('#tools','see tools');
});
casper.run(function() {
this.test.done(2);
this.exit();
});
, когда я запускаю этот тест с параметром --xunit
, как casperjs test upload.js --xunit=log.xml
, он просто запускает тест и не экспортирует файл журнала. У меня есть еще 2 теста в моем пакете, которые экспортируют файл просто отлично. WTF!