How to use the mochawesome/addContext function in mochawesome

To help you get started, we’ve selected a few mochawesome examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TradeMe / tractor / plugins / mocha-specs / src / protractor / debug.js View on Github external
async function takeScreenshot (browser, test) {
    try {
        let base64png = await browser.takeScreenshot();
        addContext(test, {
            title: 'Browser screenshot',
            value: `data:image/png;base64,${base64png}`
        });
    } catch {
        error('Could not take browser screenshot.');
    }
}
github TradeMe / tractor / plugins / mocha-specs / src / protractor / debug.js View on Github external
async function getBrowserLog (browser, test) {
    try {
        let consoleOutput = '';
        let browserLog = await browser.manage().logs().get('browser');
        if (browserLog.length > 0) {
            info('Browser console output:');
            browserLog.forEach(log => {
                consoleOutput += `${log.message}\n`;
                error(log.message);
            });
        }

        if (consoleOutput.length) {
            addContext(test, {
                title: 'Browser console output',
                value: consoleOutput
            });
        }
    } catch {
        error('Could not get browser console output.');
    }
}

mochawesome

A gorgeous reporter for Mocha.js

MIT
Latest version published 3 years ago

Package Health Score

70 / 100
Full package analysis

Popular mochawesome functions