function expectOutput(browser, expected, waitNotNull=false, waitWindow=1000) {
    if (waitNotNull && expected !== "") {
        browser.waitUntil(async function() {
            const output = await this.execute(function() {
                return window.app.manager.output.outputEditorView.state.doc.toString();
            });
            return output.length;
        }, waitWindow);
    }

    browser.execute(expected => {
        return window.app.manager.output.outputEditorView.state.doc.toString();
    }, [expected], function({value}) {
        if (expected instanceof RegExp) {
            browser.expect(value).match(expected);
        } else {
            browser.expect(value).to.be.equal(expected);
        }
    });
}
@function
Tests whether the output matches a given value

@param {Browser} browser - Nightwatch client
@param {string|RegExp} expected - The expected output value
@param {boolean} [waitNotNull=false] - Wait for the output to not be empty before testing the value
@param {number} [waitWindow=1000] - The number of milliseconds to wait for the output to be correct