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() {
|
getRoot: function() {
|
||||||
// Unfortunately this is hardcoded for now :*( cant get the path
|
// 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/';
|
return '/Users/pcottle/Dropbox/wip/learnGitBranching/';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -17,7 +18,11 @@ var CasperHelp = {
|
||||||
waits: {
|
waits: {
|
||||||
jsMount: function() {
|
jsMount: function() {
|
||||||
return this.evaluate(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 = [
|
var visibleIDs = [
|
||||||
'commandLineHistory',
|
'commandLineHistory',
|
||||||
|
@ -18,13 +18,13 @@ var doneSelectors = [
|
||||||
];
|
];
|
||||||
|
|
||||||
casper.start(
|
casper.start(
|
||||||
CasperHelp.getUrlForCommands([
|
CasperUtils.getUrlForCommands([
|
||||||
'git commit',
|
'git commit',
|
||||||
]),
|
]),
|
||||||
function() {
|
function() {
|
||||||
this.test.assertTitle('Learn Git Branching');
|
this.test.assertTitle('Learn Git Branching');
|
||||||
|
|
||||||
casper.waitFor(CasperHelp.waits.jsMount, function then() {
|
casper.waitFor(CasperUtils.waits.jsMount, function then() {
|
||||||
visibleIDs.forEach(function(id) {
|
visibleIDs.forEach(function(id) {
|
||||||
this.test.assertVisible('#' + id);
|
this.test.assertVisible('#' + id);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
@ -34,7 +34,7 @@ casper.start(
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
})
|
})
|
||||||
.waitFor(CasperHelp.waits.allCommandsFinished, function then() {
|
.waitFor(CasperUtils.waits.allCommandsFinished, function then() {
|
||||||
doneSelectors.forEach(function(selector) {
|
doneSelectors.forEach(function(selector) {
|
||||||
this.test.assertExists(selector);
|
this.test.assertExists(selector);
|
||||||
}.bind(this));
|
}.bind(this));
|
Loading…
Add table
Add a link
Reference in a new issue