Viewing Category: Testing  [clear category selection]

Nightwatch.js and CKEditor

I've been creating functional tests using Nightwatch.js recently. This tool uses Node.js and a simple testing framework. It's a refreshing switch from using JUnit and the Selenium Java library to write tests, yet it uses the same Selenium protocol to drive browsers with WebDriver and generates the same JUnit XML test results. I have Jenkins running a batch of Nightwatch.js tests in a job triggered after deploy. There are still some things I'm figuring out, but nothing has blocked moving forward yet.

One of the challenges that needed to be addressed was setting content inside a CKEditor. This is tricky because the editor is nested inside an iframe. After a bunch of experimentation, I settled on this method for saving a form containing a WYSIWYG component:

That test will connect to the CKEditor demo page and replace the content within, then take a screenshot like this:

Next challenge to handle: uploading files using a web application that dynamically generates the HTML elements.