browsertime 19.2.0 → 19.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +113 -89
- package/lib/video/postprocessing/visualmetrics/visualMetrics.js +2 -2
- package/package.json +3 -3
- package/browsertime/__init__.py +0 -1
- package/browsertime/test_data/ms_000000.png +0 -0
- package/browsertime/test_data/ms_000920.png +0 -0
- package/browsertime/test_data/ms_001000.png +0 -0
- package/browsertime/test_data/ms_001080.png +0 -0
- package/browsertime/test_data/ms_001200.png +0 -0
- package/browsertime/test_data/ms_001240.png +0 -0
- package/browsertime/test_data/ms_001280.png +0 -0
- package/browsertime/test_data/ms_001360.png +0 -0
- package/browsertime/test_data/ms_001400.png +0 -0
- package/browsertime/test_data/ms_001520.png +0 -0
- package/browsertime/test_data/ms_002040.png +0 -0
- package/browsertime/test_data/ms_002600.png +0 -0
- package/browsertime/test_data/ms_003160.png +0 -0
- package/browsertime/test_data/ms_003720.png +0 -0
- package/browsertime/test_data/ms_004280.png +0 -0
- package/browsertime/test_data/ms_004880.png +0 -0
- package/browsertime/test_data/ms_005440.png +0 -0
- package/browsertime/test_data/ms_006000.png +0 -0
- package/browsertime/test_visualmetrics.py +0 -34
- package/browsertime/visualmetrics-portable.py +0 -1969
- package/browsertime/visualmetrics.py +0 -2518
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Browsertime changelog (we do [semantic versioning](https://semver.org))
|
|
2
2
|
|
|
3
|
+
## 19.3.0 - 2023-12-18
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
* Updated Chromedriver and Edgedriver to 120 [#2033](https://github.com/sitespeedio/browsertime/pull/2033).
|
|
7
|
+
|
|
8
|
+
### Tech
|
|
9
|
+
* Moved the visual metrics python scripts to a new home [#2032](https://github.com/sitespeedio/browsertime/pull/2032).
|
|
10
|
+
|
|
3
11
|
## 19.2.0 - 2023-12-11
|
|
4
12
|
### Added
|
|
5
13
|
* Updated to Chrome and Edge 120 in the Docker container [#2031](https://github.com/sitespeedio/browsertime/pull/2031).
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Browsertime
|
|
1
|
+
# Browsertime
|
|
2
2
|

|
|
3
3
|

|
|
4
4
|

|
|
@@ -12,125 +12,113 @@
|
|
|
12
12
|
|
|
13
13
|

|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
# Browsertime: Measure and Optimize Web Performance
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Browsertime is a powerful, open-source Node.js tool designed for engineers who are building their own performance measurement tools. It serves as the core engine of projects like sitespeed.io and is a trusted tool used by Mozilla to measure the performance of Firefox.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
# Table of Contents
|
|
20
|
+
1. [Introduction](#browsertime-measure-and-optimize-web-performance)
|
|
21
|
+
2. [Key Features](#key-features)
|
|
22
|
+
3. [Installation](#installation)
|
|
23
|
+
- [NodeJS](#nodejs)
|
|
24
|
+
- [Docker](#docker)
|
|
25
|
+
4. [Usage](#usage)
|
|
26
|
+
- [Basic Usage](#basic-usage)
|
|
27
|
+
- [Advanced Options](#advanced-options)
|
|
28
|
+
- [Connectivity](#connectivity)
|
|
29
|
+
- [Navigate in a script](#navigate-in-a-script)
|
|
30
|
+
- [Test on your mobile device](#test-on-your-mobile-device)
|
|
31
|
+
- [Using WebPageReplay](#using-webpagereplay)
|
|
32
|
+
- [Speed Index and video](#speed-index-and-video)
|
|
33
|
+
5. [Browser Support](#browser-support)
|
|
34
|
+
6. [How does it work](#how-does-it-work)
|
|
35
|
+
7. [Contributing](#contributing)
|
|
36
|
+
9. [Community and Support](#community-and-support)
|
|
37
|
+
9. [License](#license)
|
|
20
38
|
|
|
21
|
-
|
|
39
|
+
## Key Features
|
|
22
40
|
|
|
23
|
-
|
|
24
|
-
- It executes a batch of default and configurable JavaScript when the URL has finished loading in the browser.
|
|
25
|
-
- It records a video of the Browser screen used to calculate [Visual Metrics](https://github.com/WPO-Foundation/visualmetrics).
|
|
26
|
-
- It lets you run your [scripting file to create and measure your users journey](https://www.sitespeed.io/documentation/sitespeed.io/scripting/).
|
|
41
|
+
- **Robust Performance Testing:** Browsertime allows you to perform comprehensive performance tests on your web pages, including page load times, resource loading, and user interactions.
|
|
27
42
|
|
|
28
|
-
**
|
|
43
|
+
- **Deep Metrics:** Gain access to a wide range of performance metrics, such as page load times, visual metrics (when things are painted on the screen), largest contentful paint (LCP), and more, helping you pinpoint areas for improvement.
|
|
29
44
|
|
|
30
|
-
|
|
45
|
+
- **Scripting Capabilities:** Customize your tests and user interactions with JavaScript scripting, enabling advanced scenarios and detailed analysis.
|
|
31
46
|
|
|
32
|
-
|
|
33
|
-
|
|
47
|
+
- **Docker Support:** Easily integrate Browsertime into your CI/CD pipelines and containerized environments with Docker support.
|
|
48
|
+
##
|
|
34
49
|
|
|
35
|
-
|
|
50
|
+
## Installation
|
|
36
51
|
|
|
37
|
-
|
|
38
|
-
2. Browsertime uses the [WebDriver](https://www.w3.org/TR/webdriver/) (through [Selenium](http://seleniumhq.github.io/selenium/docs/api/javascript/index.html)) to start Firefox/Chrome/Safari/Edge.
|
|
39
|
-
3. Browsertime starts FFMPEG to record a video of the browser screen
|
|
40
|
-
4. The browser access the URL.
|
|
41
|
-
5. When the page is finished loading (you can define yourself when that happens), Browsertime collects:
|
|
42
|
-
- [Navigation Timing metrics](http://kaaes.github.io/timing/info.html)
|
|
43
|
-
- [User Timing metrics](http://www.html5rocks.com/en/tutorials/webperformance/usertiming/)
|
|
44
|
-
- [Element Timing metrics](https://wicg.github.io/element-timing/)
|
|
45
|
-
- [Paint Timings](https://w3c.github.io/paint-timing/)
|
|
46
|
-
- [Googles Web Vitals](https://web.dev/vitals/)
|
|
47
|
-
- [CPU metrics CPU Long Tasks]((https://developer.mozilla.org/en-US/docs/Web/API/Long_Tasks_API))
|
|
48
|
-
6. You can also collect internal trace logs from the browser using `--firefox.geckoProfiler` for Firefox and `--chrome.timeline` for Chromium browsers.
|
|
49
|
-
7. It also collects a [HAR](http://www.softwareishard.com/blog/har-12-spec/) file that shows all requests/responses on the page.
|
|
50
|
-
8. FFMpeg is stopped and the video is analysed. Browsertime collect Visual Metrics like Speed Index, First Visual Change and Last Visual Change.
|
|
52
|
+
If you're an engineer working on performance measurement tools or simply want to harness the power of Browsertime for your web performance needs, follow the installation and usage instructions below.
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
### NodeJS
|
|
55
|
+
```shell
|
|
56
|
+
npm install -g browsertime
|
|
57
|
+
browsertime https://example.com
|
|
58
|
+
```
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
### Docker
|
|
61
|
+
```shell
|
|
62
|
+
docker run --rm -v "$(pwd)":/browsertime sitespeedio/browsertime https://www.sitespeed.io/
|
|
63
|
+
```
|
|
60
64
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
$ npm install browsertime -g
|
|
64
|
-
$ browsertime https://www.sitespeed.io/
|
|
65
|
-
</pre>
|
|
65
|
+
## Usage
|
|
66
|
+
Browsertime is designed to be straightforward to use, regardless of your experience level. Here's a quick guide on how to get started.
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
### Basic Usage
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
```shell
|
|
71
|
+
browsertime https://www.example.com --browser chrome
|
|
72
|
+
```
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
Browsertime supports Firefox, Chrome, and Edge (Chromium version) on desktop and Safari on Mac OS. On Android we support Chrome and Firefox (from 8.0) and Safari on iOS. You can also use the Safari simulator on Mac OS.
|
|
74
|
+
This command will test https://www.example.com using Chrome.
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
Browsertime uses Selenium NodeJS to drive the browser. It starts the browser, load a URL, executes configurable Javascripts to collect metrics, collect a HAR file.
|
|
76
|
+
### Advanced Options
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
Browsertime offers various advanced options for more detailed analysis, such as specifying the number of runs, choosing a browser, or setting custom metrics. Here are some examples:
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
It's easiest to run [our ready made Docker container](https://hub.docker.com/r/sitespeedio/browsertime/) to be able to record a video and calculate SpeedIndex because then you get all dependencies needed for free to run [VisualMetrics](https://github.com/WPO-Foundation/visualmetrics).
|
|
80
|
+
#### Run the test multiple times
|
|
82
81
|
|
|
83
|
-
|
|
82
|
+
```shell
|
|
83
|
+
browsertime -n 5 https://www.example.com
|
|
84
|
+
```
|
|
84
85
|
|
|
85
|
-
|
|
86
|
+
#### Specify a different browser
|
|
87
|
+
```shell
|
|
88
|
+
browsertime --browser firefox https://www.example.com
|
|
89
|
+
```
|
|
86
90
|
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
#### Custom metrics
|
|
92
|
+
```shell
|
|
93
|
+
browsertime --script "return {'myMetric': window.myApp.customMetric}" https://www.example.com
|
|
94
|
+
```
|
|
89
95
|
|
|
90
|
-
<
|
|
91
|
-
$ docker build -t sitespeedio/browsertime .
|
|
92
|
-
$ docker run --rm -v "$(pwd)":/browsertime sitespeedio/browsertime -n 1 https://www.sitespeed.io/
|
|
93
|
-
</pre>
|
|
96
|
+
For a full list of options, run <code>$ browsertime --help</code> and you can see the configuration options.
|
|
94
97
|
|
|
95
|
-
|
|
98
|
+
#### Connectivity
|
|
96
99
|
|
|
97
100
|
You can throttle the connection to make the connectivity slower to make it easier to catch regressions. The best way to do that is to setup a network bridge in Docker or use our connectivity engine Throttle. Read more about how to do that in the [documentation](https://www.sitespeed.io/documentation/sitespeed.io/connectivity/).
|
|
98
101
|
|
|
99
|
-
|
|
100
|
-
## Navigate in a script
|
|
102
|
+
#### Navigate in a script
|
|
101
103
|
If you need a more complicated test scenario, you can define your own (Selenium)test script that will do the testing. Use your own test script when you want to test your page as a logged in user, the login page or if you want to add things to your cart.
|
|
102
104
|
|
|
103
105
|
We have a full section in the documentation about [scripting](https://www.sitespeed.io/documentation/sitespeed.io/scripting/).
|
|
104
106
|
|
|
105
|
-
|
|
107
|
+
#### Test on your mobile device
|
|
106
108
|
Browsertime supports Chrome and Firefox on Android: Collecting SpeedIndex, HAR and video!
|
|
107
109
|
|
|
108
110
|
You need to [install adb](https://www.sitespeed.io/documentation/sitespeed.io/mobile-phones/#desktop) and [prepare your phone](https://www.sitespeed.io/documentation/sitespeed.io/mobile-phones/#on-your-phone) before you start.
|
|
109
111
|
|
|
110
|
-
If you want to set connectivity you need to use something like [gnirehtet](https://github.com/Genymobile/gnirehtet)
|
|
112
|
+
If you want to set connectivity you need to use something like [gnirehtet](https://github.com/Genymobile/gnirehtet). Read more information [here](https://www.sitespeed.io/documentation/sitespeed.io/mobile-phones/#connectivity).
|
|
111
113
|
|
|
112
114
|
<pre>
|
|
113
115
|
$ browsertime --chrome.android.package com.android.chrome https://www.sitespeed.io --video --visualMetrics
|
|
114
116
|
</pre>
|
|
115
117
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
* You need to share the USB ports *-v /dev/bus/usb:/dev/bus/usb* or share a specific port with *--device=/dev/bus/usb/001/017* (use *lsusb* to find the right mapping)
|
|
119
|
-
* Add *-e START_ADB_SERVER=true* to start the adb server
|
|
120
|
-
|
|
121
|
-
If you use Docker you will automatically get support for video and SpeedIndex. You can get that without Docker but then need to [install VisualMetrics dependencies](https://github.com/sitespeedio/docker-visualmetrics-deps/blob/main/Dockerfile) yourself.
|
|
122
|
-
|
|
123
|
-
<pre>
|
|
124
|
-
$ docker run --privileged -v /dev/bus/usb:/dev/bus/usb -e START_ADB_SERVER=true --rm -v "$(pwd)":/browsertime-results sitespeedio/browsertime -n 1 --android --visualMetrics --video https://en.m.wikipedia.org/wiki/Barack_Obama
|
|
125
|
-
</pre>
|
|
126
|
-
|
|
127
|
-
## Configuration
|
|
128
|
-
Run <code>$ bin/browsertime.js --help</code> and you can see the configuration options.
|
|
129
|
-
|
|
130
|
-
## Using WebPageReplay
|
|
131
|
-
Our Docker container now included [WebPageReplay](https://github.com/catapult-project/catapult/blob/main/web_page_replay_go/README.md).
|
|
118
|
+
#### Using WebPageReplay
|
|
119
|
+
Our Docker container now includes [WebPageReplay](https://github.com/catapult-project/catapult/blob/main/web_page_replay_go/README.md).
|
|
132
120
|
|
|
133
|
-
WebPageReplay will let you replay your page locally (getting rid of server latency
|
|
121
|
+
WebPageReplay will let you replay your page locally (getting rid of server latency) and makes it easier to find front end regressions.
|
|
134
122
|
|
|
135
123
|
It works like this:
|
|
136
124
|
1. The start script starts WebPageReplay in record mode
|
|
@@ -150,23 +138,59 @@ docker run --cap-add=NET_ADMIN --rm -v "$(pwd)":/browsertime -e REPLAY=true -e L
|
|
|
150
138
|
|
|
151
139
|
Use Firefox:
|
|
152
140
|
|
|
153
|
-
```
|
|
154
|
-
docker run --cap-add=NET_ADMIN --rm -v "$(pwd)":/browsertime -e REPLAY=true -e LATENCY=100 sitespeedio/browsertime:
|
|
141
|
+
```shell
|
|
142
|
+
docker run --cap-add=NET_ADMIN --rm -v "$(pwd)":/browsertime -e REPLAY=true -e LATENCY=100 sitespeedio/browsertime:19.2.0 -b firefox -n 11 --firefox.acceptInsecureCerts https://en.wikipedia.org/wiki/Barack_Obama
|
|
155
143
|
```
|
|
156
144
|
|
|
157
145
|
And Chrome on your Android phone. This will only work on Linux because you need to be able to mount the usb port in Docker:
|
|
158
146
|
|
|
159
|
-
```
|
|
147
|
+
```shell
|
|
160
148
|
docker run --privileged -v /dev/bus/usb:/dev/bus/usb -e START_ADB_SERVER=true --cap-add=NET_ADMIN --rm -v “$(pwd)“:/browsertime -e REPLAY=true -e LATENCY=100 sitespeedio/browsertime https://en.m.wikipedia.org/wiki/Barack_Obama --android --chrome.args ignore-certificate-errors-spki-list=PhrPvGIaAMmd29hj8BCZOq096yj7uMpRNHpn5PDxI6I= -n 11 --chrome.args user-data-dir=/data/tmp/chrome
|
|
161
149
|
```
|
|
162
150
|
|
|
163
|
-
|
|
164
|
-
|
|
151
|
+
#### Speed Index and video
|
|
152
|
+
It's easiest to run [our ready made Docker container](https://hub.docker.com/r/sitespeedio/browsertime/) to be able to record a video and calculate SpeedIndex because then you get all dependencies needed for free to run [VisualMetrics](https://github.com/WPO-Foundation/visualmetrics).
|
|
165
153
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
154
|
+
The default video will include a timer and showing when the metrics happens, but you can turn that off using <code>--video.addTimer false</code>.
|
|
155
|
+
|
|
156
|
+
<img src="https://raw.githubusercontent.com/sitespeedio/sitespeed.io/main/docs/img/video-example.gif">
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
## Browser Support
|
|
160
|
+
Browsertime supports Firefox, Chrome, and Edge (Chromium version) on desktop and Safari on Mac OS. On Android we support Chrome and Firefox. Safari on iOS has limited support: there's no HAR file and no visual metrics. You can also use the Safari simulator on Mac OS.
|
|
161
|
+
|
|
162
|
+
## How does it work
|
|
163
|
+
Browsertime uses Selenium NodeJS to drive the browser. It starts the browser, load a URL, executes configurable Javascripts to collect metrics, collect a HAR file.
|
|
164
|
+
|
|
165
|
+
To get the HAR from Firefox we use the [HAR Export Trigger](https://github.com/firebug/har-export-trigger) and Chrome we use [Chrome-HAR](https://github.com/sitespeedio/chrome-har) to parse the timeline log and generate the HAR file.
|
|
166
|
+
|
|
167
|
+
## Contributing
|
|
168
|
+
|
|
169
|
+
We welcome contributions from the community! Whether you're fixing a bug, adding a feature, or improving documentation, your help is valuable. Here’s how you can contribute:
|
|
170
|
+
|
|
171
|
+
1. **Fork and Clone**: Fork the repository and clone it locally.
|
|
172
|
+
2. **Create a Branch**: Create a new branch for your feature or bug fix.
|
|
173
|
+
3. **Develop**: Make your changes. Ensure you adhere to the coding standards and write tests if applicable.
|
|
174
|
+
4. **Test**: Run tests to ensure everything works as expected.
|
|
175
|
+
5. **Submit a Pull Request**: Push your changes to your fork and submit a pull request to the main repository.
|
|
176
|
+
|
|
177
|
+
Before contributing, please read our [CONTRIBUTING.md](CONTRIBUTING.md) for more detailed information on how to contribute.
|
|
178
|
+
|
|
179
|
+
### Reporting Issues
|
|
180
|
+
Found a bug or have a feature request? Please use the [GitHub Issues](https://github.com/sitespeedio/browsertime/issues) to report them. Be sure to check existing issues to avoid duplicates.
|
|
181
|
+
|
|
182
|
+
## Community and Support
|
|
183
|
+
|
|
184
|
+
Join our community! Whether you need help, want to share your experience, or discuss potential improvements, there are several ways to get involved:
|
|
185
|
+
|
|
186
|
+
- **Slack**: Connect with fellow users and the development team on [Slack](https://join.slack.com/t/sitespeedio/shared_invite/zt-296jzr7qs-d6DId2KpEnMPJSQ8_R~WFw).
|
|
187
|
+
- **GitHub Issues**: For technical questions, feature requests, and bug reports, use our [GitHub issues](https://github.com/sitespeedio/browsertime/issues).
|
|
188
|
+
|
|
189
|
+
We're excited to have you in our community and look forward to your contributions and interactions!
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
[Apache License version 2.0](LICENSE).
|
|
170
194
|
|
|
171
195
|
[travis-image]: https://img.shields.io/travis/sitespeedio/browsertime.svg?style=flat-square
|
|
172
196
|
[travis-url]: https://travis-ci.org/sitespeedio/browsertime
|
|
@@ -14,7 +14,7 @@ const SCRIPT_PATH = join(
|
|
|
14
14
|
'..',
|
|
15
15
|
'..',
|
|
16
16
|
'..',
|
|
17
|
-
'
|
|
17
|
+
'visualmetrics',
|
|
18
18
|
'visualmetrics.py'
|
|
19
19
|
);
|
|
20
20
|
|
|
@@ -24,7 +24,7 @@ const PORTABLE_SCRIPT_PATH = join(
|
|
|
24
24
|
'..',
|
|
25
25
|
'..',
|
|
26
26
|
'..',
|
|
27
|
-
'
|
|
27
|
+
'visualmetrics',
|
|
28
28
|
'visualmetrics-portable.py'
|
|
29
29
|
);
|
|
30
30
|
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browsertime",
|
|
3
3
|
"description": "Get performance metrics from your web page using Browsertime.",
|
|
4
|
-
"version": "19.
|
|
4
|
+
"version": "19.3.0",
|
|
5
5
|
"bin": "./bin/browsertime.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@cypress/xvfb": "1.2.4",
|
|
9
9
|
"@devicefarmer/adbkit": "3.2.5",
|
|
10
|
-
"@sitespeed.io/chromedriver": "
|
|
11
|
-
"@sitespeed.io/edgedriver": "
|
|
10
|
+
"@sitespeed.io/chromedriver": "120.0.6099-71",
|
|
11
|
+
"@sitespeed.io/edgedriver": "120.0.2210-77",
|
|
12
12
|
"@sitespeed.io/geckodriver": "0.33.0-c",
|
|
13
13
|
"@sitespeed.io/throttle": "5.0.0",
|
|
14
14
|
"@sitespeed.io/tracium": "0.3.3",
|
package/browsertime/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import unittest
|
|
2
|
-
import os
|
|
3
|
-
|
|
4
|
-
from browsertime.visualmetrics import (
|
|
5
|
-
calculate_contentful_speed_index,
|
|
6
|
-
calculate_perceptual_speed_index,
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
HERE = os.path.dirname(__file__)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class TestVisualMetrics(unittest.TestCase):
|
|
13
|
-
def setUp(self):
|
|
14
|
-
self.directory = "test_data"
|
|
15
|
-
images = os.listdir(os.path.join(HERE, self.directory))
|
|
16
|
-
|
|
17
|
-
def _p(image):
|
|
18
|
-
p = {}
|
|
19
|
-
p["time"] = int(image.split(".")[0].split("ms_")[-1])
|
|
20
|
-
return p
|
|
21
|
-
|
|
22
|
-
progress = [_p(image) for image in images if image.startswith("ms_")]
|
|
23
|
-
self.sorted_progress = sorted(progress,
|
|
24
|
-
key = lambda image: image['time'])
|
|
25
|
-
|
|
26
|
-
def test_calculate_contentful_speed_index(self):
|
|
27
|
-
res = calculate_contentful_speed_index(self.sorted_progress,
|
|
28
|
-
self.directory)
|
|
29
|
-
self.assertEqual(res[0], 1188)
|
|
30
|
-
|
|
31
|
-
def test_calculate_perceptual_speed_index(self):
|
|
32
|
-
res = calculate_perceptual_speed_index(self.sorted_progress,
|
|
33
|
-
self.directory)
|
|
34
|
-
self.assertEqual(res[0], 946)
|