8000 refs #912 - add textContent property to the assertion object by Fanch- · Pull Request #920 · casperjs/casperjs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jun 19, 2020. It is now read-only.

refs #912 - add textContent property to the assertion object #920

Conversation

Fanch-
Copy link
@Fanch- Fanch- commented May 12, 2014

One solution for ref #912.
local selftest Okay.

Edit : Where do I define textContent? ...

@@ -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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation here.

@mickaelandrieu
Copy link
Member

Thank you for this first step, sounds good to me.
Would you mind to fix some lint issues ? You can check travis report to help you.

Regards,

@Fanch-
Copy link
Author
Fanch- commented May 12, 2014

Done :)

@mickaelandrieu
Copy link
Member

+1 for me. ping @n1k0 for review :)
Can you squash your commits ?

Good job !

@Fanch-
Copy link
Author
Fanch- commented May 13, 2014

Squashed.

8000

@mickaelandrieu
Copy link
Member

thank you, @n1k0 can I merge it ?
I will add docs ;)

@n1k0
Copy link
Member
n1k0 commented May 13, 2014

Nope, I have comments I need to put down here once I get time.

@Fanch-
Copy link
Author
Fanch- commented May 15, 2014

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();
});
Copy link
Member

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

@Fanch-
Copy link
Author
Fanch- commented May 20, 2014

Assert error : http://hpics.li/4119bff
Wait() -> timeout : http://hpics.li/03af4d8

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

Chances ar high that this.textContent refers to nothing here.

What must be done here? Deleted? I forgot why I've added that **. And do you want to split the lines in 3?

@Fanch-
Copy link
Author
Fanch- commented Jun 24, 2014

Up.

@mickaelandrieu
Copy link
Member

Sorry, @n1k0 is very busy :)

@kensoh
Copy link
Member
kensoh commented Jul 26, 2018

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.

@kensoh kensoh closed this Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0