Upload - Assertion failure for assertions with level error not actual checking passed value
See original GitHub issueDescribe the bug When uploading assertion results to LHCI server. It is incorrectly setting the github status check and marking it as failed.
Looking at the code It is checking for ‘error’ level
but then not checking the actual passed
parameter. So it seems that if any assertions set to error will always fail the Github status check.
To Reproduce Steps to reproduce the behavior:
- Collect tests
- Audit Tests
- Upload Tests with GithubToken
- See Error
Expected behavior When the assertion is marked as not passed then it should mark the github status as failed. Not just because it’s been set as an error level assertion.
Logs/Screenshots If applicable, add LHCI logs or screenshots to help explain your problem.
+ ls .lighthouseci
assertion-results.json
lhr-1615540607976.html
lhr-1615540607976.json
lhr-1615540612869.html
lhr-1615540612869.json
lhr-1615540617782.html
lhr-1615540617782.json
+ cat .lighthouseci/assertion-results.json
[
{
"name": "minScore",
"expected": 0.98,
"actual": 0.99,
"values": [
0.99,
0.99,
0.99
],
"operator": ">=",
"passed": true,
"auditProperty": "performance",
"auditId": "categories",
"level": "error",
"url": "http://run-server:5000/"
},
{
"name": "minScore",
"expected": 0.95,
"actual": 1,
"values": [
1,
1,
1
],
"operator": ">=",
"passed": true,
"auditId": "cumulative-layout-shift",
"level": "warn",
"url": "http://run-server:5000/",
"auditTitle": "Cumulative Layout Shift",
"auditDocumentationLink": "https://web.dev/cls/"
},
{
"name": "minScore",
"expected": 0.95,
"actual": 1,
"values": [
1,
1,
1
],
"operator": ">=",
"passed": true,
"auditId": "first-contentful-paint",
"level": "warn",
"url": "http://run-server:5000/",
"auditTitle": "First Contentful Paint",
"auditDocumentationLink": "https://web.dev/first-contentful-paint/"
},
{
"name": "minScore",
"expected": 0.95,
"actual": 1,
"values": [
1,
1,
1
],
"operator": ">=",
"passed": true,
"auditId": "interactive",
"level": "warn",
"url": "http://run-server:5000/",
"auditTitle": "Time to Interactive",
"auditDocumentationLink": "https://web.dev/interactive/"
},
{
"name": "minScore",
"expected": 0.95,
"actual": 0.97,
"values": [
0.97,
0.97,
0.97
],
"operator": ">=",
"passed": true,
"auditId": "largest-contentful-paint",
"level": "warn",
"url": "http://run-server:5000/",
"auditTitle": "Largest Contentful Paint",
"auditDocumentationLink": "https://web.dev/lighthouse-largest-contentful-paint/"
},
{
"name": "minScore",
"expected": 0.95,
"actual": 1,
"values": [
1,
1,
1
],
"operator": ">=",
"passed": true,
"auditId": "speed-index",
"level": "warn",
"url": "http://run-server:5000/",
"auditTitle": "Speed Index",
"auditDocumentationLink": "https://web.dev/speed-index/"
},
{
"name": "minScore",
"expected": 0.95,
"actual": 1,
"values": [
1,
1,
1
],
"operator": ">=",
"passed": true,
"auditId": "total-blocking-time",
"level": "warn",
"url": "http://run-server:5000/",
"auditTitle": "Total Blocking Time",
"auditDocumentationLink": "https://web.dev/lighthouse-total-blocking-time/"
}
]+ npm run test:perf:upload -- --githubToken=$GITHUB_TOKEN
> @domain-internal/cypress@0.0.0-377 test:perf:upload /drone/src/github.domain.net/web-engineering/cypress
> lhci upload "--githubToken={{GITHUB_TOKEN}}"
Saving CI project cypress (78b524fa-0249-4c64-a084-82f6b61c5e56)
Saving CI build ({{BUILDTOKEN}})
Saved LHR to https://lighthouse-ci.domain.io/ (a754f305-4152-4ab7-89f6-d8f1228f6293)
Saved LHR to https://lighthouse-ci.domain.io/ (f547531f-38cc-4ae5-9b3c-149b6fc7a522)
Saved LHR to https://lighthouse-ci.domain.io/ (54ebf667-27a4-48bb-afa1-6ff8849c8257)
Done saving build results to Lighthouse CI
View build diff at https://lighthouse-ci.domain.io/app/projects/cypress/compare/{{BUILD_TOKEN}}
GitHub token found, attempting to set status...
GitHub accepted "failure" status for "lhci/url/".
Environment (please complete the following information):
- OS: Linux
- Browser chrome
- Version [Chrome: 89.0.4389.82, LighthouseCI: 0.7.0]
Additional context Will raise a PR with a suitable fix.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to Use JMeter Assertions in Three Easy Steps
JMeter assertions are undeniably valuable, providing the criteria you set to determine whether the a will be considered a “pass.
Read more >Python's assert: Debug and Test Your Code Like a Pro
In this tutorial, you'll learn how to use Python's assert statement to document, debug, and test code in development.
Read more >java - Assertions handling giving different result in "console ...
I have created a Listener class to validate the result and perform test. But after execution this test should fail and which is...
Read more >How to use Assert and Verify in Selenium WebDriver
Assert in Selenium WebDriver lets you validate the test scenarios and throw an assert if the specified condition is not met.
Read more >Automating Response Validation With Assertions In Postman
This tutorial explains the concept of assertions and tests in Postman requests. This is a powerful feature to create really robust & fast ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@metalix2 right now 😃 fixed by #595 , publishing as we speak
Well it took a day of fixing some release script dependency issues, lol, but published in 0.7.2 😃