mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-07 13:14:25 +02:00
test refactor
This commit is contained in:
parent
fba7e4bb3d
commit
8709f87b4f
2 changed files with 13 additions and 8 deletions
|
@ -1,8 +1,9 @@
|
|||
var CasperHelp = {
|
||||
var CasperUtils = {
|
||||
|
||||
getRoot: function() {
|
||||
// Unfortunately this is hardcoded for now :*( cant get the path
|
||||
// variable while in a casper context
|
||||
// variable synchronously when running this test, and CasperJS does
|
||||
// not like being started asynchronously.
|
||||
return '/Users/pcottle/Dropbox/wip/learnGitBranching/';
|
||||
},
|
||||
|
||||
|
@ -17,7 +18,11 @@ var CasperHelp = {
|
|||
waits: {
|
||||
jsMount: function() {
|
||||
return this.evaluate(function() {
|
||||
return document.querySelectorAll('div.BaseHelperBar').length > 0;
|
||||
var hasHelper = document.querySelectorAll('div.BaseHelperBar').length > 0;
|
||||
if (hasHelper) {
|
||||
__utils__.echo('<<< JS mounted >>>');
|
||||
}
|
||||
return hasHelper;
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -31,4 +36,4 @@ var CasperHelp = {
|
|||
|
||||
};
|
||||
|
||||
exports.CasperHelp = CasperHelp;
|
||||
exports.CasperUtils = CasperUtils;
|
|
@ -1,4 +1,4 @@
|
|||
var CasperHelp = require('./casperHelp').CasperHelp;
|
||||
var CasperUtils = require('./casperUtils').CasperUtils;
|
||||
|
||||
var visibleIDs = [
|
||||
'commandLineHistory',
|
||||
|
@ -18,13 +18,13 @@ var doneSelectors = [
|
|||
];
|
||||
|
||||
casper.start(
|
||||
CasperHelp.getUrlForCommands([
|
||||
CasperUtils.getUrlForCommands([
|
||||
'git commit',
|
||||
]),
|
||||
function() {
|
||||
this.test.assertTitle('Learn Git Branching');
|
||||
|
||||
casper.waitFor(CasperHelp.waits.jsMount, function then() {
|
||||
casper.waitFor(CasperUtils.waits.jsMount, function then() {
|
||||
visibleIDs.forEach(function(id) {
|
||||
this.test.assertVisible('#' + id);
|
||||
}.bind(this));
|
||||
|
@ -34,7 +34,7 @@ casper.start(
|
|||
}.bind(this));
|
||||
|
||||
})
|
||||
.waitFor(CasperHelp.waits.allCommandsFinished, function then() {
|
||||
.waitFor(CasperUtils.waits.allCommandsFinished, function then() {
|
||||
doneSelectors.forEach(function(selector) {
|
||||
this.test.assertExists(selector);
|
||||
}.bind(this));
|
Loading…
Add table
Add a link
Reference in a new issue