sitespeedio / sitespeedio/sitespeed.io

ERROR: Caught error from Browsertime TypeError: Cannot read properties of null (reading 'split')

Open
#3,669 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

awaiting response bug
Dominant language
JavaScript
Stars
5k
Forks
624
Avg merge
4h 8m
Merged PRs (30d)
2

Description

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
module.exports = async function(context, commands) {
  // Navigate to a URL, but do not measure the URL
  await commands.navigate(
    'https://************/'
  );

  try {
    // Add text into an input field, finding the field by id
    await commands.addText.byId('*************', 'email');
    await commands.click.byIdAndWait('*******');
    await commands.addText.byId('**********', 'password');

    // Start the measurement and give it the alias login
    await commands.measure.start('login');

    // Find the submit button and click it and wait for the
    // page complete check to finish on the next loaded URL
    await commands.click.byIdAndWait('loginButton');   
    await commands.wait.byTime(1000);


    // await commands.click.byClassNameAndWait('sideNav_menuBtn__2ghRh full-height icon_size__l__3SlH4 icon-nine-dots-menu');
    await commands.click.byClassNameAndWait('sideNav_menuBtn__2ghRh full-height icon_size__l__3SlH4 icon-nine-dots-menu');
    await commands.measure.stop(); 
    await commands.wait.byTime(1000);

// -------ROPage---------------------
    await commands.measure.start('repair order');
    await commands.addText.byClassName('repair order', 'ant-input');
    await commands.click.byClassNameAndWait('global-menu-item searchViewItem_searchViewItem__1It93');
    await commands.measure.stop(); 
    await commands.wait.byTime(1000);    

    await commands.mouse.moveTo.byXpath("//div[text()='Action']");
    await commands.wait.byTime(1000);

    await commands.measure.start('Action');

    await commands.click.byXpathAndWait("//*[contains(text(),'Create Quick RO')]");
    
    await commands.measure.stop();

    await commands.measure.start('Enter Details');
    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-"]');
    await commands.click.byXpathAndWait("//div[@class='full-width formFocusable teamId undefined select_select__32Euz select_selectBoxBorder__28sk1 ant-select ant-select-enabled']");
         
    await commands.addText.byXpath('Team2', "(//input[@class='ant-select-search__field'])[2]");
    await commands.wait.byTime(1000);

    await commands.click.bySelector('*[class^="ant-select-dropdown-menu-item"]');
    await commands.click.byXpathAndWait("//input[@id='customerInfo']");
    await commands.addText.byXpath('Perf-user',"//input[@id='customerInfo']");
    await commands.wait.byTime(10000);
    await commands.wait.byXpath('(//*[contains(@id,"react-select")])[3]', 20000);
  
    await commands.click.byXpathAndWait('(//*[contains(@id,"react-select")])[5]');
    await commands.wait.byTime(2000);
    await commands.mouse.clickAndHold.byXpath('//*[@id="vin"]');
    await commands.wait.byTime(2000);
    await commands.wait.byXpath('(//*[contains(@id,"react-select")])', 10000);
    await commands.wait.byTime(2000);
    
    await commands.click.byXpathAndWait('(//*[contains(@id,"react-select")])[1]')
    await commands.click.byIdAndWait("tag");
    await commands.addText.byId('Perf',"tag");
    await commands.click  .byIdAndWait("milesIn");
    await commands.addText.byId('1000',"milesIn");
    await commands.measure.stop();

    await commands.measure.start('CreateRO');
    // await commands.click.byXpath("//button[contains(.,'Create')]");
    await commands.click.byXpathAndWait("//button[contains(.,'Create')]");
    await commands.wait.byTime(5000);
    return commands.measure.stop();


    
  } catch (e) {
    // We try/catch so we will catch if the the input fields can't be found
    // The error is automatically logged in Browsertime an rethrown here
    // We could have an alternative flow ...
    // else we can just let it cascade since it caught later on and reported in
    // the HTML
    await commands.measure.stop()
    throw e;
  }

};
Relevant log output
today I am getting 1 more error
 ERROR: Caught error from Browsertime TypeError: Cannot read properties of null (reading 'split')
    at module.exports (/usr/src/app/node_modules/browsertime/lib/support/pathToFolder.js:23:42)
    at Collector.perIteration (/usr/src/app/node_modules/browsertime/lib/core/engine/collector.js:475:14)
    at async Engine.runByScript (/usr/src/app/node_modules/browsertime/lib/core/engine/index.js:270:9)
    at async Object.analyzeUrl (/usr/src/app/lib/plugins/browsertime/analyzer.js:145:21)
    at async Object.processMessage (/usr/src/app/lib/plugins/browsertime/index.js:150:26)
[2022-06-01 14:20:34] ERROR: TypeError: Cannot read properties of null (reading 'split')
    at pathFromRootToPageDir (/usr/src/app/lib/core/resultsStorage/pathToFolder.js:20:40)
    at Object.relativeSummaryPageUrl (/usr/src/app/lib/core/resultsStorage/resultUrls.js:30:14)
    at DataCollector._addUrl (/usr/src/app/lib/plugins/html/dataCollector.js:22:31)
    at DataCollector.addErrorForUrl (/usr/src/app/lib/plugins/html/dataCollector.js:94:10)
    at Object.processMessage (/usr/src/app/lib/plugins/html/index.js:58:27)
    at /usr/src/app/lib/core/queueHandler.js:213:32
    at drainItem (/usr/src/app/node_modules/concurrent-queue/index.js:96:21)
    at Immediate.drain [as _onImmediate] (/usr/src/app/node_modules/concurrent-queue/index.js:77:84)
    at processImmediate (node:internal/timers:466:21)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with node_modules/browsertime/lib/support/pathToFolder.js:23 and compare it with lib/core/resultsStorage/pathToFolder.js:20, then trace the callers in resultUrls.js and the HTML data collector. Reproduce with the provided Docker command and script, and verify that HTML metrics are collected without the null split errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.