all casper tests fixed weee

This commit is contained in:
Peter Cottle 2015-04-11 12:58:45 -07:00
parent 5a1953aa25
commit 51220f6cdd
17 changed files with 35 additions and 17 deletions

1
.gitignore vendored
View file

@ -11,4 +11,5 @@ index.html
*.sw*
npm-debug.log
src/__tests__/casperjs/screenshots/*.png
src/__tests__/casperjs/*.js-e

View file

@ -10,6 +10,10 @@ var CasperUtils = {
casper.echo('Error: ' + msg, 'ERROR');
casper.echo('Stack: ' + JSON.stringify(trace));
});
casper.on('remote.error', function(msg) {
casper.echo('Console Warn: ' + msg, 'ERROR');
});
casper.options.logLevel ="debug";
casper.start(url, callback);
return casper;
@ -106,6 +110,9 @@ var CasperUtils = {
selectorContainsText: function(selector, text) {
return function then() {
this.test.assertEvalEquals(function(selector) {
if (!document.querySelector(selector)) {
return 'Query selector ' + selector + ' did not match!!';
}
return document.querySelector(selector).innerText
.replace(/^\s+/g, '').replace(/\s+$/g, '');
},

View file

@ -1,6 +1,6 @@
var CasperUtils = require('./casperUtils').CasperUtils;
casper.start(
CasperUtils.start(casper,
CasperUtils.getUrl(),
function() {
this.test.assertTitle('Learn Git Branching');

View file

@ -1,6 +1,6 @@
var CasperUtils = require('./casperUtils').CasperUtils;
casper.start(
CasperUtils.start(casper,
CasperUtils.getUrl(),
function() {
this.test.assertTitle('Learn Git Branching');

View file

@ -1,6 +1,6 @@
var CasperUtils = require('./casperUtils').CasperUtils;
casper.start(
CasperUtils.start(casper,
CasperUtils.getUrl(),
function() {

View file

@ -1,6 +1,6 @@
var CasperUtils = require('./casperUtils').CasperUtils;
casper.start(
CasperUtils.start(casper,
CasperUtils.getUrl(),
function() {
this.test.assertTitle('Learn Git Branching');

View file

@ -1,6 +1,6 @@
var CasperUtils = require('./casperUtils').CasperUtils;
casper.start(
CasperUtils.start(casper,
CasperUtils.getUrl(),
function() {
this.test.assertTitle('Learn Git Branching');
@ -51,7 +51,7 @@ casper.start(
.then(function() {
this.page.sendEvent('keypress', this.page.event.key.Enter);
})
.wait(1700)
.wait(700)
.then(CasperUtils.screenshot.entirePage)
.then(CasperUtils.asserts.selectorContainsText(
'div.levelNameWrapper',

View file

@ -23,7 +23,7 @@ var levelIconIDsForPages = function(start, end) {
.reduce(flattenArray);
};
casper.start(
CasperUtils.start(casper,
CasperUtils.getUrlForCommands([
'levels',
]),

View file

@ -1,6 +1,6 @@
var CasperUtils = require('./casperUtils').CasperUtils;
casper.start(
CasperUtils.start(casper,
CasperUtils.getUrlForCommands([
'level intro1 --noIntroDialog --noStartCommand',
]),

View file

@ -1,6 +1,6 @@
var CasperUtils = require('./casperUtils').CasperUtils;
casper.start(
CasperUtils.start(casper,
CasperUtils.getUrlForCommands([
'level intro1 --noIntroDialog --noStartCommand',
]),

View file

@ -1,6 +1,6 @@
var CasperUtils = require('./casperUtils').CasperUtils;
casper.start(
CasperUtils.start(casper,
CasperUtils.getUrlForCommands([
'level intro1 --noIntroDialog --noStartCommand',
'show goal',

View file

@ -1,6 +1,6 @@
var CasperUtils = require('./casperUtils').CasperUtils;
casper.start(
CasperUtils.start(casper,
CasperUtils.getUrlForCommands([
'locale fr_FR',
]),

View file

@ -21,7 +21,7 @@ var headerLocaleMap = {
'pt-BR': 'pt_BR'
};
casper.start(
CasperUtils.start(casper,
CasperUtils.getUrl(),
function() {
this.test.assertTitle('Learn Git Branching');

View file

@ -1,6 +1,6 @@
var CasperUtils = require('./casperUtils').CasperUtils;
casper.start(
CasperUtils.start(casper,
CasperUtils.getUrlWithQueryParams({
locale: 'fr_FR',
}),

View file

@ -1,6 +1,6 @@
var CasperUtils = require('./casperUtils').CasperUtils;
casper.start(
CasperUtils.start(casper,
CasperUtils.getUrlForCommands([
'git commit',
]),

View file

@ -28,6 +28,15 @@ var CommandView = React.createClass({
},
onModelDestroy: function() {
if (!this.isMounted()) {
return;
}
if (!this.getDOMNode) {
// WTF -- only happens in casperjs tests weirdly
console.error('this.getDOMNode not a function?');
return;
}
React.unmountComponentAtNode(this.getDOMNode().parentNode);
},

View file

@ -94,9 +94,6 @@
</a>
<!-- Dependencies -->
{{jsDependencies}}
<script src="lib/jquery-ui-1.9.0.custom.min.js"></script>
<script type="text/javascript">
// PhantomJS doesn't support bind yet LOL. polyfill
Function.prototype.bind = Function.prototype.bind || function (thisp) {
@ -107,6 +104,10 @@
};
</script>
{{jsDependencies}}
<script src="lib/jquery-ui-1.9.0.custom.min.js"></script>
<!-- Templates from here on out. Someone seriously needs to fix template
management for node.js apps. I know there is the text plugin
for requireJS but that's lame. For now, they are all listed here... -->