sitespeed.io 23.7.0 → 24.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/.eslintignore CHANGED
@@ -4,3 +4,4 @@ assets/*
4
4
  sitespeed-result/*
5
5
  lib/plugins/yslow/scripts/*
6
6
  lib/plugins/html/assets/js/*
7
+ test/data/*
@@ -9,7 +9,7 @@ jobs:
9
9
  steps:
10
10
  -
11
11
  name: Checkout
12
- uses: actions/checkout@v2
12
+ uses: actions/checkout@v3
13
13
  -
14
14
  name: Set up QEMU
15
15
  uses: docker/setup-qemu-action@v1
@@ -10,9 +10,9 @@ jobs:
10
10
  build:
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
- - uses: actions/checkout@v2
13
+ - uses: actions/checkout@v3
14
14
  - name: Use Node.js
15
- uses: actions/setup-node@v1
15
+ uses: actions/setup-node@v3
16
16
  with:
17
17
  node-version: '16.x'
18
18
  - name: Install sitespeed.io
@@ -10,7 +10,7 @@ jobs:
10
10
  runs-on: ubuntu-18.04
11
11
  steps:
12
12
  - name: Checkout code
13
- uses: actions/checkout@v2
13
+ uses: actions/checkout@v3
14
14
 
15
15
  - name: Build an image from Dockerfile
16
16
  run: |
@@ -10,21 +10,25 @@ jobs:
10
10
  build:
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
- - uses: actions/checkout@v2
13
+ - uses: actions/checkout@v3
14
14
  - name: Build Docker containers
15
15
  run: |
16
16
  docker buildx install
17
17
  docker buildx build --load --platform linux/amd64 -t sitespeedio/sitespeed.io .
18
18
  docker buildx build --load --platform linux/amd64 -t sitespeedio/sitespeed.io:slim --file Dockerfile-slim .
19
+ - name: Install local HTTP server
20
+ run: npm install serve -g
21
+ - name: Start local HTTP server
22
+ run: (serve test/data/html/ -l 3001&)
19
23
  - name: Run test on default container for Chrome
20
- run: docker run --rm sitespeedio/sitespeed.io https://www.sitespeed.io -n 1 -b chrome
24
+ run: docker run --rm --network=host sitespeedio/sitespeed.io http://127.0.0.1:3001 -n 1 -b chrome
21
25
  - name: Run test on default container for Firefox
22
- run: docker run --rm sitespeedio/sitespeed.io https://www.sitespeed.io -n 1 -b firefox
26
+ run: docker run --rm --network=host sitespeedio/sitespeed.io http://127.0.0.1:3001 -n 1 -b firefox
23
27
  - name: Run test on default container for Edge
24
- run: docker run --rm sitespeedio/sitespeed.io https://www.sitespeed.io -n 1 -b edge
28
+ run: docker run --rm --network=host sitespeedio/sitespeed.io http://127.0.0.1:3001 -n 1 -b edge
25
29
  - name: Run test on slim container
26
- run: docker run --rm sitespeedio/sitespeed.io:slim https://www.sitespeed.io -n 1 --browsertime.firefox.preference "devtools.netmonitor.persistlog:true"
30
+ run: docker run --rm --network=host sitespeedio/sitespeed.io:slim http://127.0.0.1:3001 -n 1 --browsertime.firefox.preference "devtools.netmonitor.persistlog:true"
27
31
  - name: Test WebPageReplay with Chrome
28
- run: docker run --cap-add=NET_ADMIN --rm -e REPLAY=true -e LATENCY=100 sitespeedio/sitespeed.io https://www.sitespeed.io -n 3 -b chrome
32
+ run: docker run --cap-add=NET_ADMIN --rm -e REPLAY=true -e LATENCY=100 sitespeedio/sitespeed.io https://www.sitespeed.io -n 3 -b chrome
29
33
  - name: Test WebPageReplay with Firefox
30
- run: docker run --cap-add=NET_ADMIN --rm -e REPLAY=true -e LATENCY=100 sitespeedio/sitespeed.io https://www.sitespeed.io -n 3 -b firefox --browsertime.firefox.acceptInsecureCerts true
34
+ run: docker run --cap-add=NET_ADMIN --rm --network=host -e REPLAY=true -e LATENCY=100 sitespeedio/sitespeed.io https://www.sitespeed.io -n 3 -b firefox --browsertime.firefox.acceptInsecureCerts true
@@ -10,9 +10,9 @@ jobs:
10
10
  build:
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
- - uses: actions/checkout@v2
13
+ - uses: actions/checkout@v3
14
14
  - name: Use Node.js
15
- uses: actions/setup-node@v1
15
+ uses: actions/setup-node@v3
16
16
  with:
17
17
  node-version: '16.x'
18
18
  - name: Install sitespeed.io
@@ -34,25 +34,33 @@ jobs:
34
34
  run: |
35
35
  google-chrome --version
36
36
  firefox --version
37
+ - name: Install local HTTP server
38
+ run: npm install serve -g
39
+ - name: Start local HTTP server
40
+ run: (serve test/data/html/ -l 3001&)
37
41
  - name: Test old budget
38
- run: bin/sitespeed.js -b firefox -n 2 --budget.configPath test/oldBudget.json --summary --xvfb https://www.sitespeed.io/
39
- - name: Test new budget file
40
- run: bin/sitespeed.js --useHash -n 1 --budget.configPath test/budget.json --xvfb https://www.sitespeed.io/#heybaberia
42
+ run: bin/sitespeed.js -b firefox -n 2 --budget.configPath test/oldBudget.json --summary --xvfb http://127.0.0.1:3001/simple/
43
+ - name: Test new budget file with junit
44
+ run: bin/sitespeed.js --useHash -n 1 --budget.configPath test/budget.json --xvfb --budget.output junit http://127.0.0.1:3001/simple/#heybaberia
45
+ - name: Test new budget file with tap
46
+ run: bin/sitespeed.js --useHash -n 1 --budget.configPath test/budget.json --xvfb --budget.output tap http://127.0.0.1:3001/simple/#heybaberia
47
+ - name: Test new budget file with json
48
+ run: bin/sitespeed.js --useHash -n 1 --budget.configPath test/budget.json --xvfb --budget.output json http://127.0.0.1:3001/simple/#heybaberia
41
49
  - name: Use AXE
42
- run: bin/sitespeed.js --useAlias start --mobile -n 1 --utc --axe.enable --xvfb https://www.sitespeed.io/
50
+ run: bin/sitespeed.js --useAlias start --mobile -n 1 --utc --axe.enable --xvfb http://127.0.0.1:3001/simple/
43
51
  - name: Use Fireefox with --mobile
44
- run: bin/sitespeed.js -b firefox --metrics.list --mobile -n 1 https://www.sitespeed.io/ --sustainable.enable --xvfb
52
+ run: bin/sitespeed.js -b firefox --metrics.list --mobile -n 1 http://127.0.0.1:3001/simple/ --sustainable.enable --xvfb
45
53
  - name: Test --multi
46
- run: bin/sitespeed.js --multi -b chrome -n 1 test/prepostscripts/preSample.js https://www.sitespeed.io/documentation/ test/prepostscripts/postSample.js --xvfb
54
+ run: bin/sitespeed.js --multi -b chrome -n 1 test/prepostscripts/preSample.js http://127.0.0.1:3001/simple/ test/prepostscripts/postSample.js --xvfb
47
55
  - name: Test --multi and --tcpdump
48
- run: bin/sitespeed.js --multi -n 1 https://www.sitespeed.io/ https://www.sitespeed.io/documentation/ --tcpdump --xvfb
56
+ run: bin/sitespeed.js --multi -n 1 http://127.0.0.1:3001/simple/ http://127.0.0.1:3001/dimple/ --tcpdump --xvfb
49
57
  - name: Test --multi with one file
50
58
  run: bin/sitespeed.js --multi -n 3 test/prepostscripts/multi.js --xvfb
51
59
  - name: Test setting HTML output pageSummaries
52
- run: bin/sitespeed.js https://www.sitespeed.io/ https://www.google.com -v -n 1 --html.pageSummaryMetrics transferSize.css --html.pageSummaryMetrics requests.httpErrors --html.pageSummaryMetrics score.performance --xvfb
60
+ run: bin/sitespeed.js http://127.0.0.1:3001/simple/ http://127.0.0.1:3001/dimple/ -v -n 1 --html.pageSummaryMetrics transferSize.css --html.pageSummaryMetrics requests.httpErrors --html.pageSummaryMetrics score.performance --xvfb
53
61
  - name: Test setting HTML output summary boxes
54
- run: bin/sitespeed.js https://www.sitespeed.io/ -v -n 1 --html.summaryBoxes score.performance --html.summaryBoxes timings.firstPaint --xvfb
62
+ run: bin/sitespeed.js http://127.0.0.1:3001/simple/ -v -n 1 --html.summaryBoxes score.performance --html.summaryBoxes timings.firstPaint --xvfb
55
63
  - name: Run test with Graphite
56
- run: bin/sitespeed.js https://www.sitespeed.io/ -n 1 --graphite.host 127.0.0.1 --xvfb
64
+ run: bin/sitespeed.js http://127.0.0.1:3001/simple/ -n 1 --graphite.host 127.0.0.1 --xvfb
57
65
  - name: Run test without a CLI
58
66
  run: xvfb-run node test/runWithoutCli.js
@@ -10,14 +10,18 @@ jobs:
10
10
  build:
11
11
  runs-on: macos-latest
12
12
  steps:
13
- - uses: actions/checkout@v2
13
+ - uses: actions/checkout@v3
14
14
  - name: Use Node.js
15
- uses: actions/setup-node@v1
15
+ uses: actions/setup-node@v3
16
16
  with:
17
17
  node-version: '16.x'
18
18
  - name: Install dependencies
19
19
  run: |
20
20
  sudo safaridriver --enable
21
21
  npm ci
22
+ - name: Install local HTTP server
23
+ run: npm install serve -g
24
+ - name: Start local HTTP server
25
+ run: (serve test/data/html/ -l 3001&)
22
26
  - name: Run test
23
- run: bin/sitespeed.js -b safari https://www.sitespeed.io/
27
+ run: bin/sitespeed.js -b safari http://127.0.0.1:3001/
@@ -9,7 +9,7 @@ jobs:
9
9
  name: running sitespeed.io
10
10
  steps:
11
11
  - name: code checkout
12
- uses: actions/checkout@v2
12
+ uses: actions/checkout@v3
13
13
  # Here we build our own container to make sure we test against our latest code
14
14
  # but YOU can just used the latest version by specifying
15
15
  # sitespeedio/sitespeed.io:VERSION
@@ -13,9 +13,9 @@ jobs:
13
13
  matrix:
14
14
  node-version: [14.x, 16.x]
15
15
  steps:
16
- - uses: actions/checkout@v2
16
+ - uses: actions/checkout@v3
17
17
  - name: Use Node.js ${{ matrix.node-version }}
18
- uses: actions/setup-node@v1
18
+ uses: actions/setup-node@v3
19
19
  with:
20
20
  node-version: ${{ matrix.node-version }}
21
21
  - name: Install dependencies and Chrome
@@ -10,9 +10,9 @@ jobs:
10
10
  build:
11
11
  runs-on: windows-latest
12
12
  steps:
13
- - uses: actions/checkout@v2
13
+ - uses: actions/checkout@v3
14
14
  - name: Use Node.js
15
- uses: actions/setup-node@v1
15
+ uses: actions/setup-node@v3
16
16
  with:
17
17
  node-version: '16.x'
18
18
  - name: Install sitespeed.io
@@ -24,6 +24,6 @@ jobs:
24
24
  - name: Install dependencies
25
25
  run: choco install microsoft-edge --force
26
26
  - name: Run Edge test
27
- run: node bin/sitespeed.js -b edge https://www.sitespeed.io/
27
+ run: node bin/sitespeed.js -b edge https://www.sitespeed.io/
28
28
  shell: cmd
29
29
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # CHANGELOG - sitespeed.io (we use [semantic versioning](https://semver.org))
2
2
 
3
+ ## 24.2.0 - 2022-04-26
4
+
5
+ ### Added
6
+ * Updated base Docker image to use Ubuntu 22.04 [#3636](https://github.com/sitespeedio/sitespeed.io/pull/3636).
7
+
8
+ ### Fixed
9
+ * Updated dependencies: aws-sdk, cli-color, fs-extra, influx, junit-report-builder and tape [#3640](https://github.com/sitespeedio/sitespeed.io/pull/3640)
10
+
11
+ ### Tech
12
+ * Use Ava for unit testing [#3637](https://github.com/sitespeedio/sitespeed.io/pull/3637)
13
+ * Use local HTTP server to speed up GitHub Action tests [#3638](https://github.com/sitespeedio/sitespeed.io/pull/3638).
14
+ * Updated dev dependencies [#3639](https://github.com/sitespeedio/sitespeed.io/pull/3639).
15
+
16
+ ## 24.1.0 - 2022-04-22
17
+ ### Added
18
+ * Update Grafana auth settings to allow api token or basic auth, thank you [Vladimir Stepanov](https://github.com/vs-odessa) for PR [#3627](https://github.com/sitespeedio/sitespeed.io/pull/3627).
19
+ * Add TTFB to the metrics page [#3630](https://github.com/sitespeedio/sitespeed.io/pull/3630).
20
+ * Use latest Coach core with updated PageXray and Third party web [#3629](https://github.com/sitespeedio/sitespeed.io/pull/3629).
21
+ * Make it possible to disable annotations for Graphite. Set `--graphite.sendAnnotation false` to disable sending annotations [#3625](https://github.com/sitespeedio/sitespeed.io/pull/3625).
22
+ * Show which run that is used in the metrics tab [#3631](https://github.com/sitespeedio/sitespeed.io/pull/3631).
23
+ * Updated to [Browsertime 16.1.0](https://github.com/sitespeedio/browsertime/blob/main/CHANGELOG.md#1610---2022-04-20).
24
+ ### Updated
25
+ * Update dependencies: google-cloud/storage, aws-sdk, dayjs, yargs [#3635](https://github.com/sitespeedio/sitespeed.io/pull/3635).
26
+
27
+ ## 24.0.0 - 2022-04-06
28
+
29
+ ### Changed
30
+ * Upgraded to [Browsertime 16.0.0](https://github.com/sitespeedio/browsertime/blob/main/CHANGELOG.md#1600---2022-04-05) that changed how the DNS is flushed. You need to add `--flushDNS` to your conifguration to flush the DNS between runs.
31
+
32
+ ### Added
33
+ * Use Firefox 99 and Edge/Edgedriver 100 in the Dockker container.
34
+
35
+ ### Fixed
36
+ * Better catch if Visual Metrics fails [#3619](https://github.com/sitespeedio/sitespeed.io/pull/3619)
37
+ * Fixed JUnit/alias bug [#3620](https://github.com/sitespeedio/sitespeed.io/pull/3620)
3
38
  ## 23.7.0 - 2022-03-31
4
39
  ### Added
5
40
  * Updated to Chrome/Chromedriver 100 and [Browsertime 15.4.0](https://github.com/sitespeedio/browsertime/blob/main/CHANGELOG.md#1540---2022-03-30).
package/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM sitespeedio/webbrowsers:chrome-100.0-firefox-98.0-edge-99.0
1
+ FROM sitespeedio/webbrowsers:chrome-100.0-firefox-99.0-edge-100.0-b
2
2
 
3
3
  ARG TARGETPLATFORM=linux/amd64
4
4
 
package/lib/cli/cli.js CHANGED
@@ -991,6 +991,12 @@ module.exports.parseCommandLine = function parseCommandLine() {
991
991
  describe: 'Https proxy (host:port)',
992
992
  group: 'proxy'
993
993
  })
994
+ .option('browsertime.flushDNS', {
995
+ alias: 'flushDNS',
996
+ describe:
997
+ 'Flush the DNS between runs (works on Mac OS and Linux). The user needs sudo rights to flush the DNS.',
998
+ group: 'Browser'
999
+ })
994
1000
  .option('browsertime.headless', {
995
1001
  alias: 'headless',
996
1002
  type: 'boolean',
@@ -11,24 +11,29 @@ exports.writeJunit = function (results, dir, options) {
11
11
  const urls = Object.keys(merge({}, results.failing, results.working));
12
12
 
13
13
  for (const url of urls) {
14
- const parsedUrl = urlParser.parse(url);
15
- const fineUrl =
14
+ // The URL can be an alias
15
+ let name = url;
16
+ if (url.startsWith('http')) {
17
+ const parsedUrl = urlParser.parse(url);
18
+ name = url.startsWith('http') ? url : url;
16
19
  parsedUrl.hostname.replace(/\./g, '_') +
17
- '.' +
18
- parsedUrl.path.replace(/\./g, '_').replace(/\//g, '_');
20
+ '.' +
21
+ parsedUrl.path.replace(/\./g, '_').replace(/\//g, '_');
22
+ }
23
+
19
24
  const suite = builder
20
25
  .testSuite()
21
26
  .name(
22
27
  options.budget.friendlyName
23
28
  ? options.budget.friendlyName
24
- : 'sitespeed.io' + '.' + fineUrl
29
+ : 'sitespeed.io' + '.' + name
25
30
  );
26
31
 
27
32
  if (results.failing[url]) {
28
33
  for (const result of results.failing[url]) {
29
34
  suite
30
35
  .testCase()
31
- .className(fineUrl)
36
+ .className(name)
32
37
  .name(result.type + '.' + result.metric)
33
38
  .failure(
34
39
  result.metric + ' is ' + result.friendlyValue ||
@@ -46,7 +51,7 @@ exports.writeJunit = function (results, dir, options) {
46
51
  for (const result of results.working[url]) {
47
52
  suite
48
53
  .testCase()
49
- .className(fineUrl)
54
+ .className(name)
50
55
  .name(result.type + '.' + result.metric)
51
56
  .standardOutput(
52
57
  result.metric + ' is ' + result.friendlyValue ||
@@ -10,7 +10,7 @@ module.exports = {
10
10
  },
11
11
  auth: {
12
12
  describe:
13
- 'The Grafana auth/bearer value used when sending annotations to Grafana. See http://docs.grafana.org/http_api/auth/#authentication-api',
13
+ 'The Grafana auth/bearer value used when sending annotations to Grafana. If you do not set Bearer/Auth, Bearer is automatically set. See http://docs.grafana.org/http_api/auth/#authentication-api',
14
14
  group: 'Grafana'
15
15
  },
16
16
  annotationTitle: {
@@ -98,7 +98,14 @@ module.exports = {
98
98
  // If Grafana is behind auth, use it!
99
99
  if (options.grafana.auth) {
100
100
  log.debug('Using auth for Grafana');
101
- postOptions.headers.Authorization = 'Bearer ' + options.grafana.auth;
101
+ if (
102
+ options.grafana.auth.startsWith('Bearer') ||
103
+ options.grafana.auth.startsWith('Basic')
104
+ ) {
105
+ postOptions.headers.Authorization = options.grafana.auth;
106
+ } else {
107
+ postOptions.headers.Authorization = 'Bearer ' + options.grafana.auth;
108
+ }
102
109
  }
103
110
  log.verbose('Send annotation to Grafana: %j', postData);
104
111
  return new Promise((resolve, reject) => {
@@ -59,6 +59,13 @@ module.exports = {
59
59
  'Include screenshot (from Browsertime/WebPageTest) in the annotation. You need to specify a --resultBaseURL for this to work.',
60
60
  group: 'Graphite'
61
61
  },
62
+ sendAnnotation: {
63
+ default: true,
64
+ type: 'boolean',
65
+ describe:
66
+ 'Send annotations when a run is finished. You need to specify a --resultBaseURL for this to work. However if you for example use a Prometheus exporter, you may want to make sure annotations are not sent, then set it to false.',
67
+ group: 'Graphite'
68
+ },
62
69
  annotationRetentionMinutes: {
63
70
  type: 'number',
64
71
  describe:
@@ -60,7 +60,7 @@ module.exports = {
60
60
  this.messageTypesToFireAnnotations = [];
61
61
  this.receivedTypesThatFireAnnotations = {};
62
62
  this.make = context.messageMaker('graphite').make;
63
- this.sendAnnotation = true;
63
+ this.sendAnnotation = opts.sendAnnotation || true;
64
64
  this.alias = {};
65
65
  this.wptExtras = {};
66
66
  this.usingBrowsertime = false;
@@ -4,7 +4,7 @@ module.exports = {
4
4
  pickMedianRun(runs, pageInfo) {
5
5
  // Choose the median run. Early first version, in the future we can make
6
6
  // this configurable through the CLI
7
- // If we have SpeedIndex use that else backup with RUM SpeedIndex
7
+ // If we have SpeedIndex use that else backup with loadEventEnd
8
8
 
9
9
  const speedIndexMedian = get(
10
10
  pageInfo,
@@ -17,6 +17,8 @@ module.exports = {
17
17
  if (speedIndexMedian) {
18
18
  for (let run of runs) {
19
19
  if (
20
+ // https://github.com/sitespeedio/sitespeed.io/issues/3618
21
+ run.data.browsertime.run.visualMetrics &&
20
22
  speedIndexMedian === run.data.browsertime.run.visualMetrics.SpeedIndex
21
23
  ) {
22
24
  return {
@@ -38,6 +38,9 @@ if browsertime
38
38
  a(href='#server-timings') Server timings
39
39
  |  | 
40
40
 
41
+ p
42
+ small #{ medianRun ? 'Data from run ' + medianRun.runIndex : ''}
43
+
41
44
  - baseHelpURL = rootPath + 'help.html#';
42
45
 
43
46
  - const defaultVisualMetrics = ['SpeedIndex','FirstVisualChange','LastVisualChange','VisualProgress', 'PerceptualSpeedIndexProgress', 'ContentfulSpeedIndexProgress', 'videoRecordingStart', 'PerceptualSpeedIndex', 'ContentfulSpeedIndex', 'LastMeaningfulPaint', 'LargestImage', 'Heading' ,'VisualReadiness','VisualComplete85', 'VisualComplete95','VisualComplete99'];
@@ -156,6 +159,10 @@ if browsertime
156
159
  table
157
160
  tr
158
161
  th(colspan='2') Extra timings
162
+ tr
163
+ td
164
+ a(href=baseHelpURL + 'ttfb') TTFB
165
+ td.number #{h.time.ms(timings.ttfb.toFixed(0))}
159
166
  if (timings.paintTiming && Object.keys(timings.paintTiming).length > 0)
160
167
  - const paintTimingHelper = { "first-contentful-paint": {"name": 'First Contentful Paint (FCP)', "friendly": "first-contentful-paint"}, "first-paint": {"name": 'First Paint', "friendly": "firstPaint" }};
161
168
  each value, name in timings.paintTiming
@@ -289,7 +296,10 @@ if browsertime
289
296
  td #{element.name}
290
297
  if (element.filename)
291
298
  | (#{element.filename})
292
- td #{visualMetrics[element.name] ? h.time.ms(visualMetrics[element.name].toFixed(0)): ''}
299
+ if element && visualMetrics && visualMetrics[element.name]
300
+ td #{visualMetrics[element.name] ? h.time.ms(visualMetrics[element.name].toFixed(0)): ''}
301
+ else
302
+ td
293
303
  td #{element.x}
294
304
  td #{element.y}
295
305
  td #{element.width}