sitespeedio / sitespeedio/sitespeed.io

Measure multiple element timing and page visual complete for a page with shadow DOM

Open
#4,136 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Your question

I am looking for some suggestions on how properly this can be done.

Goal: Execute tests against the application with shadow DOM and measure multiple elements/components timing + visual complete. So we would be able to get all the timings both when multiple elements are available and full page visual complete.

As of now, I can see several solutions to each but I assume there are even more.

  1. Element timings(Element Timing API) I am mostly talking about --scriptInput.visualElements. The limitation of it is that it doesn't work for shadow DOM as you can get it by single document.body.querySelector. I understand that you may annotate elements but that will require additional work from dev teams.
  2. Using performance marks. In general, just mark before the page starts loading and add an additional mark once an element is visible/clickable/etc. Currently, I have an issue with that where the mark is not found. I assume it is because it requires the page to be in context, which is not available if you mark it before the navigation.
  3. Using stopWatch. For now, that's the only solution I was able to achieve some results but only for a single element. I am awaiting a specific element to appear, but I haven't yet figured out how to do it for multiple elements.

Including a sample of how I am doing it with stopWatch

await commands.measure.start('Test');
const stopWatchBefore = commands.stopWatch.get('ElementStopWatch');
commands.navigate('https://example.com/');
await commands.wait.byId('someElementId', 5000);
const time = stopWatch.stop();
await commands.wait.byPageToComplete();
await commands.measure.stop();
await commands.measure.add(stopWatch.getName(), time);

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 by reviewing the existing --scriptInput.visualElements handling and the commands.measure, commands.stopWatch, commands.navigate, and commands.wait entry points shown in the example. Compare their behavior across navigation and shadow DOM contexts. Done means a documented or implemented approach can measure multiple elements/components and full-page visual complete timing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.