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

Getting [2023-05-22 04:56:14] ERROR: TypeError: Cannot convert undefined or null to object #3857

Open
2 tasks done
vikasmishra1973 opened this issue May 22, 2023 · 9 comments
Labels

Comments

@vikasmishra1973
Copy link

Have you read the documentation?

URL

https://creativecloud.adobe.com/cc

What are you trying to accomplish

Logging on the url using pre script an d checking an element as to how much time it takes to load

What browser did you use?

Chrome

How to reproduce

module.exports = async function login(context, commands) {
  try {
    context.log.info('******************');
    context.log.info('Start of PreScript');
    commands.meta.setTitle('CCHome SPA Performance ');

    commands.meta.setDescription(
      'Measure the Load time of the <b>CCHome SPA views (Home, Learn, Apps, Learn etc)</b> post login to SUSI'
    );
    // Clear cache for previous runs
    await commands.cache.clear();
    // Default run on Stage
    const url_test = context.options.ccweb.url || 'https://creativecloud.adobe.com/apps?context=lllll';
    context.log.info('Using url: ', url_test);
    await commands.navigate(url_test);

    // context.log.info('Initiating Run No : ' , context.index);
    // we fetch the selenium webdriver from context
    const webdriver = context.selenium.webdriver;
    const driver = context.selenium.driver;
    // and get hold of some goodies we want to use
    const until = webdriver.until;
    const By = webdriver.By;
    const Key = webdriver.Key;
    let userName = '';
    let password = '';
    // Set username pw based on input URL
    if (url_test.startsWith('https://creativecloud.adobe.com') || url_test.startsWith('https://xxxx') || url_test.startsWith('https://yyyy')) {
      // before you start, make your username and password
      userName = context.options.ccweb.user || 'zzzzz';
      // TODO - Handle password securely
      password = context.options.ccweb.pass || 'wwwwww';
    } else {
      userName = context.options.ccweb.user || 'vvvvvv';
      // TODO - Handle password securely
      password = context.options.ccweb.pass || 'rrrrr';
    }
    await driver.sleep(10000);
    context.log.info('waiting for 10 seconds');
    await until.titleIs('Adobe ID');

    const emailField = await driver.findElement(By.id('EmailPage-EmailField'));
    await emailField.sendKeys(userName);

    // Test value is entered correctly
    const value = await emailField.getAttribute('value');
    await driver.actions().sendKeys(Key.TAB).perform();
    context.log.info('sleep for sometime before clicking Continue Button');
    await driver.sleep(10000);
    const continueEL = await driver.findElement(By.css("[data-id='EmailPage-ContinueButton']")).click();

    await driver.sleep(5000);
    // Validates whether the SUSI move to password page or not
    const url = await driver.getCurrentUrl();
    // context.log.info('url is :=> ', url);

    await driver.findElement(By.css("[data-id='PasswordPage-PasswordField']")).sendKeys(password);
    await driver.findElement(By.css("[data-id='PasswordPage-ContinueButton']")).click();

    context.log.info('Waiting for CCHome WebApp');
    await driver.wait(until.titleContains('Creative Cloud'), 30000);
    context.log.info('End of PreScript');
    context.log.info('****************');
  } catch (e) {
    console.error('Error Thrown: ');
    throw e;
  }
};

Relevant log output

21:55:07 Google Chrome 103.0.5060.53 
21:55:07 Mozilla Firefox 101.0
21:55:08 Microsoft Edge 102.0.1245.44 
21:55:10 [2023-05-22 04:55:10] INFO: Versions OS: linux 5.4.0-74-generic nodejs: v16.15.0 sitespeed.io: 25.2.1 browsertime: 16.9.1 coach: 7.1.2
21:55:10 [2023-05-22 04:55:10] INFO: Running tests using Chrome - 1 iteration(s)
21:55:11 [2023-05-22 04:55:11] INFO: ******************
21:55:11 [2023-05-22 04:55:11] INFO: Start of PreScript
21:55:11 [2023-05-22 04:55:11] INFO: Using url:  https://creativecloud.adobe.com/cc?context=no_cc_redirect
21:55:11 [2023-05-22 04:55:11] INFO: Navigating to url https://creativecloud.adobe.com/cc?context=no_cc_redirect iteration 1
21:55:30 [2023-05-22 04:55:30] INFO: waiting for 10 seconds
21:55:30 [2023-05-22 04:55:30] INFO: susi email value entered is "tl+HomeMonitors@adobetest.com"
21:55:30 [2023-05-22 04:55:30] INFO: env user value entered is undefined
21:55:30 [2023-05-22 04:55:30] INFO: sleep for sometime before clicking Continue Button
21:55:45 [2023-05-22 04:55:45] INFO: Waiting for CCHome WebApp
21:55:47 [2023-05-22 04:55:47] INFO: End of PreScript
21:55:47 [2023-05-22 04:55:47] INFO: ****************
21:55:47 [2023-05-22 04:55:47] INFO: Testing url https://creativecloud.adobe.com/cc iteration 1
21:56:04 [2023-05-22 04:56:04] INFO: Take after page complete check screenshot
21:56:05 [2023-05-22 04:56:05] INFO: Take cumulative layout shift screenshot
21:56:05 [2023-05-22 04:56:05] INFO: Take largest contentful paint screenshot
21:56:09 [2023-05-22 04:56:09] INFO: Get visual metrics from the video
21:56:13 [2023-05-22 04:56:13] ERROR: Could not add fullyLoaded metric to URL undefined, we have statistic for the URLs ["https://creativecloud.adobe.com/cc"] 
21:56:13 [2023-05-22 04:56:13] ERROR: Could not add fullyLoaded metric to URL undefined, we have statistic for the URLs ["https://creativecloud.adobe.com/cc"] 
21:56:13 [2023-05-22 04:56:13] INFO: https://creativecloud.adobe.com/cc 10 requests, TTFB: 305ms, firstPaint: 918ms, firstVisualChange: 1.00s, FCP: 918ms, DOMContentLoaded: 754ms, LCP: 3.47s, CLS: 0.0378, TBT: 661ms, Load: 964ms, speedIndex: 1.54s, visualComplete85: 3.57s, lastVisualChange: 4.53s
21:56:14 [2023-05-22 04:56:14] ERROR: TypeError: Cannot convert undefined or null to object
21:56:14     at Function.keys (<anonymous>)
21:56:14     at Object.addMetrics (/usr/src/app/node_modules/pagexray/lib/sitespeed.js:13:33)
21:56:14     at Object.convert (/usr/src/app/node_modules/pagexray/lib/index.js:272:17)
21:56:14     at Object.processMessage (/usr/src/app/lib/plugins/pagexray/index.js:80:40)
21:56:14     at /usr/src/app/lib/core/queueHandler.js:213:32
21:56:14     at drainItem (/usr/src/app/node_modules/concurrent-queue/index.js:96:21)
21:56:14     at Immediate.drain [as _onImmediate] (/usr/src/app/node_modules/concurrent-queue/index.js:77:84)
21:56:14     at processImmediate (node:internal/timers:466:21)
21:56:14 [2023-05-22 04:56:14] INFO: Running tests using Chrome - 1 iteration(s)
@vikasmishra1973
Copy link
Author

adding pre script step

09:55:34 [2023-05-22 16:55:34] INFO: Start of PreScript
09:55:34 [2023-05-22 16:55:34] INFO: Using url: https://creativecloud.adobe.com/cc?context=xxx
09:55:34 [2023-05-22 16:55:34] INFO: Navigating to url https://creativecloud.adobe.com/cc?context=xxx
iteration 1
09:55:57 [2023-05-22 16:55:57] INFO: waiting for 10 seconds
09:55:57 [2023-05-22 16:55:57] INFO: susi email value entered is "xxxxx"

09:55:57 [2023-05-22 16:55:57] INFO: sleep for sometime before clicking Continue Button
09:56:13 [2023-05-22 16:56:13] INFO: Waiting for CCHome WebApp
09:56:14 [2023-05-22 16:56:14] INFO: End of PreScript
09:56:14 [2023-05-22 16:56:14] INFO: ****************
09:56:14 [2023-05-22 16:56:14] INFO: Testing url https://creativecloud.adobe.com/cc iteration 1
09:56:31 [2023-05-22 16:56:31] INFO: Take after page complete check screenshot
09:56:32 [2023-05-22 16:56:32] INFO: Take cumulative layout shift screenshot
09:56:32 [2023-05-22 16:56:32] INFO: Take largest contentful paint screenshot
09:56:35 [2023-05-22 16:56:35] INFO: Get visual metrics from the video
09:56:40 [2023-05-22 16:56:40] ERROR: Could not add fullyLoaded metric to URL undefined, we have statistic for the URLs ["https://creativecloud.adobe.com/cc"]
09:56:40 [2023-05-22 16:56:40] ERROR: Could not add fullyLoaded metric to URL undefined, we have statistic for the URLs ["https://creativecloud.adobe.com/cc"]
09:56:40 [2023-05-22 16:56:40] ERROR: Caught error from Browsertime TypeError: Cannot read properties of undefined (reading 'response')
09:56:40 at getDocumentRequests (/usr/src/app/node_modules/browsertime/lib/support/har/index.js:33:18)
09:56:40 at getFinalURL (/usr/src/app/node_modules/browsertime/lib/support/har/index.js:39:20)
09:56:40 at Object.getMainDocumentTimings (/usr/src/app/node_modules/browsertime/lib/support/har/index.js:200:24)
09:56:40 at Engine.runByScript (/usr/src/app/node_modules/browsertime/lib/core/engine/index.js:301:31)
09:56:40 at async Object.analyzeUrl (/usr/src/app/lib/plugins/browsertime/analyzer.js:152:21)
09:56:40 at async Object.processMessage (/usr/src/app/lib/plugins/browsertime/index.js:150:26)
09:56:40 [2023-05-22 16:56:40] INFO: Running tests using Chrome - 1 iteration(s)
09:56:40 [2023-05-22 16:56:40] INFO: ******************
09:56:40 [2023-05-22 16:56:40] INFO: Start of PreScript
09:56:41 [2023-05-22 16:56:41] INFO: Using url: https://creativecloud.adobe.com/cc?context=nnnn
09:56:41 [2023-05-22 16:56:41] INFO: Navigating to url https://creativecloud.adobe.com/cc?context=nnnn
iteration 1
09:57:01 [2023-05-22 16:57:01] INFO: waiting for 10 seconds
09:57:01 [2023-05-22 16:57:01] INFO: susi email value entered is "bbbb"
09:57:01 [2023-05-22 16:57:01] INFO: env user value entered is undefined
09:57:01 [2023-05-22 16:57:01] INFO: sleep for sometime before clicking Continue Button
09:57:17 [2023-05-22 16:57:17] INFO: Waiting for CCHome WebApp
09:57:18 [2023-05-22 16:57:18] INFO: End of PreScript
09:57:18 [2023-05-22 16:57:18] INFO: ****************
09:57:18 [2023-05-22 16:57:18] INFO: Testing url https://creativecloud.adobe.com/cc/?addfeatures=adobe_home_m0 iteration 1
09:57:36 [2023-05-22 16:57:36] INFO: Take after page complete check screenshot
09:57:36 [2023-05-22 16:57:36] INFO: Take cumulative layout shift screenshot
09:57:37 [2023-05-22 16:57:37] INFO: Take largest contentful paint screenshot
09:57:40 [2023-05-22 16:57:40] INFO: Get visual metrics from the video
09:57:44 [2023-05-22 16:57:44] ERROR: Could not add fullyLoaded metric to URL undefined, we have statistic for the URLs ["https://creativecloud.adobe.com/cc/?addfeatures=adobe_home_m0"]
09:57:44 [2023-05-22 16:57:44] INFO: https://creativecloud.adobe.com/cc/?addfeatures=adobe_home_m0 21 requests, TTFB: 200ms, firstPaint: 734ms, firstVisualChange: 167ms, FCP: 734ms, DOMContentLoaded: 596ms, LCP: 1.79s, CLS: 0.0546, TBT: 1.05s, Load: 788ms, speedIndex: 1.65s, visualComplete85: 3.43s, lastVisualChange: 4.87s
09:57:45 [2023-05-22 16:57:45] ERROR: TypeError: Cannot convert undefined or null to object
09:57:45 at Function.keys ()
09:57:45 at Object.addMetrics (/usr/src/app/node_modules/pagexray/lib/sitespeed.js:13:33)
09:57:45 at Object.convert (/usr/src/app/node_modules/pagexray/lib/index.js:272:17)
09:57:45 at Object.processMessage (/usr/src/app/lib/plugins/pagexray/index.js:80:40)
09:57:45 at /usr/src/app/lib/core/queueHandler.js:213:32
09:57:45 at drainItem (/usr/src/app/node_modules/concurrent-queue/index.js:96:21)
09:57:45 at Immediate.drain [as _onImmediate] (/usr/src/app/node_modules/concurrent-queue/index.js:77:84)
09:57:45 at processImmediate (node:internal/timers:466:21)

@soulgalore
Copy link
Member

Hi @vikasmishra1973 thanks for creating the issue! Can you try with the latest released version of sitespeed.io 27.6.4 (the version you are using are almost one year old), then it's easier for me to reproduce, try to fix it. Thanks!

@vikasmishra1973
Copy link
Author

Thanks for responding. I pulled latest siteseped image. Errors a bit different:

13:45:45 Pulling sitespeed.io (sitespeedio/sitespeed.io:27.6.4)...
13:45:47 27.6.4: Pulling from sitespeedio/sitespeed.io
13:46:47 Digest: sha256:7e69c15863dd825699f3a6a020427ecdbcfb48d5c77e15ccae5d12413c1ca513
13:46:47 Status: Downloaded newer image for sitespeedio/sitespeed.io:27.6.4
13:47:25 Google Chrome 113.0.5672.92
13:47:26 Mozilla Firefox 113.0
13:47:28 Microsoft Edge 113.0.1774.42
13:47:39 [2023-05-22 20:47:39] INFO: Versions OS: linux 5.4.0-74-generic nodejs: v18.16.0 sitespeed.io: 27.6.4 browsertime: 17.10.1 coach: 7.1.3
13:47:39 (node:41) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023.
13:47:39
13:47:39 Please migrate your code to use AWS SDK for JavaScript (v3).
13:47:39 For more information, check the migration guide at https://a.co/7PzMCcy
13:47:39 (Use node --trace-warnings ... to show where the warning was created)
13:47:39 [2023-05-22 20:47:39] INFO: Running tests using Chrome - 1 iteration(s)
13:47:45 [2023-05-22 20:47:45] INFO: ******************
13:47:45 [2023-05-22 20:47:45] INFO: Start of PreScript
13:47:45 [2023-05-22 20:47:45] INFO: Using url: https://creativecloud.adobe.com/cc?context=no_cc_redirect
13:47:45 [2023-05-22 20:47:45] INFO: Navigating to url https://creativecloud.adobe.com/cc?context=no_cc_redirect iteration 1
13:48:05 [2023-05-22 20:48:05] INFO: waiting for 10 seconds
13:48:05 [2023-05-22 20:48:05] INFO: susi email value entered is "vvvvv"
13:48:05 [2023-05-22 20:48:05] INFO: sleep for sometime before clicking Continue Button
13:48:20 [2023-05-22 20:48:20] INFO: Waiting for CCHome WebApp
13:48:22 [2023-05-22 20:48:22] INFO: End of PreScript
13:48:22 [2023-05-22 20:48:22] INFO: ****************
13:48:22 [2023-05-22 20:48:22] INFO: Testing url https://creativecloud.adobe.com/cc iteration 1
13:48:50 [2023-05-22 20:48:50] INFO: Take after page complete check screenshot
13:48:51 [2023-05-22 20:48:51] INFO: Take cumulative layout shift screenshot
13:48:52 [2023-05-22 20:48:52] INFO: Take largest contentful paint screenshot
13:48:55 [2023-05-22 20:48:55] INFO: Use the visual metrics portable script
13:48:55 [2023-05-22 20:48:55] INFO: Get visual metrics from the video
13:49:49 [2023-05-22 20:49:49] ERROR: Could not add fullyLoaded metric to URL undefined, we have statistic for the URLs ["https://creativecloud.adobe.com/cc"]
13:49:49 [2023-05-22 20:49:49] INFO: https://creativecloud.adobe.com/cc 7 requests, TTFB: 374ms, firstPaint: 905ms, firstVisualChange: 234ms, FCP: 905ms, DOMContentLoaded: 728ms, LCP: 1.88s, CLS: 0.0448, TBT: 1.76s, CPUBenchmark: 77ms, Load: 5.29s, speedIndex: 1.97s, visualComplete85: 5.13s, lastVisualChange: 5.87s
13:49:50 [2023-05-22 20:49:50] ERROR: TypeError: Cannot convert undefined or null to object
13:49:50 at Function.keys ()
13:49:50 at Object.addMetrics (/usr/src/app/node_modules/pagexray/lib/sitespeed.js:13:33)
13:49:50 at Object.convert (/usr/src/app/node_modules/pagexray/lib/index.js:272:17)
13:49:50 at PageXrayPlugin.processMessage (file:///usr/src/app/lib/plugins/pagexray/index.js:92:40)
13:49:50 at file:///usr/src/app/lib/core/queueHandler.js:223:32
13:49:50 at drainItem (/usr/src/app/node_modules/concurrent-queue/index.js:96:21)
13:49:50 at Immediate.drain [as _onImmediate] (/usr/src/app/node_modules/concurrent-queue/index.js:77:84)
13:49:50 at process.processImmediate (node:internal/timers:476:21)
13:49:50 [2023-05-22 20:49:50] INFO: Running tests using Chrome - 1 iteration(s)
13:49:51 [2023-05-22 20:49:51] INFO: ******************
13:49:51 [2023-05-22 20:49:51] INFO: Start of PreScript
13:49:58 [2023-05-22 20:49:58] INFO: Using url: https://creativecloud.adobe.com/cc?context=no_cc_redirect
13:49:58 [2023-05-22 20:49:58] INFO: Navigating to url https://creativecloud.adobe.com/cc?context=no_cc_redirect iteration 1
13:50:20 [2023-05-22 20:50:20] INFO: waiting for 10 seconds
13:50:20 [2023-05-22 20:50:20] INFO: susi email value entered is "xxxxx"
13:50:20 [2023-05-22 20:50:20] INFO: env user value entered is undefined
13:50:20 [2023-05-22 20:50:20] INFO: sleep for sometime before clicking Continue Button
13:50:35 [2023-05-22 20:50:35] INFO: Waiting for CCHome WebApp
13:50:37 [2023-05-22 20:50:37] INFO: End of PreScript
13:50:37 [2023-05-22 20:50:37] INFO: ****************
13:50:37 [2023-05-22 20:50:37] INFO: Testing url https://creativecloud.adobe.com/cc/?addfeatures=adobe_home_m0 iteration 1
13:51:03 [2023-05-22 20:51:03] INFO: Take after page complete check screenshot
13:51:03 [2023-05-22 20:51:03] INFO: Take cumulative layout shift screenshot
13:51:04 [2023-05-22 20:51:04] INFO: Take largest contentful paint screenshot
13:51:07 [2023-05-22 20:51:07] INFO: Use the visual metrics portable script
13:51:07 [2023-05-22 20:51:07] INFO: Get visual metrics from the video
13:51:14 [2023-05-22 20:51:14] INFO: https://creativecloud.adobe.com/cc/?addfeatures=adobe_home_m0 574 requests, TTFB: 321ms, firstPaint: 1.30s, firstVisualChange: 967ms, FCP: 1.30s, DOMContentLoaded: 1.16s, LCP: 2.65s, CLS: 0.0216, TBT: 1.45s, CPUBenchmark: 69ms, Load: 6.56s, speedIndex: 2.92s, visualComplete85: 6.27s, lastVisualChange: 7.40s
13:51:16 [2023-05-22 20:51:15] INFO: The server responded with a 404 status code for https://creativecloud.adobe.com/undefined
13:51:18 [2023-05-22 20:51:18] INFO: HTML stored in /sitespeed.io/sitespeed-result/creativecloud.adobe.com/2023-05-22-20-47-39
13:51:18 [2023-05-22 20:51:18] INFO: Uploading /sitespeed.io/sitespeed-result/creativecloud.adobe.com/2023-05-22-20-47-39 to S3 bucket cchome-sitespeed-prod, this can take a while ...
13:51:22 [2023-05-22 20:51:22] INFO: Finished upload to s3
13:51:22 [2023-05-22 20:51:22] INFO: Find the result at https://ffffff/2023-05-22-20-47-39/index.html
13:51:22 Error: Errors while running:
13:51:22 Rejected {
13:51:22 "uuid": "f3dd97f1-c218-4b81-97ce-18566a2b21f9",
13:51:22 "type": "browsertime.har",
13:51:22 "timestamp": "2023-05-22T20:49:50+00:00",
13:51:22 "source": "browsertime",
13:51:22 "data": "{...}",
13:51:22 "url": "https://creativecloud.adobe.com/cc",
13:51:22 "group": "creativecloud.adobe.com"
13:51:22 } for plugin: pagexray, url: https://creativecloud.adobe.com/cc
13:51:22 {}
13:51:22 at start (file:///usr/src/app/bin/sitespeed.js:146:15)
13:51:22 at processTicksAndRejections (node:internal/process/task_queues:95:5)
13:51:22 at runNextTicks (node:internal/process/task_queues:64:3)
13:51:22 at process.processImmediate (node:internal/timers:447:9)
13:51:22 at async file:///usr/src/app/bin/sitespeed.js:178:1
13:51:24 Build step 'Execute shell' marked build as failure

@vikasmishra1973
Copy link
Author

@soulgalore , Hi Peter, any pointer for me?

@soulgalore
Copy link
Member

Hi @vikasmishra1973 thanks for updating the issue. Hmm, I can see in the log that there's some kind of mismatch going on between the URLs (like somehow the data is attached to the wrong URL or something). Do you know where https://creativecloud.adobe.com/undefined comes? Undefined seems like something is wrong.

Looking at the output, it looks like the first navigation to the page do not happen, if you look in the browser, are the browser already on that page?

13:48:22 [2023-05-22 20:48:22] INFO: Testing url https://creativecloud.adobe.com/cc iteration 1
13:48:50 [2023-05-22 20:48:50] INFO: Take after page complete check screenshot
13:48:51 [2023-05-22 20:48:51] INFO: Take cumulative layout shift screenshot
13:48:52 [2023-05-22 20:48:52] INFO: Take largest contentful paint screenshot
13:48:55 [2023-05-22 20:48:55] INFO: Use the visual metrics portable script
13:48:55 [2023-05-22 20:48:55] INFO: Get visual metrics from the video
13:49:49 [2023-05-22 20:49:49] ERROR: Could not add fullyLoaded metric to URL undefined

Best
Peter

@vikasmishra1973
Copy link
Author

Hi, I ran it locally on my mac with just one url:

docker run --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io:27.6.4 --graphite.host=host.docker.internal https://creativecloud.adobe.com/cc --browsertime.preScript ./ccweb-susi.js --slug yourTestName --graphite.addSlugToKey true
Google Chrome 113.0.5672.92
Mozilla Firefox 113.0
Microsoft Edge 113.0.1774.42
[2023-05-25 16:58:20] INFO: Versions OS: linux 5.15.49-linuxkit nodejs: v18.16.0 sitespeed.io: 27.6.4 browsertime: 17.10.1 coach: 7.1.3
[2023-05-25 16:58:21] INFO: Running tests using Chrome - 3 iteration(s)
[2023-05-25 16:58:21] INFO: ******************
[2023-05-25 16:58:21] INFO: Start of PreScript
[2023-05-25 16:58:21] INFO: Using url: https://creativecloud.adobe.com/cc
[2023-05-25 16:58:21] INFO: Navigating to url https://creativecloud.adobe.com/cc iteration 1
[2023-05-25 16:58:41] INFO: waiting for 10 seconds
[2023-05-25 16:58:41] INFO: susi email value entered is "tl+HomeMonitors@adobetest.com"
[2023-05-25 16:58:41] INFO: sleep for sometime before clicking Continue Button
[2023-05-25 16:58:57] INFO: Waiting for CCHome WebApp
[2023-05-25 16:58:59] INFO: End of PreScript
[2023-05-25 16:58:59] INFO: ****************
[2023-05-25 16:58:59] INFO: Testing url https://creativecloud.adobe.com/cc iteration 1
[2023-05-25 16:59:13] INFO: Take after page complete check screenshot
[2023-05-25 16:59:14] INFO: Take cumulative layout shift screenshot
[2023-05-25 16:59:14] INFO: Take largest contentful paint screenshot
[2023-05-25 16:59:17] INFO: Use the visual metrics portable script
[2023-05-25 16:59:17] INFO: Get visual metrics from the video
[2023-05-25 16:59:22] INFO: https://creativecloud.adobe.com/cc TTFB: 29ms DOMContentLoaded: 486ms firstPaint: 560ms FCP: 560ms LCP: 2.98s Load: 3.50s TBT: 829ms CLS:0.0808
[2023-05-25 16:59:22] INFO: VisualMetrics: FirstVisualChange: 300ms SpeedIndex: 1.81s VisualComplete85: 3.10s LastVisualChange: 4.13s
[2023-05-25 16:59:23] INFO: ******************
[2023-05-25 16:59:23] INFO: Start of PreScript
[2023-05-25 16:59:23] INFO: Using url: https://creativecloud.adobe.com/cc
[2023-05-25 16:59:23] INFO: Navigating to url https://creativecloud.adobe.com/cc iteration 2
[2023-05-25 16:59:43] INFO: waiting for 10 seconds
[2023-05-25 16:59:43] INFO: susi email value entered is "tl+HomeMonitors@adobetest.com"
[2023-05-25 16:59:43] INFO: sleep for sometime before clicking Continue Button
[2023-05-25 16:59:58] INFO: Waiting for CCHome WebApp
[2023-05-25 17:00:00] INFO: End of PreScript
[2023-05-25 17:00:00] INFO: ****************
[2023-05-25 17:00:00] INFO: Testing url https://creativecloud.adobe.com/cc iteration 2
[2023-05-25 17:00:14] INFO: Take after page complete check screenshot
[2023-05-25 17:00:15] INFO: Take cumulative layout shift screenshot
[2023-05-25 17:00:15] INFO: Take largest contentful paint screenshot
[2023-05-25 17:00:18] INFO: Use the visual metrics portable script
[2023-05-25 17:00:18] INFO: Get visual metrics from the video
[2023-05-25 17:00:23] INFO: https://creativecloud.adobe.com/cc TTFB: 3ms DOMContentLoaded: 671ms firstPaint: 750ms FCP: 750ms LCP: 3.63s Load: 3.56s TBT: 842ms CLS:0.0768
[2023-05-25 17:00:23] INFO: VisualMetrics: FirstVisualChange: 100ms SpeedIndex: 2.27s VisualComplete85: 3.33s LastVisualChange: 4.37s
[2023-05-25 17:00:23] INFO: ******************
[2023-05-25 17:00:23] INFO: Start of PreScript
[2023-05-25 17:00:23] INFO: Using url: https://creativecloud.adobe.com/cc
[2023-05-25 17:00:23] INFO: Navigating to url https://creativecloud.adobe.com/cc iteration 3
[2023-05-25 17:00:43] INFO: waiting for 10 seconds
[2023-05-25 17:00:43] INFO: susi email value entered is "tl+HomeMonitors@adobetest.com"
[2023-05-25 17:00:43] INFO: sleep for sometime before clicking Continue Button
[2023-05-25 17:00:59] INFO: Waiting for CCHome WebApp
[2023-05-25 17:01:01] INFO: End of PreScript
[2023-05-25 17:01:01] INFO: ****************
[2023-05-25 17:01:01] INFO: Testing url https://creativecloud.adobe.com/cc iteration 3
[2023-05-25 17:01:14] INFO: Take after page complete check screenshot
[2023-05-25 17:01:15] INFO: Take cumulative layout shift screenshot
[2023-05-25 17:01:15] INFO: Take largest contentful paint screenshot
[2023-05-25 17:01:18] INFO: Use the visual metrics portable script
[2023-05-25 17:01:18] INFO: Get visual metrics from the video
[2023-05-25 17:01:24] INFO: https://creativecloud.adobe.com/cc TTFB: 5ms DOMContentLoaded: 256ms firstPaint: 330ms FCP: 330ms LCP: 2.37s Load: 3.40s TBT: 759ms CLS:0.0704
[2023-05-25 17:01:24] INFO: VisualMetrics: FirstVisualChange: 33ms SpeedIndex: 1.32s VisualComplete85: 1.20s LastVisualChange: 3.80s
[2023-05-25 17:01:24] ERROR: Could not add fullyLoaded metric to URL undefined, we have statistic for the URLs ["https://creativecloud.adobe.com/cc"]
[2023-05-25 17:01:24] ERROR: Could not add fullyLoaded metric to URL undefined, we have statistic for the URLs ["https://creativecloud.adobe.com/cc"]
[2023-05-25 17:01:24] ERROR: Could not add fullyLoaded metric to URL undefined, we have statistic for the URLs ["https://creativecloud.adobe.com/cc"]
[2023-05-25 17:01:24] INFO: https://creativecloud.adobe.com/cc 73 requests, TTFB: 5ms (σ12.00ms 95.8%), firstPaint: 560ms (σ172.00ms 31.4%), firstVisualChange: 100ms (σ113.00ms 78.6%), FCP: 560ms (σ172.00ms 31.4%), DOMContentLoaded: 486ms (σ170.00ms 36.0%), LCP: 2.98s (σ515.00ms 17.2%), CLS: 0.0768 (σ0.00 5.6%), TBT: 829ms (σ36.00ms 4.5%), CPUBenchmark: 49ms (σ1.00ms 2.8%), Load: 3.50s (σ65.00ms 1.9%), speedIndex: 1.81s (σ387.00ms 21.5%), visualComplete85: 3.10s (σ955.00ms 37.5%), lastVisualChange: 4.13s (σ233.00ms 5.7%) (3 runs)
[2023-05-25 17:01:25] ERROR: TypeError: Cannot convert undefined or null to object
at Function.keys ()
at Object.addMetrics (/usr/src/app/node_modules/pagexray/lib/sitespeed.js:13:33)
at Object.convert (/usr/src/app/node_modules/pagexray/lib/index.js:272:17)
at PageXrayPlugin.processMessage (file:///usr/src/app/lib/plugins/pagexray/index.js:92:40)
at file:///usr/src/app/lib/core/queueHandler.js:223: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 process.processImmediate (node:internal/timers:476:21)
[2023-05-25 17:01:28] INFO: HTML stored in /sitespeed.io/sitespeed-result/yourTestName/2023-05-25-16-58-20
Error: Errors while running:
Rejected {
"uuid": "9e119d0e-e633-45ab-93e8-78b503b51950",
"type": "browsertime.har",
"timestamp": "2023-05-25T17:01:25+00:00",
"source": "browsertime",
"data": "{...}",
"url": "https://creativecloud.adobe.com/cc",
"group": "creativecloud.adobe.com"
} for plugin: pagexray, url: https://creativecloud.adobe.com/cc
{}
at start (file:///usr/src/app/bin/sitespeed.js:146:15)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at runNextTicks (node:internal/process/task_queues:64:3)
at process.processImmediate (node:internal/timers:447:9)
at async file:///usr/src/app/bin/sitespeed.js:178:1

@PedroMSantosD
Copy link
Contributor

I'm having the same issue when using scripts to test a page.
The issue seems to be related to the documentation link; where it states that
Browsertime/sitespeed.io will pick up the next URL and measure that.

when my script is of the form:

test6.js: |
            module.exports = async function(context, commands) {
                const GAMEURL = 'https://someurl'
                const PLAYCSSSELECTOR = '.play-real-button'
                context.log.info('The URL will be');
                context.log.info(GAMEURL);
                commands.measure.start('MyAlias');
                await commands.navigate(GAMEURL);
                await commands.click.bySelectorAndWait(PLAYCSSSELECTOR);
                return commands.measure.stop()
            };

I get the errors above, namely:

  • ERROR: Could not add fullyLoaded metric to URL undefined, we have statistic for the URLs (the used url as a list here)
  • ERROR: TypeError: Cannot convert undefined or null to object at Function.keys () at Object.addMetrics .....
  • Error: Errors while running:Rejected { "uuid": "f36436bb-5111-47eb-a659-e8c6a06ede7f", "type": "browsertime.har", "timestamp": "2023-12-27T11:05:26+00:00", "source": "browsertime", "data": "{...}", "url": "MYURLHERE"..

On the other hand, if my test script is of the form (same as documentation):

      test6.js: |
            module.exports = async function(context, commands) {
                const GAMEURL = 'https://someurl'
                const PLAYCSSSELECTOR = '.play-real-button'
                context.log.info('The URL will be');
                context.log.info(GAMEURL);
                await commands.navigate(GAMEURL);
                commands.measure.start('MyAlias');
                await commands.click.bySelectorAndWait(PLAYCSSSELECTOR);
                return commands.measure.stop()
            };

errors are gone... but the stop contidion on my check fails (it is a slow javascript animation that loads in about 11 seconds, and the progress bar gets stuck on about 4 seconds, causing the check to end prematurely).

Not sure if (1) it shares the root cause for this case and
(2) if there is a way to define the 'url' parameter to be consumed by the browsertime engine when tests are based on script instead of option url?
kindly note that the preferred command
commands.measure.start('https://someurl');
does not suffice on my use case, as I need to click on a CSS element loaded on the measured page and continues the the full load time measurement until the load of the 'seleted/clicked' element completes.

the docker run, is pretty much the same, I just call a preScript (for login) and the test script using the multi option

# Scripts
            - "--preScript"
            - "/tmp/auth/logonscript.mjs"
            - "/tmp/scripts/test6.js"
            - "--multi"

Note: added here as I share the output errors, save for domain names, kindly let me konw if this comment needs to be deleted and added to a different bug ticket.
Best,

@soulgalore
Copy link
Member

Hi @PedroMSantosD I think your case is another issue. If I understand correctly, the tests stops too early in one of the cases? By default when you use a xxxWait command Browsertime waits on the onLoad event to happen. You can try run your test and add --browsertime.pageCompleteCheckNetworkIdle true instead. That will wait for 5 seconds of inactivity on the network log (meaning the unload event can fire but you still got Ajax requests going on). Can you try that and see if you get a different result?

@PedroMSantosD
Copy link
Contributor

Hi Peter, for the pageCompletCheck condition, I do get different conditions using either "--pageCompleteCheckInactivity" or "--pageCompleteCheckNetworkIdle" or (default) end condition. the pageCompleteCheckInactivity gets a proper screenshot for the report summary, but the filstrip does not shows this transitions. This part is fully unrelated to the reported bug, and it is more of my use case and end condition (thanks).

That being said, if my test scripts uses the commands.navigate(URL); command after the measure.start(alias) the errors are replicated in full. whereas if my test script uses the commands.navigate(URL) before the measure.start(alias), all errors listed here are gone.

Will drop both cases off this ticket for sake of clarity. Thanks a lot!!

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

No branches or pull requests

3 participants