helpers.js
function (view) {
            return function () {
                if (
                    view === 'structure' && this.exists('.cms-toolbar-item-cms-mode-switcher .cms-btn-active') ||
                    view === 'content' && !this.exists('.cms-toolbar-item-cms-mode-switcher .cms-btn-active')
                ) {
                    return this.wait(100);
                }

                return this.waitForSelector('.cms-toolbar-expanded')
                    .then(function () {
                        return this.click('.cms-toolbar-item-cms-mode-switcher .cms-btn');
                    })
                    .then(function () {
                        if (view === 'structure') {
                            return this.waitForSelector('.cms-structure-content .cms-dragarea');
                        } else if (view === 'content') {
                            return this.waitWhileSelector('.cms-structure-mode-structure');
                        }

                        throw new Error(
                            'Invalid arguments passed to cms.switchTo, should be either "structure" or "content"'
                        );
                    });
            };
        }
function (view) {
            return function () {
                if (
                    view === 'structure' && this.exists('.cms-toolbar-item-cms-mode-switcher .cms-btn-active') ||
                    view === 'content' && !this.exists('.cms-toolbar-item-cms-mode-switcher .cms-btn-active')
                ) {
                    return this.wait(100);
                }

                return this.waitForSelector('.cms-toolbar-expanded')
                    .then(function () {
                        return this.click('.cms-toolbar-item-cms-mode-switcher .cms-btn');
                    })
                    .then(function () {
                        if (view === 'structure') {
                            return this.waitForSelector('.cms-structure-content .cms-dragarea');
                        } else if (view === 'content') {
                            return this.waitWhileSelector('.cms-structure-mode-structure');
                        }

                        throw new Error(
                            'Invalid arguments passed to cms.switchTo, should be either "structure" or "content"'
                        );
                    });
            };
        }
function ( view ) { return function ( ) { if ( view === 'structure' && this . exists ( '.cms-toolbar-item-cms-mode-switcher .cms-btn-active' ) || view === 'content' && ! this . exists ( '.cms-toolbar-item-cms-mode-switcher .cms-btn-active' ) ) { return this . wait ( 100 ) ; } return this . waitForSelector ( '.cms-toolbar-expanded' ) . then ( function ( ) { return this . click ( '.cms-toolbar-item-cms-mode-switcher .cms-btn' ) ; } ) . then ( function ( ) { if ( view === 'structure' ) { return this . waitForSelector ( '.cms-structure-content .cms-dragarea' ) ; } else if ( view === 'content' ) { return this . waitWhileSelector ( '.cms-structure-mode-structure' ) ; } throw new Error ( 'Invalid arguments passed to cms.switchTo, should be either "structure" or "content"' ) ; } ) ; } ; }
Switches structureboard to a specific mode.

@function switchTo
@param {String} view 'structure' or 'content'
@returns {Function}
Switches structureboard to a specific mode .