mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-29 07:04:48 +02:00
more test for command history
This commit is contained in:
parent
61028608e6
commit
d17ec768af
2 changed files with 39 additions and 0 deletions
|
@ -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) {
|
||||
|
|
25
src/__tests__/casperjs/command_history_test.js
Normal file
25
src/__tests__/casperjs/command_history_test.js
Normal 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();
|
Loading…
Add table
Add a link
Reference in a new issue