forked from pcottle/learnGitBranching
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
93 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
var CasperHelp = { | ||
|
||
getRoot: function() { | ||
// Unfortunately this is hardcoded for now :*( cant get the path | ||
// variable while in a casper context | ||
return '/Users/pcottle/Dropbox/wip/learnGitBranching/'; | ||
}, | ||
|
||
getUrl: function () { | ||
return 'file://localhost/' + this.getRoot() + '/index.html?NODEMO'; | ||
}, | ||
|
||
getUrlForCommands: function(commands) { | ||
return this.getUrl() + '&command=' + commands.join(';'); | ||
}, | ||
|
||
waits: { | ||
jsMount: function() { | ||
return this.evaluate(function() { | ||
return document.querySelectorAll('div.BaseHelperBar').length > 0; | ||
}); | ||
}, | ||
|
||
allCommandsFinished: function () { | ||
return this.evaluate(function() { | ||
return document.querySelectorAll('p.commandLine').length === | ||
document.querySelectorAll('p.finished').length; | ||
}); | ||
}, | ||
}, | ||
|
||
}; | ||
|
||
exports.CasperHelp = CasperHelp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
var CasperHelp = require('./casperHelp').CasperHelp; | ||
|
||
var visibleIDs = [ | ||
'commandLineHistory', | ||
'terminal', | ||
'interfaceWrapper', | ||
'mainVisSpace', | ||
'commandLineBar' | ||
]; | ||
|
||
var selectors = [ | ||
'div.visBackgroundColor', | ||
'p.commandLine' | ||
]; | ||
|
||
var doneSelectors = [ | ||
'p.finished' | ||
]; | ||
|
||
casper.start( | ||
CasperHelp.getUrlForCommands([ | ||
'git commit', | ||
]), | ||
function() { | ||
this.test.assertTitle('Learn Git Branching'); | ||
|
||
casper.waitFor(CasperHelp.waits.jsMount, function then() { | ||
visibleIDs.forEach(function(id) { | ||
this.test.assertVisible('#' + id); | ||
}.bind(this)); | ||
|
||
selectors.forEach(function(selector) { | ||
this.test.assertExists(selector); | ||
}.bind(this)); | ||
|
||
this.test.done(); | ||
}) | ||
.waitFor(CasperHelp.waits.allCommandsFinished, function then() { | ||
doneSelectors.forEach(function(selector) { | ||
this.test.assertExists(selector); | ||
}.bind(this)); | ||
}); | ||
|
||
}); | ||
|
||
casper.run(); |