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 | 129x 88x 41x 33x 1x 32x 1x 31x 128x 32x 13x 10x 8x | /**
* replaces whitespaces with underscore and removes dots
* @param {String} str variable to sanitize
* @return {String} sanitized variable
*/
export function sanitizeString (str) {
if (!str) {
return ''
}
return String(str)
.replace(/^.*\/([^/]+)\/?$/, '$1')
.replace(/\./g, '_')
.replace(/\s/g, '')
.toLowerCase()
}
/**
* formats capability object into sanitized string for e.g.filenames
* @param {Object} caps Selenium capabilities
*/
export function sanitizeCaps (caps) {
if (!caps) {
return ''
}
let result
/**
* mobile caps
*/
if (caps.deviceName) {
result = [
sanitizeString(caps.deviceName),
sanitizeString(caps.platformName),
sanitizeString(caps.platformVersion),
sanitizeString(caps.app)
]
} else {
result = [
sanitizeString(caps.browserName),
sanitizeString(caps.version || caps.browserVersion),
sanitizeString(caps.platform || caps.platformName),
sanitizeString(caps.app)
]
}
result = result.filter(n => n !== undefined && n !== '')
return result.join('.')
}
/**
* Takes a event emitted by a framework and extracts
* an array of errors representing test or hook failures.
* This exists to maintain compatibility between frameworks
* with have a soft assertion model (Jasmine) and those that
* have a hard assertion model (Mocha)
* @param {*} e An event emitted by a framework adapter
*/
export function getErrorsFromEvent(e) {
if (e.errors) return e.errors
if (e.error) return [e.error]
return []
}
|