From 4143f7ef2f3de8a129b9933d682290ddf99648f9 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Fri, 20 Dec 2024 16:05:59 -0330 Subject: [PATCH] WIP --- .circleci/config.yml | 2 +- test/e2e/mv3-perf-stats/init-load-stats.js | 84 +++++++++++----------- test/e2e/mv3-stats.js | 78 ++++++++++---------- 3 files changed, 78 insertions(+), 86 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5598e6450cfe..c0e6ce962f68 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1427,7 +1427,7 @@ jobs: name: Move test zips to builds command: mv ./builds-test ./builds - run: - name: Run page load benchmark + name: Initialize test artifact directories command: | mkdir -p test-artifacts/chrome/ cp -R development/charts/flamegraph test-artifacts/chrome/initialisation diff --git a/test/e2e/mv3-perf-stats/init-load-stats.js b/test/e2e/mv3-perf-stats/init-load-stats.js index 40584343d990..b18bfa4fbd14 100755 --- a/test/e2e/mv3-perf-stats/init-load-stats.js +++ b/test/e2e/mv3-perf-stats/init-load-stats.js @@ -20,52 +20,48 @@ const FixtureBuilder = require('../fixture-builder'); async function profilePageLoad() { const parsedLogs = {}; - try { - await withFixtures( - { - fixtures: new FixtureBuilder().build(), - disableServerMochaToBackground: true, - }, - async ({ driver }) => { - await driver.delay(tinyDelayMs); - await driver.navigate(); - await driver.delay(1000); - const logs = await driver.checkBrowserForLavamoatLogs(); + await withFixtures( + { + fixtures: new FixtureBuilder().build(), + disableServerMochaToBackground: true, + }, + async ({ driver }) => { + await driver.delay(tinyDelayMs); + await driver.navigate(); + await driver.delay(1000); + const logs = await driver.checkBrowserForLavamoatLogs(); - let logString = ''; - let logType = ''; + let logString = ''; + let logType = ''; - logs.forEach((log) => { - if (log.indexOf('"version": 1') >= 0) { - // log end here - logString += log; - parsedLogs[logType] = JSON.parse(`{${logString}}`); - logString = ''; - logType = ''; - } else if (logType) { - // log string continues - logString += log; - } else if ( - log.search(/"name": ".*app\/scripts\/background.js",/u) >= 0 - ) { - // background log starts - logString += log; - logType = 'background'; - } else if (log.search(/"name": ".*app\/scripts\/ui.js",/u) >= 0) { - // ui log starts - logString += log; - logType = 'ui'; - } else if (log.search(/"name": "Total"/u) >= 0) { - // load time log starts - logString += log; - logType = 'loadTime'; - } - }); - }, - ); - } catch (error) { - console.log('Error in trying to parse logs.'); - } + logs.forEach((log) => { + if (log.indexOf('"version": 1') >= 0) { + // log end here + logString += log; + parsedLogs[logType] = JSON.parse(`{${logString}}`); + logString = ''; + logType = ''; + } else if (logType) { + // log string continues + logString += log; + } else if ( + log.search(/"name": ".*app\/scripts\/background.js",/u) >= 0 + ) { + // background log starts + logString += log; + logType = 'background'; + } else if (log.search(/"name": ".*app\/scripts\/ui.js",/u) >= 0) { + // ui log starts + logString += log; + logType = 'ui'; + } else if (log.search(/"name": "Total"/u) >= 0) { + // load time log starts + logString += log; + logType = 'loadTime'; + } + }); + }, + ); return parsedLogs; } diff --git a/test/e2e/mv3-stats.js b/test/e2e/mv3-stats.js index 2dd24791e9a5..9db6911c8431 100755 --- a/test/e2e/mv3-stats.js +++ b/test/e2e/mv3-stats.js @@ -20,49 +20,45 @@ const FixtureBuilder = require('./fixture-builder'); async function profilePageLoad() { const parsedLogs = {}; - try { - await withFixtures( - { fixtures: new FixtureBuilder().build() }, - async ({ driver }) => { - await driver.delay(tinyDelayMs); - await driver.navigate(); - await driver.delay(1000); - const logs = await driver.checkBrowserForLavamoatLogs(); + await withFixtures( + { fixtures: new FixtureBuilder().build() }, + async ({ driver }) => { + await driver.delay(tinyDelayMs); + await driver.navigate(); + await driver.delay(1000); + const logs = await driver.checkBrowserForLavamoatLogs(); - let logString = ''; - let logType = ''; + let logString = ''; + let logType = ''; - logs.forEach((log) => { - if (log.indexOf('"version": 1') >= 0) { - // log end here - logString += log; - parsedLogs[logType] = JSON.parse(`{${logString}}`); - logString = ''; - logType = ''; - } else if (logType) { - // log string continues - logString += log; - } else if ( - log.search(/"name": ".*app\/scripts\/background.js",/u) >= 0 - ) { - // background log starts - logString += log; - logType = 'background'; - } else if (log.search(/"name": ".*app\/scripts\/ui.js",/u) >= 0) { - // ui log starts - logString += log; - logType = 'ui'; - } else if (log.search(/"name": "Total"/u) >= 0) { - // load time log starts - logString += log; - logType = 'loadTime'; - } - }); - }, - ); - } catch (error) { - console.log('Error in trying to parse logs.'); - } + logs.forEach((log) => { + if (log.indexOf('"version": 1') >= 0) { + // log end here + logString += log; + parsedLogs[logType] = JSON.parse(`{${logString}}`); + logString = ''; + logType = ''; + } else if (logType) { + // log string continues + logString += log; + } else if ( + log.search(/"name": ".*app\/scripts\/background.js",/u) >= 0 + ) { + // background log starts + logString += log; + logType = 'background'; + } else if (log.search(/"name": ".*app\/scripts\/ui.js",/u) >= 0) { + // ui log starts + logString += log; + logType = 'ui'; + } else if (log.search(/"name": "Total"/u) >= 0) { + // load time log starts + logString += log; + logType = 'loadTime'; + } + }); + }, + ); return parsedLogs; }