wazuh-dashboard/.lighthouserc.js
Ruchi Sharma 6cf85af7b8
Lighthouse performance metrics setup (#9304)
* lighthouse performance metrics setup

Signed-off-by: Ruchi Sharma <ruchi492@gmail.com>

---------

Signed-off-by: Ubuntu <ubuntu@ip-172-31-47-220.us-west-2.compute.internal>
Signed-off-by: Ruchi Sharma <ruchi492@gmail.com>
Co-authored-by: Ubuntu <ubuntu@ip-172-31-47-220.us-west-2.compute.internal>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
2025-03-20 13:28:34 -07:00

101 lines
2.9 KiB
JavaScript

/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
const fs = require('fs');
const baseline = JSON.parse(fs.readFileSync('baselines/lighthouse_baseline.json', 'utf8'));
const baseUrl = 'http://localhost:5601';
module.exports = {
ci: {
collect: {
url: [
`${baseUrl}/app/home`,
`${baseUrl}/app/dashboards#/view/722b74f0-b882-11e8-a6d9-e546fe2bba5f`,
`${baseUrl}/app/data-explorer/discover`,
`${baseUrl}/app/visualize`,
], // Add more URLs as needed
startServerCommand: 'yarn start --no-base-path',
numberOfRuns: 1,
settings: {
chromePath: require('puppeteer').executablePath(),
chromeFlags: '--no-sandbox --disable-gpu --headless',
formFactor: 'desktop', // This will enforce the desktop view
viewport: {
width: 1280, // Optional: Set a specific width
height: 800, // Optional: Set a specific height
},
screenEmulation: {
// Disable mobile emulation
disabled: true,
},
},
},
assert: {
assertMatrix: [
{
matchingUrlPattern: '/app/home',
assertions: {
'first-contentful-paint': [
'warn',
{
maxNumericValue: baseline['/app/home']['first-contentful-paint'],
},
],
'speed-index': ['warn', { maxNumericValue: baseline['/app/home']['speed-index'] }],
},
},
{
matchingUrlPattern: '/app/data-explorer/discover',
assertions: {
'first-contentful-paint': [
'warn',
{
maxNumericValue: baseline['/app/data-explorer/discover']['first-contentful-paint'],
},
],
'speed-index': [
'warn',
{ maxNumericValue: baseline['/app/data-explorer/discover']['speed-index'] },
],
},
},
{
matchingUrlPattern: '/app/visualize',
assertions: {
'first-contentful-paint': [
'warn',
{
maxNumericValue: baseline['/app/visualize']['first-contentful-paint'],
},
],
'speed-index': ['warn', { maxNumericValue: baseline['/app/visualize']['speed-index'] }],
},
},
{
matchingUrlPattern: '/app/dashboards',
assertions: {
'first-contentful-paint': [
'warn',
{
maxNumericValue: baseline['/app/dashboards']['first-contentful-paint'],
},
],
'speed-index': [
'warn',
{ maxNumericValue: baseline['/app/dashboards']['speed-index'] },
],
},
},
],
},
},
upload: {
target: 'temporary-public-storage', // Required for GitHub integration
githubStatusCheck: false,
},
};