web: mute Polly.js error logging on CI
Created by: valerybugakov
Context
Removing logs from Polly.js to unclutter out integration test logs.
Details
- We mock GraphQL request responses in integration tests.
- If a request is initiated and there's no mock for it, we throw an error.
- Some GraphQL API requests initiated by the page are not required for an integration test to pass. (e.g., they do not critically affect the UI checked by the test)
- If they are initiated after an integration test has already passed, the missing-mock error won't affect the test status. But it will be logged into the integration test output by Polly.js.
- Polly.js
logging: false
does not work correctly on our current Polly.js version. That's why these errors are visible in the output. - Upgrading Polly.js to the next major version where this issue is fixed is not feasible because the scope of the task is too big, and we need to do it separately.
- Some
console
methods were patched in this PR to remove Polly.js logs. - These logs are removed on CI only to keep all the information available for local development. See why it's important in the next section.
Ideally, we want all GraphQL requests used by the page opened during the integration test to be mocked. But there's no way to enforce this rule with the existing driver implementation. We will be able to address this issue fully next quarter when we will look at our integration tests fundamentals.
Before | After |
---|---|
Partially addresses https://github.com/sourcegraph/sourcegraph/issues/37666. Follow up that closes the issue https://github.com/sourcegraph/sourcegraph/pull/38470.
Flaky missing GraphQL overrides
- Sometimes, GraphQL requests not affecting integration test execution are initiated after the test is passed.
- Sometimes, they do not. That's when a missing-mock error will cause the test to fail.
- Boom, we got a flake!
- To debug it locally, we need to inspect missing-mock errors thrown after test completion, so preserving all logs locally is helpful.
Test plan
- Ensure that there are no
GraphQL query "XXX" has no configured mock response
errors in integration tests output on CI. - See some log examples here.
App preview:
Check out the client app preview documentation to learn more.