All files / wdio-devtools-service/src constants.js

100% Statements 9/9
100% Branches 0/0
100% Functions 0/0
100% Lines 9/9

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          6x                                                                         6x           6x 6x 6x 6x 6x 6x   6x                                                                                                                                
import { throttling } from 'lighthouse/lighthouse-core/config/constants'
 
/**
 * performance tracing categories
 */
export const DEFAULT_TRACING_CATEGORIES = [
    // Exclude default categories. We'll be selective to minimize trace size
    '-*',
 
    // Used instead of 'toplevel' in Chrome 71+
    'disabled-by-default-lighthouse',
 
    // All compile/execute events are captured by parent events in devtools.timeline..
    // But the v8 category provides some nice context for only <0.5% of the trace size
    'v8',
    // Same situation here. This category is there for RunMicrotasks only, but with other teams
    // accidentally excluding microtasks, we don't want to assume a parent event will always exist
    'v8.execute',
 
    // For extracting UserTiming marks/measures
    'blink.user_timing',
 
    // Not mandatory but not used much
    'blink.console',
 
    // Most the events we need come in on these two
    'devtools.timeline',
    'disabled-by-default-devtools.timeline',
 
    // Up to 450 (https://goo.gl/rBfhn4) JPGs added to the trace
    'disabled-by-default-devtools.screenshot',
 
    // This doesn't add its own events, but adds a `stackTrace` property to devtools.timeline events
    'disabled-by-default-devtools.timeline.stack',
 
    // Include screenshots for frame viewer
    'disabled-by-default-devtools.screenshot'
]
 
/**
 * ignored urls in request logger
 */
export const IGNORED_URLS = [
    'data:,', // empty pages
    'about:', // new tabs
    'chrome-extension://' // all chrome extensions
]
 
export const FRAME_LOAD_START_TIMEOUT = 2000
export const TRACING_TIMEOUT = 10000
export const CPU_IDLE_TRESHOLD = 10000
export const MAX_TRACE_WAIT_TIME = 45000
export const NETWORK_IDLE_TIMEOUT = 5000
export const DEFAULT_NETWORK_THROTTLING_STATE = 'Good 3G'
 
export const NETWORK_STATES = {
    offline: {
        offline: true,
        latency: 0,
        downloadThroughput: 0,
        uploadThroughput: 0
    },
    GPRS: {
        offline: false,
        downloadThroughput: 50 * 1024 / 8,
        uploadThroughput: 20 * 1024 / 8,
        latency: 500
    },
    'Regular 2G': {
        offline: false,
        downloadThroughput: 250 * 1024 / 8,
        uploadThroughput: 50 * 1024 / 8,
        latency: 300
    },
    'Good 2G': {
        offline: false,
        downloadThroughput: 450 * 1024 / 8,
        uploadThroughput: 150 * 1024 / 8,
        latency: 150
    },
    'Regular 3G': {
        offline: false,
        latency: throttling.mobileRegluar3G.requestLatencyMs,
        // DevTools expects throughput in bytes per second rather than kbps
        downloadThroughput: Math.floor(throttling.mobileRegluar3G.downloadThroughputKbps * 1024 / 8),
        uploadThroughput: Math.floor(throttling.mobileRegluar3G.uploadThroughputKbps * 1024 / 8)
    },
    'Good 3G': {
        offline: false,
        latency: throttling.mobileSlow4G.requestLatencyMs,
        // DevTools expects throughput in bytes per second rather than kbps
        downloadThroughput: Math.floor(throttling.mobileSlow4G.downloadThroughputKbps * 1024 / 8),
        uploadThroughput: Math.floor(throttling.mobileSlow4G.uploadThroughputKbps * 1024 / 8)
    },
    'Regular 4G': {
        offline: false,
        downloadThroughput: 4 * 1024 * 1024 / 8,
        uploadThroughput: 3 * 1024 * 1024 / 8,
        latency: 20
    },
    'DSL': {
        offline: false,
        downloadThroughput: 2 * 1024 * 1024 / 8,
        uploadThroughput: 1 * 1024 * 1024 / 8,
        latency: 5
    },
    'Wifi': {
        offline: false,
        downloadThroughput: 30 * 1024 * 1024 / 8,
        uploadThroughput: 15 * 1024 * 1024 / 8,
        latency: 2
    },
    online: {
        offline: false,
        latency: 0,
        downloadThroughput: -1,
        uploadThroughput: -1
    }
}