casper.test.begin('markdown', 5, function (test) { casper .start('../../examples/markdown/index.html') .then(function () { test.assertEval(function () { return document.querySelector('textarea').value === '# hello' }) test.assertEval(function () { return document.querySelector('#editor div') .innerHTML === '

hello

\n' }) }) .then(function () { this.sendKeys( 'textarea', '## yo\n\n' + '- test\n' + '- hi\n\n' ) // keyUp(13) }) .then(function () { // assert the output is not updarted yet because of // debounce test.assertEval(function () { return document.querySelector('#editor div') .innerHTML === '

hello

\n' }) }) .wait(300) // wait for debounce .then(function () { test.assertEval(function () { return document.querySelector('textarea').value === '## yo\n\n- test\n- hi\n\n# hello' }) test.assertEval(function () { return document.querySelector('#editor div') .innerHTML === '

yo

\n' + '\n' + '

hello

\n' }) }) // run .run(function () { test.done() }) })