more test for command history

This commit is contained in:
Peter Cottle 2015-04-05 22:39:22 -07:00
parent 61028608e6
commit d17ec768af
2 changed files with 39 additions and 0 deletions

View file

@ -78,6 +78,20 @@ var CasperUtils = {
};
},
selectorMatchesRegex: function(selector, regex) {
return function then() {
this.test.assertEvalEquals(function(selector, regex) {
return !!document.querySelector(selector).innerText
.match(regex);
},
true,
'Checking that selector "' + selector + '" matches regex "' +
regex + '".',
{selector: selector, regex: regex}
);
};
},
selectorContainsText: function(selector, text) {
return function then() {
this.test.assertEvalEquals(function(selector) {

View file

@ -0,0 +1,25 @@
var CasperUtils = require('./casperUtils').CasperUtils;
casper.start(
CasperUtils.getUrl(),
function() {
this.test.assertTitle('Learn Git Branching');
casper.waitFor(CasperUtils.waits.jsMount)
.wait(300)
.then(CasperUtils.enterCommand('git commit'))
.wait(800)
.then(CasperUtils.screenshot.entirePage)
.then(function() {
this.page.sendEvent('keypress', this.page.event.key.Up);
})
.wait(700)
.then(CasperUtils.screenshot.entirePage)
// Our command got remembered
.then(CasperUtils.asserts.selectorMatchesRegex(
'#commandLineBar p.command',
// some weird whitespace conversion of non-breaking space
/git\scommit/g
))
.then(CasperUtils.testDone);
}).run();