Have a way to send custom Event timing to WPT

Hi

as a feature suggestion, I would like to be able to measure the time to interactivity for a specific are of the code.

The ultimate goal of the automation of WPT monitoring is to know how much time there is between the page starts to load and the moment the user can use the main functionality of the page (say start to read the article, press the “play” of the video and so on).

Obviously WPT can not guess it, and what is closer of that today is to look at the screenshots and know by heart the interface of the site to guess when the UI of a specific page module is really usable.
That would be better to have it appear in the waterfall and have numbers to monitor.

Could we have a dialog between the page and WPT ?
There is something already in the scripting ( https://sites.google.com/a/webpagetest.org/docs/using-webpagetest/scripting#TOC-waitForJSDone )

window.webpagetest.done();

But that stops all measurement, so it can be used only once.

We could have something like

window.webpagetest.markTimer('feature1');

and feature1 would appear both in the waterfall and in the results API, for monitoring

Do you think it’s possible ?

It’s possible but it might be more interesting if we add support for W3C User Timing - GitHub - w3c/web-performance: W3C Web Performance Working Group repo

That way you would have code on your pages that worked with RUM as well. The catch is that it’s not actually implemented in the browsers yet but we might be able to create a fake interface to support the browsers that haven’t implemented it yet.

Even better if we use a standard API !
Polyfilling that by JS injection during the WPT test is doable I guess, since you already had introduced webpagetest.done()

Do you think you will do it, and if so when could it happen ?

Yes, I’d like to do it but realistically it would be quite a while before I got to it.

I can understand
can you think of any way we could measure such stuff in the meantime ?

If your are using Chrome for testing you can send console log messages and the time for each message gets recorded (console log is displayed on the screen shot page). For IE the webpagetest.status (I think that’s the js command) messages are also logged the same way.