sitespeedio / sitespeed.io

sitespeed.io is an open-source tool for comprehensive web performance analysis, enabling you to test, monitor, and optimize your website’s speed using real browsers in various environments.
https://www.sitespeed.io/
MIT License
4.72k stars 596 forks source link

Issue facing while including more than one start and stop commands #4228

Open sweety-18 opened 1 month ago

sweety-18 commented 1 month ago

Your question

I was executing sitespeed scripts to capture response times. When I tried to run script with including more than one start and stop commands i.e., [ await commands.measure.start(''); await commands.measure.stop(); ]

in a script file, I am getting an error. I was not getting with previous version, with updated latest version only I am getting this error.

ERROR: Caught error from Browsertime TypeError: result[resultIndex].files.screenshot[runIndex] is not iterable at BrowsertimePlugin.processMessage (file:///usr/src/app/lib/plugins/browsertime/index.js:430:76)

Command: docker run --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io XXX.js --multi --viewPort 1786x708 --maxLoadTime 180000 --video=false --visualMetrics=false --visualElements=false --browsertime.screenshot false --browsertime.screenshotLCP false --browsertime.screenshotLS false --plugins.remove screenshot --plugins.remove har -n 1 -b chrome

Script:

await commands.addText.byId('XXX', 'username'); await commands.click.byXpathAndWait(""); await commands.addText.byId('XXX', 'password'); await commands.measure.start('Test1'); await commands.click.byXpathAndWait(""); await commands.measure.stop(); await commands.wait.byXpath("", X0000)

await commands.measure.start('Test2'); await commands.click.byXpathAndWait(""); await commands.click.byXpathAndWait(''); await commands.measure.stop();

soulgalore commented 1 month ago

Hi @sweety-18 what was your previous version and which is your current version? I want to check if browsers updated between the versions. I'm thinking maybe pages do not navigate to a new page when you click? Or if you watch the result, what do you see?

sweety-18 commented 1 month ago

Hi @soulgalore, current version is sitespeed.io: 34.3.4. It is able to navigate, But in the end giving an error. Exact output:

[2024-07-01 23:26:51] INFO: Running tests using Chrome - 1 iteration(s) [2024-07-01 23:26:52] INFO: Navigating to url iteration 1 [2024-07-01 23:27:03] INFO: Start to measure Login [2024-07-01 23:27:12] INFO: Start to measure XXX [2024-07-01 23:27:24] INFO: url1 73 requests, TTFB: 66ms, firstPaint: 583ms, FCP: 802ms, DOMContentLoaded: 87ms, LCP: 1.17s, CLS: 0.0001, TBT: 38ms, CPUBenchmark: 39ms, Load: 479ms [2024-07-01 23:27:24] INFO: url2 37 requests, TTFB: 66ms, firstPaint: 583ms, FCP: 802ms, DOMContentLoaded: 87ms, LCP: 11.85s, CLS: 0.0007, TBT: 38ms, CPUBenchmark: 39ms, Load: 479ms [2024-07-01 23:27:24] ERROR: Caught error from Browsertime TypeError: result[resultIndex].files.screenshot[runIndex] is not iterable at BrowsertimePlugin.processMessage (file:///usr/src/app/lib/plugins/browsertime/index.js:430:76) [2024-07-01 23:27:24] INFO: HTML stored in /sitespeed.io/sitespeed-result/Test_script_1_js/2024-07-01-23-26-51

soulgalore commented 1 month ago

What version were you using before?

Here's how you can help me so I can reproduce it: https://www.sitespeed.io/documentation/sitespeed.io/bug-report/

sweety-18 commented 1 month ago

We were using 34.3.3 previously.

soulgalore commented 1 month ago

Can you try 34.3.5 or a later version? 34.3.4 disabled all LCP/CLS by default, so 34.3.5 fixed the LCP and CLS disabling screenshots better. Can you please share your configuration so I can try to reproduce it? My guess is then that it has something todo with the disabling of LCP/CLS if that what you do, but full configuration would help. Thanks!

sweety-18 commented 1 month ago

I tried executing scripts with the updated version 34.3.7.

Command: docker run --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io XXX.js --multi --viewPort 1786x708 --maxLoadTime 180000 --video=false --visualMetrics=false --visualElements=false --browsertime.screenshot false --browsertime.screenshotLCP false --browsertime.screenshotLS false --plugins.remove screenshot --plugins.remove har -n 1 -b chrome

Output: Chromium 107.0.5304.62 Ubuntu 22.04 Mozilla Firefox 127.0.2 [2024-07-22 15:02:11] INFO: Versions OS: linux 6.6.26-linuxkit nodejs: v20.9.0 sitespeed.io: 34.7.1 browsertime: 22.6.0 coach: 8.0.2 [2024-07-22 15:02:11] INFO: Running tests using Chrome - 1 iteration(s) [2024-07-22 15:02:11] INFO: Start to measure XXX [2024-07-22 15:02:11] INFO: Navigating to url XXX 1 [2024-07-22 15:02:38] INFO: Start to measure XXX [2024-07-22 15:02:52] INFO: XXX 36 requests, TTFB: 589ms, firstPaint: 1.48s, FCP: 1.78s, DOMContentLoaded: 799ms, LCP: 2.03s, CLS: 0.0005, TBT: 0ms, CPUBenchmark: 53ms, Load: 1.46s [2024-07-22 15:02:52] INFO: XXX 88 requests, TTFB: 278ms, firstPaint: 749ms, FCP: 749ms, DOMContentLoaded: 816ms, LCP: 714ms, CLS: 0.1798, TBT: 2.46s, CPUBenchmark: 45ms, Load: 6.23s [2024-07-22 15:02:52] ERROR: Caught error from Browsertime TypeError: result[resultIndex].files.screenshot[runIndex] is not iterable at BrowsertimePlugin.processMessage (file:///usr/src/app/lib/plugins/browsertime/index.js:430:76) [2024-07-22 15:02:52] INFO: HTML stored in /sitespeed.io/sitespeed-result/XXX/2024-07-22-15-02-11

sweety-18 commented 3 weeks ago

Can you please take a look at this issue, even after updating the version, I am not able to run with more than one start and stop commands.