webdriverio-boneyard/wdio-devtools-service

getMetrics() result the same values

rdpanek opened this issue · 0 comments

My setup:

OSX 10.14.4

"devDependencies": {
    "@babel/cli": "7.2.3",
    "@babel/core": "7.4.0",
    "@babel/preset-env": "7.4.2",
    "@babel/register": "7.4.0",
    "@wdio/cli": "5.9.4",
    "@wdio/devtools-service": "5.9.6",
    "@wdio/local-runner": "5.9.4",
    "@wdio/mocha-framework": "5.9.4",
    "@wdio/spec-reporter": "5.7.2",
    "@wdio/sync": "5.9.4",
    "aws-sdk": "2.0.9",
    "chai": "4.2.0",
    "node-uuid": "1.4.8",
    "webdriverio": "5.9.4"
  }

**wdio.conf.js••
['devtools', {debuggerAddresss: 'localhost:9222'}]

Example
describe('PT demo', () => {
before(() => {
browser.enablePerformanceAudits()
})

it('page a', () => {
browser.url('https://www.xyz.com/')
console.log(browser.getMetrics())
})

it('page b', () => {
browser.url('https://www.xyz.com/en/shop/')
console.log(browser.getMetrics())
})

it('page c', () => {
browser.url('https://www.xyz.com/en/shop/basket.html')
console.log(browser.getMetrics())
})

after(() => {
browser.disablePerformanceAudits()
})
})

Second and third method getMetrics results the same value. Where is a problem?

Result

[0-0] RUNNING in chrome - /test/demo/metrics.js
[0-0] 2019-06-12T22:34:21.748Z ERROR @wdio/devtools-service:TraceGatherer: Neither network nor CPU idle time could be detected within timeout, wrapping up tracing
[0-0] { estimatedInputLatency: 19,
  timeToFirstByte: 563,
  domContentLoaded: 6191,
  firstVisualChange: 6003,
  firstPaint: 5979,
  firstContentfulPaint: 6234,
  firstMeaningfulPaint: 7569,
  lastVisualChange: 58303,
  firstCPUIdle: 9135,
  firstInteractive: 13511,
  load: 13508,
  speedIndex: 7010 }
[0-0] { estimatedInputLatency: 360,
  timeToFirstByte: 563,
  domContentLoaded: 9512,
  firstVisualChange: 15530,
  firstPaint: 15524,
  firstContentfulPaint: 15524,
  firstMeaningfulPaint: 15524,
  lastVisualChange: 30701,
  firstCPUIdle: 25485,
  firstInteractive: 25485,
  load: 24592,
  speedIndex: 16017 }
[0-0] { estimatedInputLatency: 360,
  timeToFirstByte: 563,
  domContentLoaded: 9512,
  firstVisualChange: 15530,
  firstPaint: 15524,
  firstContentfulPaint: 15524,
  firstMeaningfulPaint: 15524,
  lastVisualChange: 30701,
  firstCPUIdle: 25485,
  firstInteractive: 25485,
  load: 24592,
  speedIndex: 16017 }
[0-0] >>> Elastic total process time: 0 ms
[0-0] >>> Elastic total process time: 0 ms
[0-0] PASSED in chrome - /test/demo/metrics.js

 "spec" Reporter:
------------------------------------------------------------------
[chrome  mac os x #0-0] Spec: /Users/HTDOCS/test-stack/wdio-runner/test/demo/metrics.js
[chrome  mac os x #0-0] Running: chrome on mac os x
[chrome  mac os x #0-0]
[chrome  mac os x #0-0] PT demo
[chrome  mac os x #0-0]    ✓ page a
[chrome  mac os x #0-0]    ✓ page b
[chrome  mac os x #0-0]    ✓ page c
[chrome  mac os x #0-0]
[chrome  mac os x #0-0] 3 passing (1m 50.5s)


Spec Files:	 1 passed, 1 total (100% completed) in 00:01:53