-
Notifications
You must be signed in to change notification settings - Fork 977
refs #912 - add textContent property to the assertion object #920
refs #912 - add textContent property to the assertion object #920
Conversation
@@ -313,6 +313,7 @@ Tester.prototype.assertTrue = function assert(subject, message, context) { | |||
type: "assert", | |||
standard: "Subject is strictly true", | |||
message: message, | |||
textContent : "Use this property to customize textContent of a failure node - useful for jenkins report", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation here.
Thank you for this first step, sounds good to me. Regards, |
Done :) |
+1 for me. ping @n1k0 for review :) Good job ! |
Squashed. |
thank you, @n1k0 can I merge it ? |
Nope, I have comments I need to put down here once I get time. |
It doesn't manage some useful errors ( Timeout for wait() family). I'll look at it again. |
test.assertExists('testsuite[name="foo"][package="foo"][tests="1"][failures="1"] testcase[name="footext"] failure[type="footype"]'); | ||
test.assertEquals(casper.getElementInfo('failure[type="footype"]').text, 'failureNodeTextContent'); | ||
test.done(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing CR at EOF
Assert error : http://hpics.li/4119bff /*
* Take a screenshot and send it on jenkins workspace when a test fails (if --xunit option is set)
*/
if (casper.cli.get("xunit")){
var screenCount = 1
,fileName = require('system').args[4]
;
//get back only fileName if needed, not the complete path
if (fileName.indexOf('/') !==-1 ){ fileName = fileName.split('/'); fileName = fileName[fileName.length-1];}
//get fileName -> we delete '.js'
fileName = fileName.substring(0, fileName.length - 3);
//get back the job name -> --xunit=/var/lib/jenkins/jobs/"+jobName+"/workspace/logs" + (j+1) + ".xml"
var job = casper.cli.get("xunit").split('/')[5];
console.log(job);
//event onFail
casper.test.on('fail', function(failure) {
//save screenshot in adequate workspace
var capture = '/var/lib/jenkins/jobs/' + job + '/workspace/screenshots/' + fileName + 'Fail' + screenCount + '.png';
casper.capture(capture);
// failure type : assert or fail
if(failure.type.indexOf('assert') !==-1 || failure.type ==='fail'){
failure.description = "Message : " + failure.message + "\nLine : " + failure.line + "\nCode : " + failure.lineContents
+ "\nScreen : " + 'http://-jenkins-/job/' + job + '/lastFailedBuild/artifact/screenshots/' + fileName + 'Fail' + screenCount + '.png/'
+ "\nUrl : " + casper.getCurrentUrl();
}
//failure type : uncaught
else if (failure.type === 'uncaughtError'){
//timeout error (for wait() function)
if (failure.values.error.name === 'TimedOutError'){
failure.description = "Message : " + failure.message + "\nCode : wait() -> timeout"
+ "\nScreen : " + 'http://-jenkins-/job/' + job + '/lastFailedBuild/artifact/screenshots/' + fileName + 'Fail' + screenCount + '.png/'
+ "\nUrl : " + casper.getCurrentUrl();
}
}
screenCount++;
});
}
What must be done here? Deleted? I forgot why I've added that **. And do you want to split the lines in 3? |
Up. |
Sorry, @n1k0 is very busy :) |
Archiving PR using ARCHIVE label as CasperJS, like PhantomJS, is not actively maintained for now. These PRs are from 1-5 years ago but there just hasn't been maintainers to continue the work. |
One solution for ref #912.
local selftest Okay.
Edit : Where do I define textContent? ...