Comments (3)
Note that the log shows a hint:
[2023-08-18 20:32:35] ERROR: [browsertime.command.measure] You need to have done one (start/stop) measurement before you can add any metrics to a result.
This error seems to be in reference to first_stopwatch
.
The first_stopwatch
metric is not recorded in any output json files. The second_stopwatch
metric incorrectly appears in the output json files for https://google.com, the URL used in first_test
.
I think this is due to https://github.com/sitespeedio/browsertime/blob/main/lib/core/engine/command/measure.js#L327 . When adding a metric, the index used is this.numberOfMeasuredPages - 1
, but start() and stop() index at this.numberOfMeasuredPages
.
The doc language on StopWatch.stopAndAdd() says that the measurement will be added to the "last measured page", which suggests that this could conceivably be intentional behaviour -- but if it is, then it makes stopwatches awkward to use.
from browsertime.
The stop watch is always registered to the last measured URL, so to make it work you need to adjust the script to first measure that first page load and then do the stop watch thing.
from browsertime.
Are you saying that the correct version of the script is not:
await commands.navigate("https://sitespeed.io");
await commands.measure.start("first_test");
const stopWatch = commands.stopWatch.get('first_stopwatch');
// some interesting operation here
const stopWatchTime = stopWatch.stopAndAdd();
return commands.measure.stop();
but instead:
await commands.navigate("https://sitespeed.io");
await commands.measure.start("first_test");
const stopWatch = commands.stopWatch.get('first_stopwatch');
// some interesting operation here
const stopWatchTime = stopWatch.stop();
await commands.measure.stop();
await commands.measure.add(stopWatch.name, stopWatchTime);
because that makes StopWatch.stopAndAdd()
fairly worthless, and makes the whole test more verbose and awkward to write.
from browsertime.
Related Issues (20)
- How to collect fetch/xhr requests in the network HOT 2
- Selenium console.log message when you run tests with Safari HOT 1
- Chrome 119+ fails to start HOT 1
- Implement support for soft navigations in Chrome(ium)
- Support SPA navigations that do not do any requests
- linux failed to start chorme three times HOT 2
- When testing multiple URLs, the cache of previous URLs will not be obtained and will not interfere with each other. HOT 11
- Firefox 121 on Mac OS (14.2) fails to start HOT 2
- When runMultiple is running, will the script execution time in preScript and postScript be counted in the recorded time? HOT 2
- Add types to https://github.com/DefinitelyTyped/DefinitelyTyped HOT 2
- Firefox on Android always runs power usage tests HOT 2
- Implement Long Animation Frame HOT 1
- Be able to set custom paths to Safari or Safari Technology Preview (i.e. something like safari.binaryPath) HOT 4
- Safari Technology Preview not being recognized as a browser? HOT 4
- Convert visualmetrics-portable.py script to use pathlib instead of the os module for path manipulation
- firefox.collectMozLog does not work on Android HOT 2
- IntelliSense broken for 22.5.0 HOT 2
- Run Chrome browser on Iphone HOT 1
- DrawText do not work with FFMPEG 7
- Proper typescript types
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from browsertime.