Which field should I be using? I would post the response here but itās too longā¦ Help would be greatly appreciated!
As a rant, I think the challenge is great but the documentation about 3rd party libraries or APIs is a bit lackluster.
EDIT: found the answer.
By digging deeper into the docs of the pagespeed API (Get Started with the PageSpeed Insights API Ā |Ā Google Developers), with some trial and error, and even establishing a mock server to avoid exceeding quota for Page Speed requests, I was able to find the correct field: lighthouseResult.categories.performance.score, at line 1409. And unlike stated in the documentation, the score goes from 0 to 1.0, not from 0 to 100.
Dear all,
I think there is an alternative to @pnt12 solution. However I had a syntax issue in Postman.
Metrics contribute to the lighthouse performance score.
Here we are focused on those six metrics:
1.first-contentful-paint
2.speedIndex
3.largest-contentful-paint
4.time to interactive
5.total-blocking-time
6.cumulative-layout-shift
To calculate the performance score, we can apply the weighted average score to each metric score. The calculator can be checked for Weighting.
However I donāt pass through this error :
var speedIndex = JSON.stringify(jsonData.lighthouseResult[āspeed-indexā][āscoreā]);
There is a error in postman while trying to access each metric score.
Can someone help ?
Hi i have done the Day 28 challenge i couldnāt find out the performance score ranges from 90 -100 rather i could see categories-performance-score = 1.is that one is right one we need to check ?
pm.test(āYour test nameā, function () {
var jsonData = pm.response.json();
score=jsonData.lighthouseResult.categories.performance.score;
console.log(score);
if (score<=1)
{
pm.test('The score lies between 0 and 1', function() {
// check here
});
} else {
pm.test('the score is greater than 1', function() {
// check here
});
}
// pm.expect(jsonData.score).to.eql(0.98);
});
When i execute the script its passes whether my script is right or wrong whether i need to consider different metric score can anyone suggest me thank you very much .