Skip to content

CI fails with screenshot canvas bad state during Percy snapshot taking

Created by: vovakulikov

Seems like in this PR https://github.com/sourcegraph/sourcegraph/pull/28534 we introduced a workaround for proper rendering images in Percy. But it turned out this solution doesn't work well for png images on the page. (at least it didn't work for me on the Code Insights creation intro page)

I run into this problem on CI https://buildkite.com/sourcegraph/sourcegraph/builds/120937#754e4191-da7e-4ef1-84ec-e47b189271b2

 Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The HTMLImageElement provided is in the 'broken' state.

The problem comes from this integration test https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/client/web/src/integration/insights/create-insights.test.ts?L50:12&subtree=true

It seems like the problem appears because of this method for converting images to data:image format through canvas API.

https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/client/web/src/integration/utils.ts?L50:14&subtree=true

For now, in https://github.com/sourcegraph/sourcegraph/pull/28460 I added skip-percy data attribute to avoid this problem.