helpers.js
function (opts) {
            var that = this;

            return function () {
                return this.thenOpen(globals.adminPagesUrl)
                    .waitUntilVisible('.js-cms-pagetree-options')
                    .then(that.expandPageTree())
                    .then(function () {
                        var pageId;
                        var pageNodeId;
                        var data = '';
                        var href = '';

                        if (opts && opts.title) {
                            pageId = that.getPageId(opts.title);
                            pageNodeId = that.getPageNodeId(opts.title);
                        }

                        if (pageId) {
                            data = '[data-node-id="' + pageNodeId + '"]';
                            href = '[href*="' + pageId + '"]';
                        }

                        return this.then(function () {
                            this.click('.cms-pagetree-jstree .js-cms-pagetree-options' + data);
                        })
                        .then(that.waitUntilActionsDropdownLoaded())
                        .then(function () {
                            this.click('.cms-pagetree-jstree [href*="delete"]' + href);
                        });
                    })
                    .waitForUrl(/delete/)
                    .waitUntilVisible('input[type=submit]')
                    .then(function () {
                        this.click('input[type=submit]');
                    })
                    .wait(1000)
                    .then(that.waitUntilAllAjaxCallsFinish());
            };
        }
function (opts) {
            var that = this;

            return function () {
                return this.thenOpen(globals.adminPagesUrl)
                    .waitUntilVisible('.js-cms-pagetree-options')
                    .then(that.expandPageTree())
                    .then(function () {
                        var pageId;
                        var pageNodeId;
                        var data = '';
                        var href = '';

                        if (opts && opts.title) {
                            pageId = that.getPageId(opts.title);
                            pageNodeId = that.getPageNodeId(opts.title);
                        }

                        if (pageId) {
                            data = '[data-node-id="' + pageNodeId + '"]';
                            href = '[href*="' + pageId + '"]';
                        }

                        return this.then(function () {
                            this.click('.cms-pagetree-jstree .js-cms-pagetree-options' + data);
                        })
                        .then(that.waitUntilActionsDropdownLoaded())
                        .then(function () {
                            this.click('.cms-pagetree-jstree [href*="delete"]' + href);
                        });
                    })
                    .waitForUrl(/delete/)
                    .waitUntilVisible('input[type=submit]')
                    .then(function () {
                        this.click('input[type=submit]');
                    })
                    .wait(1000)
                    .then(that.waitUntilAllAjaxCallsFinish());
            };
        }
function ( opts ) { var that = this ; return function ( ) { return this . thenOpen ( globals . adminPagesUrl ) . waitUntilVisible ( '.js-cms-pagetree-options' ) . then ( that . expandPageTree ( ) ) . then ( function ( ) { var pageId ; var pageNodeId ; var data = '' ; var href = '' ; if ( opts && opts . title ) { pageId = that . getPageId ( opts . title ) ; pageNodeId = that . getPageNodeId ( opts . title ) ; } if ( pageId ) { data = '[data-node-id="' + pageNodeId + '"]' ; href = '[href*="' + pageId + '"]' ; } return this . then ( function ( ) { this . click ( '.cms-pagetree-jstree .js-cms-pagetree-options' + data ) ; } ) . then ( that . waitUntilActionsDropdownLoaded ( ) ) . then ( function ( ) { this . click ( '.cms-pagetree-jstree [href*="delete"]' + href ) ; } ) ; } ) . waitForUrl ( / delete / ) . waitUntilVisible ( 'input[type=submit]' ) . then ( function ( ) { this . click ( 'input[type=submit]' ) ; } ) . wait ( 1000 ) . then ( that . waitUntilAllAjaxCallsFinish ( ) ) ; } ; }
removes a page by name, or the first encountered one

@param {Object} opts
@param {String} [opts.title] Name of the page to delete
@returns {Function}
removes a page by name or the first encountered one