Below is the generated casperjs output for a simple test of opening up google.com, typing "resurectio" and verifying the text and links of the first two results. After that is the casperjs output where you can see it fails after the first assertion. I am running PhantomJS 1.9.2 and the latest version of CasperJS. I really hope this is just user error because this project could help me out a lot if it worked.
Generated Test code:
/*==============================================================================*/
/* Casper generated Mon Nov 16 2015 09:03:06 GMT-0700 (Mountain Standard Time) */
/*==============================================================================*/
var x = require('casper').selectXPath;
casper.options.viewportSize = {width: 1920, height: 1019};
casper.on('page.error', function(msg, trace) {
this.echo('Error: ' + msg, 'ERROR');
for(var i=0; i<trace.length; i++) {
var step = trace[i];
this.echo(' ' + step.file + ' (line ' + step.line + ')', 'ERROR');
}
});
casper.test.begin('Resurrectio test', function(test) {
casper.start('https://www.google.com/');
casper.waitUntilVisible("form[name=f] input[name='q']",
function success() {
test.assertExists("form[name=f] input[name='q']");
this.click("form[name=f] input[name='q']");
},
function fail() {
test.assertExists("form[name=f] input[name='q']");
});
casper.waitUntilVisible("input[name='q']",
function success() {
this.sendKeys("input[name='q']", "resurrectio");
},
function fail() {
test.assertExists("input[name='q']");
});
casper.waitUntilVisible(x("//*[normalize-space(text())='ebrehault/resurrectio · GitHub']"),
function success() {
test.assertExists(x("//*[normalize-space(text())='ebrehault/resurrectio · GitHub']"));
},
function fail() {
test.assertExists(x("//*[normalize-space(text())='ebrehault/resurrectio · GitHub']"));
});
casper.then(function() {
test.assertExists(x("//a[normalize-space(text())='ebrehault/resurrectio · GitHub' and @href='/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CBwQFjAAahUKEwiHmcXLqJXJAhXJWogKHdK0BJU&url=https%3A%2F%2Fgithub.com%2Febrehault%2Fresurrectio&usg=AFQjCNFFsRQHQRDWlfbtVjFnc59M0md1MQ&sig2=ciQkkZGZT5ad3z_l9ocgmQ&bvm=bv.107467506,d.cGU']"));
});
casper.waitUntilVisible(x("//*[normalize-space(text())='Resurrectio - Chrome Web Store - Google']"),
function success() {
test.assertExists(x("//*[normalize-space(text())='Resurrectio - Chrome Web Store - Google']"));
},
function fail() {
test.assertExists(x("//*[normalize-space(text())='Resurrectio - Chrome Web Store - Google']"));
});
casper.then(function() {
test.assertExists(x("//a[normalize-space(text())='Resurrectio - Chrome Web Store - Google' and @href='/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0CCcQFjABahUKEwiHmcXLqJXJAhXJWogKHdK0BJU&url=https%3A%2F%2Fchrome.google.com%2Fwebstore%2Fdetail%2Fresurrectio%2Fkicncbplfjgjlliddogifpohdhkbjogm%3Fhl%3Den&usg=AFQjCNHYx10vF-ki6srZNdna4dfUygw66g&sig2=UoKuxppkpP1Vz53BQE4HPQ&bvm=bv.107467506,d.cGU']"));
});
casper.run(function() {test.done();});
});
And the test result:
# Resurrectio test
PASS Find an element matching: form[name=f] input[name='q']
FAIL Find an element matching: xpath selector: //*[normalize-space(text())='ebrehault/resurrectio ┬╖ GitHub']
# type: assertExists
# file: resurectio-test.js:36
# code: test.assertExists(x("//*[normalize-space(text())='ebrehault/resurrectio ┬╖ GitHub']"));
# subject: false
# selector: {"type":"xpath","path":"//*[normalize-space(text())='ebrehault/resurrectio ┬╖ GitHub']"}
FAIL 2 tests executed in 5.676s, 1 passed, 1 failed, 0 dubious, 0 skipped.
Details for the 1 failed test:
In resurectio-test.js:36
Resurrectio test
assertExists: Find an element matching: xpath selector: //*[normalize-space(text())='ebrehault/resurrectio ┬╖ GitHub']
Below is the generated casperjs output for a simple test of opening up google.com, typing "resurectio" and verifying the text and links of the first two results. After that is the casperjs output where you can see it fails after the first assertion. I am running PhantomJS 1.9.2 and the latest version of CasperJS. I really hope this is just user error because this project could help me out a lot if it worked.
Generated Test code:
And the test result: