Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Gudahtt committed Dec 20, 2024
1 parent a02799d commit 4143f7e
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
84 changes: 40 additions & 44 deletions test/e2e/mv3-perf-stats/init-load-stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
78 changes: 37 additions & 41 deletions test/e2e/mv3-stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 4143f7e

Please sign in to comment.