Closed ankur762 closed 11 months ago
Hi @ankur762 thanks for the detailed report!
One thing I noticed is that when you run commands.measure.start
that is suppose to measure a new page view., navigating to a new page. If you use it in SPA application, you need to at least have one request that happens, so sitespeed.io internally can create a new "page" for that data. In you codeawait commands.measure.start('Enter Details');
I'm think that could better be measured with https://www.sitespeed.io/documentation/sitespeed.io/scripting/#stop-watch
I think that will fix one of the errors as first step.
Hi @soulgalore , I tried above thing but still getting the same error, const stopWatch = commands.stopWatch.get('EnterDetails'); // await commands.measure.start('Enter Details'); stopWatch.start(); await commands.mouse.clickAndHold.byXpath("//div[@class='flex-auto-grow-shrink full-width full-width formFocusable serviceAdvisor undefined css-2b097c-container']/div[1]/div[1]/div[2]/div[1]/input"); await commands.mouse.singleClick.atCursor(); await commands.addText.byXpath('perf-sa-001', "//div[@class='flex-auto-grow-shrink full-width full-width formFocusable serviceAdvisor undefined css-2b097c-container']/div[1]/div[1]/div[2]/div[1]/input");
await commands.wait.byTime(1000);
await commands.click.bySelector('*[id^="react-select-"]');
**const time = stopWatch.stop();
commands.measure.add(stopWatch.getName(), time);**
Logs :- [2022-06-07 09:08:47] INFO: Take largest contentful paint screenshot [2022-06-07 09:08:47] INFO: No element attached to the entry in largest-contentful-paint [2022-06-07 09:08:52] INFO: Get visual metrics from the video [2022-06-07 09:09:34] INFO: Get visual metrics from the video [2022-06-07 09:10:22] INFO: Get visual metrics from the video [2022-06-07 09:10:38] INFO: Get visual metrics from the video [2022-06-07 09:10:54] INFO: Get visual metrics from the video [2022-06-07 09:12:19] ERROR: Could not add meta data to the HAR, miss page 3 [2022-06-07 09:12:19] ERROR: Could not add meta data to the HAR, miss page 4 [2022-06-07 09:12:21] ERROR: Could not find the right index 3 for har for url https://*****************?browsertime_run=3 [2022-06-07 09:12:21] ERROR: Caught error from Browsertime Error: PageIndex out of range at module.exports.pickAPage (/usr/src/app/node_modules/coach-core/lib/har/harCutter.js:18:11) at Object.pickAPage (/usr/src/app/node_modules/coach-core/lib/index.js:84:12) at Object.processMessage (/usr/src/app/lib/plugins/browsertime/index.js:264:31)
Hey @ankur762 actually that's not a bug but a feature)
Looks like you are trying to measure 3 actions that do not change the page URL (some JS action or SPA navigation). Examine your e2e manually, I'm pretty sure you'll find out such cases. Sitespeed tracks and saves HARs if see that the page URL was changed.
Please take a look at a piece of code that I provided here https://github.com/sitespeedio/sitespeed.io/issues/3676#issuecomment-1151675162
In short, a possible workaround is to force the browser to update URL using selenium right after measure.start
Hi @Icecold777 @soulgalore , do we have any reference script where these type of use cases are being handled ?
Hi @soulgalore @Icecold777 thanks for your help, I am able to generate html report for entire transaction.
@Icecold777 @soulgalore are we going to implement this functionality by default, if yes can you please provide the ETA.
I think a first step is to add an SPA example in https://github.com/sitespeedio/sitespeed.io/tree/main/test/data/html (I think I mentioned that in another issue). If someone could contribute that, it would be great. When we have that, then we can sync with the work Chrome has done in https://chromestatus.com/feature/6232287446302720 (I haven't paid so close attention to it) and then see what's the best way forward.
We will not build in a page URL changer for SPAs, that seems like a way to fix a broken internet :) Lets implement soft navigations for Chrome as a first step, I'll start that next year.
Hi @soulgalore , I tried above thing but still getting the same error, const stopWatch = commands.stopWatch.get('EnterDetails'); // await commands.measure.start('Enter Details'); stopWatch.start(); await commands.mouse.clickAndHold.byXpath("//div[@Class='flex-auto-grow-shrink full-width full-width formFocusable serviceAdvisor undefined css-2b097c-container']/div[1]/div[1]/div[2]/div[1]/input"); await commands.mouse.singleClick.atCursor(); await commands.addText.byXpath('perf-sa-001', "//div[@Class='flex-auto-grow-shrink full-width full-width formFocusable serviceAdvisor undefined css-2b097c-container']/div[1]/div[1]/div[2]/div[1]/input");
await commands.wait.byTime(1000); await commands.click.bySelector('*[id^="react-select-"]'); **const time = stopWatch.stop(); commands.measure.add(stopWatch.getName(), time);**
Logs :- [2022-06-07 09:08:47] INFO: Take largest contentful paint screenshot [2022-06-07 09:08:47] INFO: No element attached to the entry in largest-contentful-paint [2022-06-07 09:08:52] INFO: Get visual metrics from the video [2022-06-07 09:09:34] INFO: Get visual metrics from the video [2022-06-07 09:10:22] INFO: Get visual metrics from the video [2022-06-07 09:10:38] INFO: Get visual metrics from the video [2022-06-07 09:10:54] INFO: Get visual metrics from the video [2022-06-07 09:12:19] ERROR: Could not add meta data to the HAR, miss page 3 [2022-06-07 09:12:19] ERROR: Could not add meta data to the HAR, miss page 4 [2022-06-07 09:12:21] ERROR: Could not find the right index 3 for har for url https://*****************?browsertime_run=3 [2022-06-07 09:12:21] ERROR: Caught error from Browsertime Error: PageIndex out of range at module.exports.pickAPage (/usr/src/app/node_modules/coach-core/lib/har/harCutter.js:18:11) at Object.pickAPage (/usr/src/app/node_modules/coach-core/lib/index.js:84:12) at Object.processMessage (/usr/src/app/lib/plugins/browsertime/index.js:264:31)
I am also getting this type of error, Can you please help me to sortout this issue?
If there is any reference document also it will be helpful.
@rajakaipa here's the documentation for scripting: https://www.sitespeed.io/documentation/sitespeed.io/scripting/
Please create a new issue and follow the instructions in https://www.sitespeed.io/documentation/sitespeed.io/bug-report/ then I can have a look!
Have you read the documentation?
URL
abc
What are you trying to accomplish
Create a sitespeed script to for UI performance, Script is passing end 2 end, but html metrices are not getting collected.
docker run --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io:latest CreateQuickRo2.js -n 2 --spa --multi
What browser did you use?
Chrome
How to reproduce
Relevant log output