diff --git a/src/__tests__/casperjs/level_objective_test.js b/src/__tests__/casperjs/level_objective_test.js new file mode 100644 index 00000000..1e97e856 --- /dev/null +++ b/src/__tests__/casperjs/level_objective_test.js @@ -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(); + diff --git a/src/__tests__/casperjs/level_show_goal_test.js b/src/__tests__/casperjs/level_show_goal_test.js index 4a52a833..bc11c341 100644 --- a/src/__tests__/casperjs/level_show_goal_test.js +++ b/src/__tests__/casperjs/level_show_goal_test.js @@ -13,7 +13,7 @@ casper.start( ])) .then(CasperUtils.screenshot.entirePage) .then(function() { - this.mouse.click('#show-goal') + this.mouse.click('#show-goal'); }) .then(CasperUtils.waits.selectorVisible( 'p.helperText' @@ -25,7 +25,6 @@ casper.start( var text = this.evaluate(function() { return document.querySelector('p.helperText').innerText; }); - casper.echo(text); this.test.assert( text === 'You can hide this window with "hide goal"' );