Skip to content

Instantly share code, notes, and snippets.

@n1k0
Created May 26, 2013 12:43
Show Gist options
  • Save n1k0/5652689 to your computer and use it in GitHub Desktop.
Save n1k0/5652689 to your computer and use it in GitHub Desktop.
tets case
/* global casper*/
casper.test.begin("tests", 3, function(test) {
"use strict";
var eobDocuments;
function findLinks() {
var map = Array.prototype.map;
return map.call(document.querySelectorAll('li'), function(row) {
return {
'key': row.innerText,
'key2': 'value2'
};
});
}
casper.start().viewport(1280, 1024).thenOpen('testcase.html', function() {
this.setContent([
'<html>',
'<body>',
' <ol>',
' <li>1</li>',
' <li>2</li>',
' <li>3</li>',
' <li>4</li>',
' </ol>',
'</body>',
'</html>'
].join(''));
});
casper.then(function() {
eobDocuments = this.evaluate(findLinks);
});
casper.run(function() {
var eobDocument = eobDocuments[0];
var testLocal = [{'a': 1, 'b': 2}, {'a': 3, 'b': 4}];
var testLocal0 = testLocal[0];
test.assertTrue(testLocal0 === testLocal[0]);
test.assertEquals(eobDocument, eobDocuments[0]);
test.assertEquals(eobDocuments[0], eobDocuments[0]);
test.done();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment