Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error stopping measurement: Invalid time value #4285

Open
PapaRoach25 opened this issue Oct 3, 2024 · 12 comments
Open

Error stopping measurement: Invalid time value #4285

PapaRoach25 opened this issue Oct 3, 2024 · 12 comments

Comments

@PapaRoach25
Copy link

PapaRoach25 commented Oct 3, 2024

Your question

Hello, All

I'm experiencing an issue while calling the measure stop command (short example):
let menuXpath = await this.custom.findElementByXpathSelector("//*[contains(@class, 'settings')]"); await commands.measure.start("Home Page - Open Settings Menu"); await homePage.custom.clickByXpathAndWait(menuXpath); await commands.measure.stop();

I'm able to find an element, I'm also able to click on the element and see how the page is loading, but the measure.stop() it returns an error:
Error stopping measurement: Invalid time value
I even added hardcoded timeouts to wait after clicking by the XPath selector to be confident that the page was loaded, but I still, see the error.

INFO: Versions OS: win32 10.0.19045 nodejs: v22.9.0 sitespeed.io: 35.0.0 browsertime: 23.0.0 coach: 8.0.2

Could someone please help to resolve this issue?
Thanks in advance!

@soulgalore
Copy link
Member

Hi @PapaRoach25 thanks for creating the issue: I haven't seen Invalid time value before, can you share the exact error message/log line so I can see where it comes from?

@PapaRoach25
Copy link
Author

PapaRoach25 commented Oct 4, 2024

The error in stack:

"RangeError: Invalid time value\n
at Date.toISOString ()\n
at m.toISOString (C:\Users\user-name\AppData\Roaming\npm\node_modules\sitespeed.io\node_modules\chrome-har\node_modules\dayjs\dayjs.min.js:1:6270)\n
at module.exports (C:\Users\user-name\AppData\Roaming\npm\node_modules\sitespeed.io\node_modules\chrome-har\lib\entryFromResponse.js:189:53)\n
at harFromMessages (C:\Users\user-name\AppData\Roaming\npm\node_modules\sitespeed.io\node_modules\chrome-har\index.js:406:15)\n
at getHar (file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/node_modules/browsertime/lib/chrome/har.js:35:15)\n
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n
at async Chromium.afterPageCompleteCheck (file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/node_modules/browsertime/lib/chrome/webdriver/chromium.js:288:9)\n
at async Measure.stop (file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/node_modules/browsertime/lib/core/engine/command/measure.js:440:17)\n
at async default (file:///C:/Github/repo/projects/project-name/tests/navigation-tests.mjs:30:25)\n
at async file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/node_modules/browsertime/lib/core/engine/run.js:4:7\n
at async Iteration.run (file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/node_modules/browsertime/lib/core/engine/iteration.js:162:9)\n
at async Engine.runByScript (file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/node_modules/browsertime/lib/core/engine/index.js:308:20)\n
at async analyzeUrl (file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/lib/plugins/browsertime/analyzer.js:214:12)\n
at async BrowsertimePlugin.processMessage (file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/lib/plugins/browsertime/index.js:173:26)"

I'm using Visual Studio Code for debugging:
image
image

This part is added only for debugging purposes, I've attached to the node process while debugging:
await homePage.custom.breakpoint();

@soulgalore
Copy link
Member

Thanks, let me catch those errors.I'll do a release this weekend.

@PapaRoach25
Copy link
Author

@soulgalore - do you have any updates regarding this issue?

@soulgalore
Copy link
Member

@PapaRoach25 can you try 35.1.1 ? I rewritten the HAR functionality but I couldn't reproduce I'm not sure that is fixed?

@PapaRoach25
Copy link
Author

@soulgalore - sorry for the late response, I've tried 35.1.1 and 35.1.2 but no luck, still observing the same issue. Is there any way how can I help you with reproducing this issue?
In case any additional logs are needed or any other data I can try to gather it.

@soulgalore
Copy link
Member

Ok thanks for trying! Can you share the new trace log with the error? Thanks!

@PapaRoach25
Copy link
Author

PapaRoach25 commented Oct 11, 2024

Stack trace is the same:

"RangeError: Invalid time value\n
at Date.toISOString ()\n
at default (file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/node_modules/chrome-har/lib/entryFromResponse.js:191:58)\n
at harFromMessages (file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/node_modules/chrome-har/index.js:395:13)\n
at getHar (file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/node_modules/browsertime/lib/chrome/har.js:35:15)\n
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n
at async Chromium.afterPageCompleteCheck (file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/node_modules/browsertime/lib/chrome/webdriver/chromium.js:288:9)\n
at async Measure.stop (file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/node_modules/browsertime/lib/core/engine/command/measure.js:440:17)\n
at async default (file:///C:/Github/repo/projects/project-name/tests/navigation-tests.mjs:26:21)\n
at async file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/node_modules/browsertime/lib/core/engine/run.js:4:7\n
at async Iteration.run (file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/node_modules/browsertime/lib/core/engine/iteration.js:162:9)\n
at async Engine.runByScript (file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/node_modules/browsertime/lib/core/engine/index.js:308:20)\n
at async analyzeUrl (file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/lib/plugins/browsertime/analyzer.js:214:12)\n
at async BrowsertimePlugin.processMessage (file:///C:/Users/user-name/AppData/Roaming/npm/node_modules/sitespeed.io/lib/plugins/browsertime/index.js:173:26)"

I've implemented tests for two applications that have a similar testing approach, but the main difference lies in their DOM structure, specifically involving elements within an iframe. I'm successfully handling the switch to and from the iframe using appropriate commands. However, I'm encountering an error despite managing iframe switching properly.

For the second web application tests works as expected without any errors (iframe does not exist).

@soulgalore
Copy link
Member

Actually the error is the same, the trace is different :) I released 35.1.3 that should swallow that error, hopefully that helps. I would like a chrome trace from your test, then I can have a look at the root problem, I guess something is wrong in Chrome. I'll share how you get that later.

@PapaRoach25
Copy link
Author

@soulgalore - I've tested it with the latest version of sitespeed 35.2.0 and it's working now, it measures correctly, without any errors, thank you!
Looks like your changes to swallow the error helped. Please share the info on how I can get the rest info that you've mentioned and I will get it.

@soulgalore
Copy link
Member

Ok, thank you @PapaRoach25 . To get the trace file add --browsertime.chrome.collectPerfLog , that will produce a file named chromePerflog-1.json.gz in the results for that pages. If you can share that file that would be great.

@PapaRoach25
Copy link
Author

Thank you for the suggestion. Unfortunately, the trace file contains sensitive project data that cannot be shared in its entirety. However, I'd be happy to provide specific sections of the file if that would be helpful. Please let me know which parts would be most useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants