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

Long URLs being performance tested generate errors #4110

Open
2 tasks done
2343909 opened this issue Mar 13, 2024 · 9 comments
Open
2 tasks done

Long URLs being performance tested generate errors #4110

2343909 opened this issue Mar 13, 2024 · 9 comments

Comments

@2343909
Copy link

2343909 commented Mar 13, 2024

Have you read the documentation?

URL

See in the script

What are you trying to accomplish

Here is execution command:
node bin/sitespeed.js -b chrome -n 1 --video --visualMetrics --multi storefront\storefront_fe\src\workflows\demo.mjs

NOTE: If " --visualMetrics" is removed, then it works fine.

What browser did you use?

Chrome

How to reproduce

Run: 
node bin/sitespeed.js -b chrome -n 1  --video --visualMetrics --multi demo.mjs

demo.mjs script
/**
 *
 * @param {import('browsertime').BrowsertimeContext} context
 * @param {import('browsertime').BrowsertimeCommands} commands
 */
export default async function (context, commands) {
    const seleniumWebdriver = context.selenium.webdriver;
    const By = seleniumWebdriver.By;
    const seleniumDriver = context.selenium.driver;
    await seleniumDriver.manage().window().maximize();
    
    return commands.measure.start(
        'https://???/vigor-2-piece-non-stick-stainless-steel-aluminum-clad-with-excalibur-coating-fry-pan-set-with-8-and-9-1-2-pan/473SSFRYKT3.html');
};


OS: 
Windows
Error occurs trying to generate report
If " --visualMetrics" is removed then it works fine.

Log output

INFO: Testing url https://???/vigor-2-piece-non-stick-stainless-steel-aluminum-clad-with-excalibur-coating-fry-pan-set-with-8-and-9-1-2-pan/473SSFRYKT3.html iteration 1
[2024-03-06 18:36:06] INFO: Take after page complete check screenshot
[2024-03-06 18:36:07] INFO: Take cumulative layout shift screenshot
[2024-03-06 18:36:08] INFO: Take largest contentful paint screenshot
[2024-03-06 18:36:11] INFO: Use the visual metrics portable script
[2024-03-06 18:36:11] INFO: Get visual metrics from the video
[2024-03-06 18:36:11] ERROR: VisualMetrics failed to run Error: Command failed with exit code 1: python C:\Users\?\Source\sitespeed.io\node_modules\browsertime\visualmetrics\visualmetrics-portable.py --dir C:\Users\??\Source\sitespeed.io\sitespeed-result\demo_mjs\2024-03-06-18-35-50\pages\????\vigor-2-piece-non-stick-stainless-steel-aluminum-clad-with-excalibur-coating-fry-pan-set-with-8-and-9-1-2-pan\473SSFRYKT3.html\data\filmstrip\1 --video C:\Users\??\Source\sitespeed.io\sitespeed-result\demo_mjs\2024-03-06-18-35-50\pages\????\vigor-2-piece-non-stick-stainless-steel-aluminum-clad-with-excalibur-coating-fry-pan-set-with-8-and-9-1-2-pan\473SSFRYKT3.html\data\video\1.mp4 --orange --force --renderignore 5 --json --viewport --viewportretries 60 --viewportminheight 100 --viewportminwidth 100 -q 75 --logfile C:\Users\????\Source\sitespeed.io\sitespeed-result\demo_mjs\2024-03-06-18-35-50\pages\????\vigor-2-piece-non-stick-stainless-steel-aluminum-clad-with-excalibur-coating-fry-pan-set-with-8-and-9-1-2-pan\473SSFRYKT3.html\data\video\1.visualmetrics.log -vvv
C:\Users\???\Source\sitespeed.io\node_modules\browsertime\visualmetrics\visualmetrics-portable.py:502: SyntaxWarning: invalid escape sequence '\.'
  matcher = re.compile(".*com\.android\.version.*")
Traceback (most recent call last):
  File "C:\Users\???\Source\sitespeed.io\node_modules\browsertime\visualmetrics\visualmetrics-portable.py", line 1969, in <module>
    main()
  File "C:\Users\???\Source\sitespeed.io\node_modules\browsertime\visualmetrics\visualmetrics-portable.py", line 1877, in main
    logging.basicConfig(
  File "C:\Python312\Lib\logging\__init__.py", line 2125, in basicConfig
    h = FileHandler(filename, mode,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\logging\__init__.py", line 1231, in __init__
    StreamHandler.__init__(self, self._open())
                                 ^^^^^^^^^^^^
  File "C:\Python312\Lib\logging\__init__.py", line 1263, in _open
    return open_func(self.baseFilename, self.mode,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\???\\Source\\sitespeed.io\\sitespeed-result\\demo_mjs\\2024-03-06-18-35-50\\pages\\????\\vigor-2-piece-non-stick-stainless-steel-aluminum-clad-with-excalibur-coating-fry-pan-set-with-8-and-9-1-2-pan\\473SSFRYKT3.html\\data\\video\\1.visualmetrics.log'
C:\Users\????\Source\sitespeed.io\node_modules\browsertime\visualmetrics\visualmetrics-portable.py:502: SyntaxWarning: invalid escape sequence '\.'
  matcher = re.compile(".*com\.android\.version.*")
Traceback (most recent call last):
  File "C:\Users\???\Source\sitespeed.io\node_modules\browsertime\visualmetrics\visualmetrics-portable.py", line 1969, in <module>
    main()
  File "C:\Users\???\Source\sitespeed.io\node_modules\browsertime\visualmetrics\visualmetrics-portable.py", line 1877, in main
    logging.basicConfig(
  File "C:\Python312\Lib\logging\__init__.py", line 2125, in basicConfig
    h = FileHandler(filename, mode,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\logging\__init__.py", line 1231, in __init__
    StreamHandler.__init__(self, self._open())
                                 ^^^^^^^^^^^^
  File "C:\Python312\Lib\logging\__init__.py", line 1263, in _open
    return open_func(self.baseFilename, self.mode,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\???\\Source\\sitespeed.io\\sitespeed-result\\demo_mjs\\2024-03-06-18-35-50\\pages\\????\\vigor-2-piece-non-stick-stainless-steel-aluminum-clad-with-excalibur-coating-fry-pan-set-with-8-and-9-1-2-pan\\473SSFRYKT3.html\\data\\video\\1.visualmetrics.log'
    at makeError (file:///C:/Users/???/Source/sitespeed.io/node_modules/execa/lib/error.js:60:11)
    at handlePromise (file:///C:/Users/????/Source/sitespeed.io/node_modules/execa/index.js:124:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async run (file:///C:/Users/???/Source/sitespeed.io/node_modules/browsertime/lib/video/postprocessing/visualmetrics/visualMetrics.js:129:20)
    at async getVideoMetrics (file:///C:/Users/????/Source/sitespeed.io/node_modules/browsertime/lib/video/postprocessing/visualmetrics/getVideoMetrics.js:33:21)
    at async Video.postProcessing (file:///C:/Users/???/Source/sitespeed.io/node_modules/browsertime/lib/video/video.js:90:22)
    at async Iteration.run (file:///C:/Users/????/Source/sitespeed.io/node_modules/browsertime/lib/core/engine/iteration.js:222:34)
    at async Engine.runByScript (file:///C:/Users/????/Source/sitespeed.io/node_modules/browsertime/lib/core/engine/index.js:308:20)
    at async analyzeUrl (file:///C:/Users/???/Source/sitespeed.io/lib/plugins/browsertime/analyzer.js:190:19)
    at async BrowsertimePlugin.processMessage (file:///C:/Users/???/Source/sitespeed.io/lib/plugins/browsertime/index.js:173:26)
[2024-03-06 18:36:11] ERROR: Could not run Visual Metrics Error: ENOENT: no such file or directory, open 'C:\Users\????\Source\sitespeed.io\sitespeed-result\demo_mjs\2024-03-06-18-35-50\pages\???\vigor-2-piece-non-stick-stainless-steel-aluminum-clad-with-excalibur-coating-fry-pan-set-with-8-and-9-1-2-pan\473SSFRYKT3.html\data\video\1.visualmetrics.log''
[2024-03-06 18:36:11] ERROR: Visual Metrics failed to analyse the video Error: ENOENT: no such file or directory, open 'C:\Users\????\Source\sitespeed.io\sitespeed-result\demo_mjs\2024-03-06-18-35-50\pages\????\vigor-2-piece-non-stick-stainless-steel-aluminum-clad-with-excalibur-coating-fry-pan-set-with-8-and-9-1-2-pan\473SSFRYKT3.html\data\video\1.visualmetrics.log''
[2024-03-06 18:36:11] ERROR: TypeError: Cannot read properties of undefined (reading 'push')
    at Iteration.run (file:///C:/Users/????/Source/sitespeed.io/node_modules/browsertime/lib/core/engine/iteration.js:246:36)
    at async Engine.runByScript (file:///C:/Users/????/Source/sitespeed.io/node_modules/browsertime/lib/core/engine/index.js:308:20)
    at async analyzeUrl (file:///C:/Users/????/Source/sitespeed.io/lib/plugins/browsertime/analyzer.js:190:19)
    at async BrowsertimePlugin.processMessage (file:///C:/Users/????/Source/sitespeed.io/lib/plugins/browsertime/index.js:173:26)
[2024-03-06 18:36:11] INFO: https://????/vigor-2-piece-non-stick-stainless-steel-aluminum-clad-with-excalibur-coating-fry-pan-set-with-8-and-9-1-2-pan/473SSFRYKT3.html 298 requests, TTFB: 587ms, firstPaint: 1.60s, FCP: 1.60s, DOMContentLoaded: 1.67s, LCP: 1.60s, CLS: 0.001, TBT: 175ms, CPUBenchmark: 33ms, Load: 5.29s
[2024-03-06 18:36:11] INFO: Could not read filmstrip dir TypeError: Cannot read properties of undefined (reading 'time')    at getFilmstrip (file:///C:/Users/????/Source/sitespeed.io/lib/plugins/browsertime/filmstrip.js:200:43)
    at async HTMLBuilder.render (file:///C:/Users/????/Source/sitespeed.io/lib/plugins/html/htmlBuilder.js:285:13)
[2024-03-06 18:36:13] INFO: Could not read filmstrip dir TypeError: Cannot read properties of undefined (reading 'time')    at getFilmstrip (file:///C:/Users/????/Source/sitespeed.io/lib/plugins/browsertime/filmstrip.js:200:43)
    at async HTMLBuilder.render (file:///C:/Users/????/Source/sitespeed.io/lib/plugins/html/htmlBuilder.js:352:13)
[2024-03-06 18:36:15] INFO: HTML stored in C:\Users\????\Source\sitespeed.io\sitespeed-result\demo_mjs\2024-03-06-18-35-50
@2343909 2343909 added the bug label Mar 13, 2024
@soulgalore
Copy link
Member

Hi @2343909 thank you for creating the bug report (and including logs etc). There's been a problem on Windows with long URLs if you haven't enabled long file names but this looks like something else. Can you check which Python version you are using, it seems that 3.12 (HandBrake/HandBrake#5454) maybe introduced this?

@2343909
Copy link
Author

2343909 commented Mar 14, 2024

Hi @soulgalore Thanks a lot for quick response and yes, I am using Python 3.12.2

@soulgalore
Copy link
Member

Hi @2343909 can you try run just a simple test without a scripting and see if you get the same? I tested on Windows with 3.12 and do not get that error. You can checkout the test with Edge and video:

https://github.com/sitespeedio/browsertime/actions/runs/8281202122/job/22659184892

@2343909
Copy link
Author

2343909 commented Mar 14, 2024

Hey @soulgalore, I just tried without scripting with Edge and Chrome, the same error occurs . Looks like you are running it with " node bin/browsertime.js" and I am running it with "node bin/sitespeed.js"

@soulgalore
Copy link
Member

Yes but sitespeed.io uses browsertime internally. Just wanted to verify, shorter URL works fine for you (just so all dependencies for video recording/analysing is working)? Can you try to remove await seleniumDriver.manage().window().maximize(); from your test and see if that makes any difference? I'm not sure our code handles if you set that directly through selenium.

@2343909
Copy link
Author

2343909 commented Mar 25, 2024

@soulgalore I tried it multiple different ways as you have suggested in the previous comment and the outcome is the same specifically for the long URLs.
I have executed many different scripts with not as long URLs and it works fine.
I removed await seleniumDriver.manage().window().maximize(); and still not changes.

@soulgalore
Copy link
Member

@2343909 ok. Do you have long paths enabled on your machine as in this PR https://github.com/sitespeedio/browsertime/pull/2040/files ? I want to avoid adding that to the code because it seems strange to edit people properties, but you can manually set it if you don't have already?

@2343909
Copy link
Author

2343909 commented Mar 26, 2024

@soulgalore Ok, looks like that is what the issue was... I enabled long paths:

PS C:\WINDOWS\system32> New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force


LongPathsEnabled : 1
PSPath           : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
PSParentPath     : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
PSChildName      : FileSystem
PSDrive          : HKLM
PSProvider       : Microsoft.PowerShell.Core\Registry

@2343909
Copy link
Author

2343909 commented Mar 26, 2024

@soulgalore However :), there is slight small additional issue when selecting the long URL in the HTML report under the "Page" tab where after clicking on the long URL I get no file found error but if I change the name to something shorter then it works fine:
image

Uploading 2024-03-26_14h58_02.mp4…

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

No branches or pull requests

2 participants