browsertime 15.0.1 → 15.2.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
+ ## 15.2.0 - 2022-03-04
4
+ ### Added
5
+ * Updated to Chromedriver and Edgedriver 99.
6
+ * Updated Docker container to use Chrome and Edge 99 [#1738](https://github.com/sitespeedio/browsertime/pull/1738).
7
+
8
+ ### Fixed
9
+ * Added more view ports for emulated mobile in Chrome [#1736](https://github.com/sitespeedio/browsertime/pull/1736).
10
+ ## 15.1.1 - 2022-02-24
11
+ ### Fixed
12
+ * Updated Chromedriver dependency that fixes installation on M1 and [some send keys issues](https://chromedriver.storage.googleapis.com/98.0.4758.102/notes.txt).
13
+ ## 15.1.0 - 2022-02-24
14
+ ### Added
15
+ * Collect timings from main document. The result includes a field named mainDocumentTimings and contains blocked, dns, connect, send, wait, receive, ssl as long as you get a HAR file from the browser [#1735](https://github.com/sitespeedio/browsertime/pull/1735).
16
+
17
+ ### Tech
18
+ * Cleaned the DNS flush code [#1734](https://github.com/sitespeedio/browsertime/pull/1734).
3
19
  ## 15.0.1 - 2022-02-21
4
20
  ### Fixed
5
21
  * Make sure connectivity is only set before the test begins [#1733](https://github.com/sitespeedio/browsertime/pull/1733).
@@ -47,6 +47,7 @@ function getNewResult(url, options) {
47
47
  googleWebVitals: [],
48
48
  extras: [],
49
49
  fullyLoaded: [],
50
+ mainDocumentTimings: [],
50
51
  errors: []
51
52
  };
52
53
  }
@@ -114,6 +115,23 @@ class Collector {
114
115
  }
115
116
  }
116
117
 
118
+ addMainDocumentTimings(url, timings) {
119
+ const statistics =
120
+ this.allStats[url] || this.allStats[this.urlAndActualUrl[url]];
121
+ const results =
122
+ this.allResults[url] || this.allResults[this.urlAndActualUrl[url]];
123
+ if (results) {
124
+ results.mainDocumentTimings.push(timings);
125
+ }
126
+ if (timings && statistics) {
127
+ statistics.addDeep({
128
+ timings: {
129
+ mainDocumentTimings: timings
130
+ }
131
+ });
132
+ }
133
+ }
134
+
117
135
  /**
118
136
  * Collect all individual runs, add it to the statistics, and store
119
137
  * data that needs to be on disk (trace logs, sceenshots etc).
@@ -297,6 +297,11 @@ class Engine {
297
297
  for (let data of fullyLoadedPerUrl) {
298
298
  collector.addFullyLoaded(data.url, data.fullyLoaded);
299
299
  }
300
+ // Add the timings from the main document
301
+ const timings = harUtil.getMainDocumentTimings(extras.har);
302
+ for (let timing of timings) {
303
+ collector.addMainDocumentTimings(timing.url, timing.timings);
304
+ }
300
305
  }
301
306
 
302
307
  const totalResult = collector.getResults();
@@ -3,6 +3,7 @@
3
3
  const execa = require('execa');
4
4
  const log = require('intel').getLogger('browsertime.dns');
5
5
  const { isAndroidConfigured } = require('../android');
6
+
6
7
  module.exports = async function (options) {
7
8
  if (isAndroidConfigured(options)) {
8
9
  return;
@@ -13,32 +14,26 @@ module.exports = async function (options) {
13
14
  }
14
15
 
15
16
  if (process.platform === 'darwin') {
16
- try {
17
- await execa('sudo', ['killall', '-HUP', 'mDNSResponder'], {
18
- reject: false
19
- });
20
- await execa('sudo', ['dscacheutil', '-flushcache'], {
21
- reject: false
22
- });
23
- return execa('sudo', ['lookupd', '-flushcache'], {
24
- reject: false
25
- });
26
- } catch (err) {
27
- log.error('Could not flush dns cache', err);
28
- }
17
+ log.debug('Flush DNS cache on MacOS');
18
+ await execa('sudo', ['killall', '-HUP', 'mDNSResponder'], {
19
+ reject: false
20
+ });
21
+ await execa('sudo', ['dscacheutil', '-flushcache'], {
22
+ reject: false
23
+ });
24
+ return execa('sudo', ['lookupd', '-flushcache'], {
25
+ reject: false
26
+ });
29
27
  } else if (process.platform === 'linux') {
30
- try {
31
- await execa('sudo', ['service', 'dnsmasq', 'restart'], {
32
- reject: false
33
- });
34
- await execa('sudo', ['rndc', 'restart'], {
35
- reject: false
36
- });
37
- return execa('sudo', ['systemd-resolve', '--flush-caches'], {
38
- reject: false
39
- });
40
- } catch (err) {
41
- log.error('Could not flush dns cache', err);
42
- }
28
+ log.debug('Flush DNS cache on Linux');
29
+ await execa('sudo', ['systemd-resolve', '--flush-caches'], {
30
+ reject: false
31
+ });
32
+ await execa('sudo', ['service', 'dnsmasq', 'restart'], {
33
+ reject: false
34
+ });
35
+ await execa('sudo', ['rndc', 'restart'], {
36
+ reject: false
37
+ });
43
38
  }
44
39
  };
@@ -22,7 +22,12 @@ const sizeMap = {
22
22
  'Pixel 2': '412x732',
23
23
  'Pixel 2 XL': '412x824',
24
24
  iPad: '768x1024',
25
- 'iPad Pro': '1024x1366'
25
+ 'iPad Pro': '1024x1366',
26
+ 'iPhone XR': '414x896',
27
+ 'iPhone SE': '377x668',
28
+ 'iPhone 12 Pro': '390x844',
29
+ 'Pixel 5': '394x852',
30
+ 'Samsung Galaxy S8+': '412x846'
26
31
  };
27
32
 
28
33
  module.exports = function (options) {
@@ -18,6 +18,30 @@ function generateUniquePageId(baseId, existingIdMap) {
18
18
  return newId;
19
19
  }
20
20
 
21
+ function getDocumentRequests(entries, pageId) {
22
+ let pageEntries = Array.from(entries);
23
+ if (pageId) {
24
+ pageEntries = Array.from(entries.filter(entry => entry.pageref === pageId));
25
+ }
26
+
27
+ const requests = [];
28
+ let entry;
29
+
30
+ do {
31
+ entry = pageEntries.shift();
32
+ requests.push(entry);
33
+ } while (entry.response.redirectURL);
34
+
35
+ return requests;
36
+ }
37
+
38
+ function getFinalURL(entries, pageref) {
39
+ const requests = getDocumentRequests(entries, pageref);
40
+
41
+ const finalEntry = requests.pop();
42
+ return finalEntry.request.url;
43
+ }
44
+
21
45
  function addExtrasToHAR(
22
46
  harPage,
23
47
  visualMetricsData,
@@ -160,6 +184,27 @@ module.exports = {
160
184
  return har;
161
185
  },
162
186
 
187
+ getMainDocumentTimings: function (har) {
188
+ const timings = [];
189
+ const entries = Array.from(har.log.entries);
190
+
191
+ for (let page of har.log.pages) {
192
+ const pageId = page.id;
193
+ const url = page._url;
194
+
195
+ let pageEntries = Array.from(entries);
196
+ const finalURL = getFinalURL(pageEntries, pageId);
197
+
198
+ pageEntries = Array.from(
199
+ pageEntries.filter(
200
+ entry => entry.pageref === pageId && entry.request.url === finalURL
201
+ )
202
+ );
203
+
204
+ timings.push({ url, timings: pageEntries[0].timings });
205
+ }
206
+ return timings;
207
+ },
163
208
  getFullyLoaded: function (har) {
164
209
  const fullyLoaded = [];
165
210
  const entries = Array.from(har.log.entries);
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "description": "Browsertime",
3
- "version": "15.0.1",
3
+ "version": "15.2.0",
4
4
  "bin": "./bin/browsertime.js",
5
5
  "dependencies": {
6
6
  "@cypress/xvfb": "1.2.4",
7
7
  "@devicefarmer/adbkit": "2.11.3",
8
- "@sitespeed.io/chromedriver": "98.0.4758-48b",
9
- "@sitespeed.io/edgedriver": "98.0.1108-43",
8
+ "@sitespeed.io/chromedriver": "99.0.4844-51",
9
+ "@sitespeed.io/edgedriver": "99.0.1150-25",
10
10
  "@sitespeed.io/geckodriver": "0.30.0",
11
11
  "@sitespeed.io/throttle": "3.0.0",
12
12
  "@sitespeed.io/tracium": "0.3.3",