function selectTextInEditor(start, end) {
            var marksVisible = false;
            runs(function () {
                cm.setSelection(start, end);
                setTimeout(function () {
                    //wait for foldmarks to be rendered
                    marksVisible = true;
                }, 410);
            });

            waitsFor(function () {
                return marksVisible;
            }, "Fold markers now visible in gutter", 500);
        }
Helper function to select a range of text in the editor
@param   {CodeMirror.Pos} start the start position of the selection
@param   {CodeMirror.Pos} end   the end position of the selection