mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 08:50:06 +02:00
all casper tests fixed weee
This commit is contained in:
parent
5a1953aa25
commit
51220f6cdd
17 changed files with 35 additions and 17 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -11,4 +11,5 @@ index.html
|
||||||
*.sw*
|
*.sw*
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
src/__tests__/casperjs/screenshots/*.png
|
src/__tests__/casperjs/screenshots/*.png
|
||||||
|
src/__tests__/casperjs/*.js-e
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,10 @@ var CasperUtils = {
|
||||||
casper.echo('Error: ' + msg, 'ERROR');
|
casper.echo('Error: ' + msg, 'ERROR');
|
||||||
casper.echo('Stack: ' + JSON.stringify(trace));
|
casper.echo('Stack: ' + JSON.stringify(trace));
|
||||||
});
|
});
|
||||||
|
casper.on('remote.error', function(msg) {
|
||||||
|
casper.echo('Console Warn: ' + msg, 'ERROR');
|
||||||
|
});
|
||||||
|
|
||||||
casper.options.logLevel ="debug";
|
casper.options.logLevel ="debug";
|
||||||
casper.start(url, callback);
|
casper.start(url, callback);
|
||||||
return casper;
|
return casper;
|
||||||
|
@ -106,6 +110,9 @@ var CasperUtils = {
|
||||||
selectorContainsText: function(selector, text) {
|
selectorContainsText: function(selector, text) {
|
||||||
return function then() {
|
return function then() {
|
||||||
this.test.assertEvalEquals(function(selector) {
|
this.test.assertEvalEquals(function(selector) {
|
||||||
|
if (!document.querySelector(selector)) {
|
||||||
|
return 'Query selector ' + selector + ' did not match!!';
|
||||||
|
}
|
||||||
return document.querySelector(selector).innerText
|
return document.querySelector(selector).innerText
|
||||||
.replace(/^\s+/g, '').replace(/\s+$/g, '');
|
.replace(/^\s+/g, '').replace(/\s+$/g, '');
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var CasperUtils = require('./casperUtils').CasperUtils;
|
var CasperUtils = require('./casperUtils').CasperUtils;
|
||||||
|
|
||||||
casper.start(
|
CasperUtils.start(casper,
|
||||||
CasperUtils.getUrl(),
|
CasperUtils.getUrl(),
|
||||||
function() {
|
function() {
|
||||||
this.test.assertTitle('Learn Git Branching');
|
this.test.assertTitle('Learn Git Branching');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var CasperUtils = require('./casperUtils').CasperUtils;
|
var CasperUtils = require('./casperUtils').CasperUtils;
|
||||||
|
|
||||||
casper.start(
|
CasperUtils.start(casper,
|
||||||
CasperUtils.getUrl(),
|
CasperUtils.getUrl(),
|
||||||
function() {
|
function() {
|
||||||
this.test.assertTitle('Learn Git Branching');
|
this.test.assertTitle('Learn Git Branching');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var CasperUtils = require('./casperUtils').CasperUtils;
|
var CasperUtils = require('./casperUtils').CasperUtils;
|
||||||
|
|
||||||
casper.start(
|
CasperUtils.start(casper,
|
||||||
CasperUtils.getUrl(),
|
CasperUtils.getUrl(),
|
||||||
function() {
|
function() {
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var CasperUtils = require('./casperUtils').CasperUtils;
|
var CasperUtils = require('./casperUtils').CasperUtils;
|
||||||
|
|
||||||
casper.start(
|
CasperUtils.start(casper,
|
||||||
CasperUtils.getUrl(),
|
CasperUtils.getUrl(),
|
||||||
function() {
|
function() {
|
||||||
this.test.assertTitle('Learn Git Branching');
|
this.test.assertTitle('Learn Git Branching');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var CasperUtils = require('./casperUtils').CasperUtils;
|
var CasperUtils = require('./casperUtils').CasperUtils;
|
||||||
|
|
||||||
casper.start(
|
CasperUtils.start(casper,
|
||||||
CasperUtils.getUrl(),
|
CasperUtils.getUrl(),
|
||||||
function() {
|
function() {
|
||||||
this.test.assertTitle('Learn Git Branching');
|
this.test.assertTitle('Learn Git Branching');
|
||||||
|
@ -51,7 +51,7 @@ casper.start(
|
||||||
.then(function() {
|
.then(function() {
|
||||||
this.page.sendEvent('keypress', this.page.event.key.Enter);
|
this.page.sendEvent('keypress', this.page.event.key.Enter);
|
||||||
})
|
})
|
||||||
.wait(1700)
|
.wait(700)
|
||||||
.then(CasperUtils.screenshot.entirePage)
|
.then(CasperUtils.screenshot.entirePage)
|
||||||
.then(CasperUtils.asserts.selectorContainsText(
|
.then(CasperUtils.asserts.selectorContainsText(
|
||||||
'div.levelNameWrapper',
|
'div.levelNameWrapper',
|
||||||
|
|
|
@ -23,7 +23,7 @@ var levelIconIDsForPages = function(start, end) {
|
||||||
.reduce(flattenArray);
|
.reduce(flattenArray);
|
||||||
};
|
};
|
||||||
|
|
||||||
casper.start(
|
CasperUtils.start(casper,
|
||||||
CasperUtils.getUrlForCommands([
|
CasperUtils.getUrlForCommands([
|
||||||
'levels',
|
'levels',
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var CasperUtils = require('./casperUtils').CasperUtils;
|
var CasperUtils = require('./casperUtils').CasperUtils;
|
||||||
|
|
||||||
casper.start(
|
CasperUtils.start(casper,
|
||||||
CasperUtils.getUrlForCommands([
|
CasperUtils.getUrlForCommands([
|
||||||
'level intro1 --noIntroDialog --noStartCommand',
|
'level intro1 --noIntroDialog --noStartCommand',
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var CasperUtils = require('./casperUtils').CasperUtils;
|
var CasperUtils = require('./casperUtils').CasperUtils;
|
||||||
|
|
||||||
casper.start(
|
CasperUtils.start(casper,
|
||||||
CasperUtils.getUrlForCommands([
|
CasperUtils.getUrlForCommands([
|
||||||
'level intro1 --noIntroDialog --noStartCommand',
|
'level intro1 --noIntroDialog --noStartCommand',
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var CasperUtils = require('./casperUtils').CasperUtils;
|
var CasperUtils = require('./casperUtils').CasperUtils;
|
||||||
|
|
||||||
casper.start(
|
CasperUtils.start(casper,
|
||||||
CasperUtils.getUrlForCommands([
|
CasperUtils.getUrlForCommands([
|
||||||
'level intro1 --noIntroDialog --noStartCommand',
|
'level intro1 --noIntroDialog --noStartCommand',
|
||||||
'show goal',
|
'show goal',
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var CasperUtils = require('./casperUtils').CasperUtils;
|
var CasperUtils = require('./casperUtils').CasperUtils;
|
||||||
|
|
||||||
casper.start(
|
CasperUtils.start(casper,
|
||||||
CasperUtils.getUrlForCommands([
|
CasperUtils.getUrlForCommands([
|
||||||
'locale fr_FR',
|
'locale fr_FR',
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -21,7 +21,7 @@ var headerLocaleMap = {
|
||||||
'pt-BR': 'pt_BR'
|
'pt-BR': 'pt_BR'
|
||||||
};
|
};
|
||||||
|
|
||||||
casper.start(
|
CasperUtils.start(casper,
|
||||||
CasperUtils.getUrl(),
|
CasperUtils.getUrl(),
|
||||||
function() {
|
function() {
|
||||||
this.test.assertTitle('Learn Git Branching');
|
this.test.assertTitle('Learn Git Branching');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var CasperUtils = require('./casperUtils').CasperUtils;
|
var CasperUtils = require('./casperUtils').CasperUtils;
|
||||||
|
|
||||||
casper.start(
|
CasperUtils.start(casper,
|
||||||
CasperUtils.getUrlWithQueryParams({
|
CasperUtils.getUrlWithQueryParams({
|
||||||
locale: 'fr_FR',
|
locale: 'fr_FR',
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var CasperUtils = require('./casperUtils').CasperUtils;
|
var CasperUtils = require('./casperUtils').CasperUtils;
|
||||||
|
|
||||||
casper.start(
|
CasperUtils.start(casper,
|
||||||
CasperUtils.getUrlForCommands([
|
CasperUtils.getUrlForCommands([
|
||||||
'git commit',
|
'git commit',
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -28,6 +28,15 @@ var CommandView = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
onModelDestroy: function() {
|
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);
|
React.unmountComponentAtNode(this.getDOMNode().parentNode);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -94,9 +94,6 @@
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- Dependencies -->
|
<!-- Dependencies -->
|
||||||
{{jsDependencies}}
|
|
||||||
|
|
||||||
<script src="lib/jquery-ui-1.9.0.custom.min.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// PhantomJS doesn't support bind yet LOL. polyfill
|
// PhantomJS doesn't support bind yet LOL. polyfill
|
||||||
Function.prototype.bind = Function.prototype.bind || function (thisp) {
|
Function.prototype.bind = Function.prototype.bind || function (thisp) {
|
||||||
|
@ -107,6 +104,10 @@
|
||||||
};
|
};
|
||||||
</script>
|
</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
|
<!-- Templates from here on out. Someone seriously needs to fix template
|
||||||
management for node.js apps. I know there is the text plugin
|
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... -->
|
for requireJS but that's lame. For now, they are all listed here... -->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue