Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | 20x 20x 20x 20x 20x 20x 1x 1x 1x 1x 2x 2x 2x 5x 5x 4x 8x 12x 2x 4x 4x 9x 18x 6x 4x 7x 7x 7x 7x 7x 3x 3x 3x 4x | import WDIOReporter from '@wdio/reporter' import chalk from 'chalk' export default class ConciseReporter extends WDIOReporter { constructor (options) { /** * make Concise reporter to write to output stream by default */ options = Object.assign(options, { stdout: true }) super(options) // keep track of the order that suites were called this.suiteUids = [] this.suites = [] this.stateCounts = { failed : 0 } this.chalk = chalk } onSuiteStart (suite) { this.suiteUids.push(suite.uid) } onSuiteEnd (suite) { this.suites.push(suite) } onTestFail () { this.stateCounts.failed++ } onRunnerEnd (runner) { this.printReport(runner) } /** * Print the Concise report to the screen * @param {Object} runner Wdio runner */ printReport(runner) { const header = this.chalk.yellow('========= Your concise report ==========') const output = [ this.getEnviromentCombo(runner.capabilities), this.getCountDisplay(), ...this.getFailureDisplay() ] this.write(`${header}\n${output.join('\n')}\n`) } /** * Get the display for failing tests * @return {String} Count display */ getCountDisplay () { const failedTestsCount = this.stateCounts.failed return failedTestsCount > 0 ? `Test${failedTestsCount > 1 ? 's' : ''} failed (${failedTestsCount}):` : 'All went well !!' } /** * Get display for failed tests, e.g. stack trace * @return {Array} Stack trace output */ getFailureDisplay () { const output = [] this.getOrderedSuites().map(suite => suite.tests.map(test => { if (test.state === 'failed') { output.push( ` Fail : ${this.chalk.red(test.title)}`, ` ${test.error.type} : ${this.chalk.yellow(test.error.message)}` ) } })) return output } /** * Get suites in the order they were called * @return {Array} Ordered suites */ getOrderedSuites () { this.orderedSuites = [] this.suiteUids.map(uid => this.suites.map(suite => { if (suite.uid === uid) { this.orderedSuites.push(suite) } })) return this.orderedSuites } /** * Get information about the enviroment * @param {Object} caps Enviroment details * @param {Boolean} verbose * @return {String} Enviroment string */ getEnviromentCombo (caps) { const device = caps.deviceName const browser = caps.browserName || caps.browser const version = caps.version || caps.platformVersion || caps.browser_version const platform = caps.os ? (caps.os + ' ' + caps.os_version) : (caps.platform || caps.platformName) // mobile capabilities if (device) { const program = (caps.app || '').replace('sauce-storage:', '') || caps.browserName const executing = program ? `executing ${program}` : '' return `${device} on ${platform} ${version} ${executing}`.trim() } return browser + (version ? ` (v${version})` : '') + (platform ? ` on ${platform}` : '') } } |