From 232a307616fed906e806b656e04caaba3463cca0 Mon Sep 17 00:00:00 2001 From: Peter Hedenskog Date: Wed, 20 Mar 2024 09:10:36 +0100 Subject: [PATCH 1/4] Bump all browser with one version (#2110) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ddcfb2aa9..1a4e327d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM sitespeedio/webbrowsers:chrome-122.0-firefox-123.0-edge-121.0 +FROM sitespeedio/webbrowsers:chrome-123.0-firefox-124.0-edge-122.0 ARG TARGETPLATFORM=linux/amd64 From 590018d2847c70a52d2c1f9b3ea3e93999ddd814 Mon Sep 17 00:00:00 2001 From: Peter Hedenskog Date: Wed, 20 Mar 2024 09:11:13 +0100 Subject: [PATCH 2/4] Use latest Chrome and Edgedriver (#2111) --- package-lock.json | 28 ++++++++++++++-------------- package.json | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index cc6f46192..ca88cd346 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,8 +11,8 @@ "dependencies": { "@cypress/xvfb": "1.2.4", "@devicefarmer/adbkit": "3.2.6", - "@sitespeed.io/chromedriver": "122.0.6261-69", - "@sitespeed.io/edgedriver": "121.0.2277-128", + "@sitespeed.io/chromedriver": "123.0.6312-58", + "@sitespeed.io/edgedriver": "122.0.2365-92", "@sitespeed.io/geckodriver": "0.34.0", "@sitespeed.io/throttle": "5.0.0", "@sitespeed.io/tracium": "0.3.3", @@ -956,9 +956,9 @@ } }, "node_modules/@sitespeed.io/chromedriver": { - "version": "122.0.6261-69", - "resolved": "https://registry.npmjs.org/@sitespeed.io/chromedriver/-/chromedriver-122.0.6261-69.tgz", - "integrity": "sha512-OUuWC3UgDMGOdHG24daw13GOAJjguTcgNcy6hhW52nxjbm8IDiC0hm6TiR3txCbdACh4k2EGl3KxBsHrbMXSrQ==", + "version": "123.0.6312-58", + "resolved": "https://registry.npmjs.org/@sitespeed.io/chromedriver/-/chromedriver-123.0.6312-58.tgz", + "integrity": "sha512-1v24uZmt9bAc80td0YfPA0M6uA9zYpFrBBM12Wkir7GqtpX7DCsNMuqGqVzBfsYp8UiU+wG/FtIb6+3PMr4P6Q==", "hasInstallScript": true, "dependencies": { "node-downloader-helper": "2.1.9", @@ -977,9 +977,9 @@ } }, "node_modules/@sitespeed.io/edgedriver": { - "version": "121.0.2277-128", - "resolved": "https://registry.npmjs.org/@sitespeed.io/edgedriver/-/edgedriver-121.0.2277-128.tgz", - "integrity": "sha512-uKfU4Y1m44GudzXrRUSIPCN3CCuYYLF7B7n+XNOXH7126h2sRsVLYRqW2cstN5eUECDMlo/iJo7a5c4xmnXwNg==", + "version": "122.0.2365-92", + "resolved": "https://registry.npmjs.org/@sitespeed.io/edgedriver/-/edgedriver-122.0.2365-92.tgz", + "integrity": "sha512-7A31VWQl9XjHEmmZur4nSlr+8xIweWNpuEyc151FS9ScQskRjJMS0iMJgSvLcIVwacm56ni2W6+IqdPLisRrwA==", "hasInstallScript": true, "dependencies": { "node-downloader-helper": "2.1.7", @@ -7637,9 +7637,9 @@ "dev": true }, "@sitespeed.io/chromedriver": { - "version": "122.0.6261-69", - "resolved": "https://registry.npmjs.org/@sitespeed.io/chromedriver/-/chromedriver-122.0.6261-69.tgz", - "integrity": "sha512-OUuWC3UgDMGOdHG24daw13GOAJjguTcgNcy6hhW52nxjbm8IDiC0hm6TiR3txCbdACh4k2EGl3KxBsHrbMXSrQ==", + "version": "123.0.6312-58", + "resolved": "https://registry.npmjs.org/@sitespeed.io/chromedriver/-/chromedriver-123.0.6312-58.tgz", + "integrity": "sha512-1v24uZmt9bAc80td0YfPA0M6uA9zYpFrBBM12Wkir7GqtpX7DCsNMuqGqVzBfsYp8UiU+wG/FtIb6+3PMr4P6Q==", "requires": { "node-downloader-helper": "2.1.9", "node-stream-zip": "1.15.0" @@ -7653,9 +7653,9 @@ } }, "@sitespeed.io/edgedriver": { - "version": "121.0.2277-128", - "resolved": "https://registry.npmjs.org/@sitespeed.io/edgedriver/-/edgedriver-121.0.2277-128.tgz", - "integrity": "sha512-uKfU4Y1m44GudzXrRUSIPCN3CCuYYLF7B7n+XNOXH7126h2sRsVLYRqW2cstN5eUECDMlo/iJo7a5c4xmnXwNg==", + "version": "122.0.2365-92", + "resolved": "https://registry.npmjs.org/@sitespeed.io/edgedriver/-/edgedriver-122.0.2365-92.tgz", + "integrity": "sha512-7A31VWQl9XjHEmmZur4nSlr+8xIweWNpuEyc151FS9ScQskRjJMS0iMJgSvLcIVwacm56ni2W6+IqdPLisRrwA==", "requires": { "node-downloader-helper": "2.1.7", "node-stream-zip": "1.15.0" diff --git a/package.json b/package.json index 9e39542c6..a26d58230 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "dependencies": { "@cypress/xvfb": "1.2.4", "@devicefarmer/adbkit": "3.2.6", - "@sitespeed.io/chromedriver": "122.0.6261-69", - "@sitespeed.io/edgedriver": "121.0.2277-128", + "@sitespeed.io/chromedriver": "123.0.6312-58", + "@sitespeed.io/edgedriver": "122.0.2365-92", "@sitespeed.io/geckodriver": "0.34.0", "@sitespeed.io/throttle": "5.0.0", "@sitespeed.io/tracium": "0.3.3", From d2a9058ea1859d63659a0e567e454af6c3468ab0 Mon Sep 17 00:00:00 2001 From: Peter Hedenskog Date: Wed, 20 Mar 2024 10:59:46 +0100 Subject: [PATCH 3/4] Check the return of Bidi send (#2112) --- lib/firefox/firefoxBidi.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/firefox/firefoxBidi.js b/lib/firefox/firefoxBidi.js index a24f13814..019faf273 100644 --- a/lib/firefox/firefoxBidi.js +++ b/lib/firefox/firefoxBidi.js @@ -20,7 +20,10 @@ export class FirefoxBidi { }; try { - await this.bidi.send(params); + const result = await this.bidi.send(params); + if (result.type != 'success') { + log.error(result); + } } catch (error) { log.error('Could not inject JavaScript:' + error); } @@ -55,7 +58,10 @@ export class FirefoxBidi { } } }; - await bidi.send(continueWithAuth); + const result = await bidi.send(continueWithAuth); + if (result.type != 'success') { + log.error(result); + } } }); } @@ -82,7 +88,10 @@ export class FirefoxBidi { } }; try { - await this.bidi.send(params); + const result = await this.bidi.send(params); + if (result.type != 'success') { + log.error(result); + } } catch (error) { log.error('Could not set cookie:' + error); } From 26fa28170d3af7394178790933050bd2c1d853c5 Mon Sep 17 00:00:00 2001 From: Peter Hedenskog Date: Wed, 20 Mar 2024 13:06:04 +0100 Subject: [PATCH 4/4] Multi step error fix (#2107) * Make stopAsError report failures. The old version was kind of broken that returned partly result json. This fix makes sure the test return as a failure (as documented) and remove all result data (as documented). https://github.com/sitespeedio/sitespeed.io/issues/4113 --- lib/core/engine/command/measure.js | 32 +++++++++++++------ lib/core/engine/index.js | 1 + .../desktop/desktopRecorder.js | 6 ++++ lib/video/video.js | 20 +++++++----- 4 files changed, 41 insertions(+), 18 deletions(-) diff --git a/lib/core/engine/command/measure.js b/lib/core/engine/command/measure.js index 157def901..98531f0e4 100644 --- a/lib/core/engine/command/measure.js +++ b/lib/core/engine/command/measure.js @@ -205,11 +205,14 @@ export class Measure { } else { this.result.at(-1).error.push(message); } - } else { - // error not associated to a start/run so far - log.error('No page that could be associated with the error:' + message); } } + // Add the error in the generic failure + if (this.result.failureMessages) { + this.result.failureMessages.push(message); + } else { + this.result.failureMessages = [message]; + } } /** @@ -217,7 +220,7 @@ export class Measure { * @private */ _failure(message) { - log.debug('Mark run as failure with message %s', message); + log.info('Mark run as failure with message: %s', message); this.result.markedAsFailure = 1; if (this.result.failureMessages) { this.result.failureMessages.push(message); @@ -378,14 +381,22 @@ export class Measure { * * @async * @param {string} errorMessage - The message about the error. This will end up on the HTML report for sitespeed.io so give it a good message so you know what's gone wrong. - * @param {string} optionalURL - The URL of the page that you wanted to test. If you don't know the URL (you clicked on a link etc) skip it. * @returns {Promise} A promise that resolves when the stop process has completed. * @since 21.2.0 */ - async stopAsError(errorMessage, optionalURL) { - this._error(errorMessage); + async stopAsError(errorMessage) { + this._failure(errorMessage); this.areWeMeasuring = false; - return this.stop(optionalURL, false); + // Remove the last result + this.result.pop(); + + await this._stopVideo(); + + if (this.options.tcpdump) { + await this.tcpDump.stop(); + } + + return; } /** * Stops the measurement process, collects metrics, and handles any post-measurement tasks. @@ -397,7 +408,7 @@ export class Measure { * @throws {Error} Throws an error if there are issues in stopping the measurement or collecting data. * @returns {Promise} A promise that resolves with the collected metrics data. */ - async stop(testedStartUrl, collectMeasurements = true) { + async stop(testedStartUrl) { log.debug('Stop measuring'); // If we don't have a URL (tested using clicking on link etc) get the URL from the browser let url = @@ -454,6 +465,7 @@ export class Measure { ) { res.alias = this.options.urlMetaData[url]; } + this.result[this.numberOfMeasuredPages] = merge( this.result[this.numberOfMeasuredPages], res @@ -463,7 +475,7 @@ export class Measure { await this.tcpDump.stop(); } - return collectMeasurements === false ? undefined : this.collect(url); + return this.collect(url); } /** diff --git a/lib/core/engine/index.js b/lib/core/engine/index.js index 079f1485b..bab4650df 100644 --- a/lib/core/engine/index.js +++ b/lib/core/engine/index.js @@ -321,6 +321,7 @@ export class Engine { if (data.error) { errorsOutsideTheBrowser.push(...data.error); } + // Catch failures like starting the browser if (data.markedAsFailure) { failures.push(...data.failureMessages); diff --git a/lib/video/screenRecording/desktop/desktopRecorder.js b/lib/video/screenRecording/desktop/desktopRecorder.js index 9de0674b0..f16135485 100644 --- a/lib/video/screenRecording/desktop/desktopRecorder.js +++ b/lib/video/screenRecording/desktop/desktopRecorder.js @@ -53,6 +53,12 @@ export class DesktopRecorder { async stop(destination) { log.debug('Stop screen recording'); await _stop(this.recording); + + // This was a test with and error and probably not a navigation + // The user script use stopAsError + if (!destination) { + return; + } // FIXME update to rename/move file // The destination file could exixt of we use --resultDir // so make sure we remove it first diff --git a/lib/video/video.js b/lib/video/video.js index 793dbdc87..5311a6f7e 100644 --- a/lib/video/video.js +++ b/lib/video/video.js @@ -58,14 +58,18 @@ export class Video { */ async stop(url) { this.isRecording = false; - this.videoPath = join( - this.storageManager.directory, - pathToFolder(url, this.options), - 'video', - this.index + '.mp4' - ); - await this.setupDirs(this.index, url); - return this.recorder.stop(this.videoPath); + if (url === undefined) { + return this.recorder.stop(this.videoPath); + } else { + this.videoPath = join( + this.storageManager.directory, + pathToFolder(url, this.options), + 'video', + this.index + '.mp4' + ); + await this.setupDirs(this.index, url); + return this.recorder.stop(this.videoPath); + } } async cleanup() {