browsertime 21.6.1 → 21.7.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,8 +1,16 @@
|
|
|
1
1
|
# Browsertime changelog (we do [semantic versioning](https://semver.org))
|
|
2
2
|
|
|
3
|
+
## 21.7.0 - 2024-04-03
|
|
4
|
+
### Added
|
|
5
|
+
* Edge and Edgedriver 123 [#2116](https://github.com/sitespeedio/browsertime/pull/2116).
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
* Updated to Selenium 4.19.0 [#2117](https://github.com/sitespeedio/browsertime/pull/2117).
|
|
9
|
+
* Block domains using Bidi instead of the extension server for Firefox [#2118](https://github.com/sitespeedio/browsertime/pull/2118).
|
|
10
|
+
|
|
3
11
|
## 21.6.1 - 2024-03-22
|
|
4
12
|
### Fixed
|
|
5
|
-
* Fix
|
|
13
|
+
* Fix running Safari TP. Thank you [KS](https://github.com/92kns) for PR [#2115](https://github.com/sitespeedio/browsertime/pull/2115).
|
|
6
14
|
|
|
7
15
|
## 21.6.0 - 2024-03-20
|
|
8
16
|
### Added
|
|
@@ -6,9 +6,7 @@ const delay = ms => new Promise(res => setTimeout(res, ms));
|
|
|
6
6
|
|
|
7
7
|
function generateURL(port, testUrl, options) {
|
|
8
8
|
const query = {};
|
|
9
|
-
|
|
10
|
-
query.bl = toArray(options.block);
|
|
11
|
-
}
|
|
9
|
+
|
|
12
10
|
if (options.requestheader) {
|
|
13
11
|
query.rh = toArray(options.requestheader);
|
|
14
12
|
}
|
|
@@ -29,6 +29,55 @@ export class FirefoxBidi {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
async blockUrls(blockers) {
|
|
33
|
+
// bin/browsertime.js --block upload.wikimedia.org https://en.wikipedia.org/wiki/Barack_Obama -n 1 -b firefox
|
|
34
|
+
const patterns = [];
|
|
35
|
+
const block = toArray(blockers);
|
|
36
|
+
for (let b of block) {
|
|
37
|
+
// Block a specific URL
|
|
38
|
+
if (b.startsWith('http')) {
|
|
39
|
+
patterns.push({ type: 'string', pattern: b });
|
|
40
|
+
} else {
|
|
41
|
+
// Block by domain
|
|
42
|
+
patterns.push({ type: 'pattern', hostname: b });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const bidi = new Bidi(this.driver, this.options.browser);
|
|
47
|
+
|
|
48
|
+
const command = {
|
|
49
|
+
method: 'network.addIntercept',
|
|
50
|
+
params: {
|
|
51
|
+
phases: ['beforeRequestSent'],
|
|
52
|
+
urlPatterns: patterns
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const result = await bidi.send(command);
|
|
56
|
+
if (result.type != 'success') {
|
|
57
|
+
log.error(result);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
await bidi.subscribe('network.beforeRequestSent');
|
|
61
|
+
|
|
62
|
+
await bidi.onMessage(async function (event) {
|
|
63
|
+
const parsedEvent = JSON.parse(Buffer.from(event.toString()));
|
|
64
|
+
if (
|
|
65
|
+
parsedEvent.method === 'network.beforeRequestSent' &&
|
|
66
|
+
parsedEvent.params.isBlocked === true
|
|
67
|
+
) {
|
|
68
|
+
const fail = {
|
|
69
|
+
method: 'network.failRequest',
|
|
70
|
+
params: {
|
|
71
|
+
request: parsedEvent.params.request.request
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const result = await bidi.send(fail);
|
|
75
|
+
if (result.type != 'success') {
|
|
76
|
+
log.error(result);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
32
81
|
async setBasicAuth(basicAuth) {
|
|
33
82
|
const parts = basicAuth.split('@');
|
|
34
83
|
const bidi = new Bidi(this.driver, this.options.browser);
|
|
@@ -97,6 +97,10 @@ export class Firefox {
|
|
|
97
97
|
await this.browsertimeBidi.setBasicAuth(this.options.basicAuth);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
if (this.options.block) {
|
|
101
|
+
await this.browsertimeBidi.blockUrls(this.options.block);
|
|
102
|
+
}
|
|
103
|
+
|
|
100
104
|
if (
|
|
101
105
|
this.firefoxConfig.appendToUserAgent ||
|
|
102
106
|
this.options.appendToUserAgent
|
package/lib/support/cli.js
CHANGED
|
@@ -1099,7 +1099,7 @@ export function parseCommandLine() {
|
|
|
1099
1099
|
})
|
|
1100
1100
|
.option('block', {
|
|
1101
1101
|
describe:
|
|
1102
|
-
'Domain to block or URL or URL pattern to block. If you use Chrome you can also use --blockDomainsExcept (that is more performant). Works in Chrome/Edge. For Firefox you
|
|
1102
|
+
'Domain to block or URL or URL pattern to block. If you use Chrome you can also use --blockDomainsExcept (that is more performant). Works in Chrome/Edge. For Firefox you block a URL if you start with http else you will block by setting a domain, like upload.wikimedia.org'
|
|
1103
1103
|
})
|
|
1104
1104
|
.option('percentiles', {
|
|
1105
1105
|
type: 'array',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browsertime",
|
|
3
3
|
"description": "Get performance metrics from your web page using Browsertime.",
|
|
4
|
-
"version": "21.
|
|
4
|
+
"version": "21.7.0",
|
|
5
5
|
"bin": "./bin/browsertime.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./types/scripting.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"@cypress/xvfb": "1.2.4",
|
|
10
10
|
"@devicefarmer/adbkit": "3.2.6",
|
|
11
11
|
"@sitespeed.io/chromedriver": "123.0.6312-58",
|
|
12
|
-
"@sitespeed.io/edgedriver": "
|
|
12
|
+
"@sitespeed.io/edgedriver": "123.0.2420-53",
|
|
13
13
|
"@sitespeed.io/geckodriver": "0.34.0",
|
|
14
14
|
"@sitespeed.io/throttle": "5.0.0",
|
|
15
15
|
"@sitespeed.io/tracium": "0.3.3",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"lodash.merge": "4.6.2",
|
|
31
31
|
"lodash.pick": "4.4.0",
|
|
32
32
|
"lodash.set": "4.3.2",
|
|
33
|
-
"selenium-webdriver": "4.
|
|
33
|
+
"selenium-webdriver": "4.19.0",
|
|
34
34
|
"yargs": "17.7.2"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|