mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-15 00:54:25 +02:00
objective popping test
This commit is contained in:
parent
17ba5639f6
commit
adbe798b25
2 changed files with 39 additions and 2 deletions
38
src/__tests__/casperjs/level_objective_test.js
Normal file
38
src/__tests__/casperjs/level_objective_test.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
var CasperUtils = require('./casperUtils').CasperUtils;
|
||||||
|
|
||||||
|
casper.start(
|
||||||
|
CasperUtils.getUrlForCommands([
|
||||||
|
'level intro1 --noIntroDialog --noStartCommand',
|
||||||
|
]),
|
||||||
|
function() {
|
||||||
|
casper.waitFor(CasperUtils.waits.jsMount)
|
||||||
|
.waitFor(CasperUtils.waits.allCommandsFinished)
|
||||||
|
.then(CasperUtils.asserts.visibleSelectors([
|
||||||
|
'p.commandLine.finished',
|
||||||
|
'div.levelNameWrapper'
|
||||||
|
]))
|
||||||
|
.then(CasperUtils.screenshot.entirePage)
|
||||||
|
.then(function() {
|
||||||
|
this.mouse.click('#show-objective');
|
||||||
|
})
|
||||||
|
.then(CasperUtils.waits.selectorVisible(
|
||||||
|
'p.commandLine.processing'
|
||||||
|
))
|
||||||
|
.wait(1000)
|
||||||
|
.then(CasperUtils.screenshot.entirePage)
|
||||||
|
.then(CasperUtils.asserts.visibleSelectors([
|
||||||
|
'div.inside',
|
||||||
|
'div.modalTerminal'
|
||||||
|
]))
|
||||||
|
.then(function() {
|
||||||
|
var text = this.evaluate(function() {
|
||||||
|
return document.querySelector('div.inside > div > p').innerText;
|
||||||
|
});
|
||||||
|
this.test.assert(
|
||||||
|
text === "Go ahead and try it out on your own! After this " +
|
||||||
|
"window closes, make two commits to complete the level"
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.then(CasperUtils.testDone);
|
||||||
|
}).run();
|
||||||
|
|
|
@ -13,7 +13,7 @@ casper.start(
|
||||||
]))
|
]))
|
||||||
.then(CasperUtils.screenshot.entirePage)
|
.then(CasperUtils.screenshot.entirePage)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
this.mouse.click('#show-goal')
|
this.mouse.click('#show-goal');
|
||||||
})
|
})
|
||||||
.then(CasperUtils.waits.selectorVisible(
|
.then(CasperUtils.waits.selectorVisible(
|
||||||
'p.helperText'
|
'p.helperText'
|
||||||
|
@ -25,7 +25,6 @@ casper.start(
|
||||||
var text = this.evaluate(function() {
|
var text = this.evaluate(function() {
|
||||||
return document.querySelector('p.helperText').innerText;
|
return document.querySelector('p.helperText').innerText;
|
||||||
});
|
});
|
||||||
casper.echo(text);
|
|
||||||
this.test.assert(
|
this.test.assert(
|
||||||
text === 'You can hide this window with "hide goal"'
|
text === 'You can hide this window with "hide goal"'
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue