Closed birkskyum closed 1 year ago
Ah, okay - I thought it was possible to propose any bounty size now. I'd prefer to keep the this perfectly confined issue instead of splitting it up solely to accommodate the bounty system, as it's hard to find good logical boundaries of this work. If it solves the problem, I won't mind a 3k bounty.
Made an extra void issue too as requested that can be used for this.
The main point of another issue is to split the work so that part of it can be delivered and rewarded separately, sorry if that wasn't clear.
For example this issue which was partially referenced here: https://github.com/maplibre/maplibre-gl-js/issues/2411
I changed the other issue to be the swap of Playwright to Puppeteer, because it's the only step I think can be taken separately without leaving the codebase in a broken state. #2481
I also added a separate issue for splitting out render tests to a separate workflow, as it's also possible to do separately #2482
I don't see how this can be split further without reaching a strange intermediate state where tests doesn't pass.
Assigning bounty XL. Bounty direction: https://github.com/maplibre/maplibre/issues/192 Requires:
As part of this issue there's a need to see if we can share the build dist results between workflows to reduce a few minutes more in the CI. If this is big, we can split to another issue, but the goal is to keep the CI at around 10-15 minutes.
It's of course good to free up runners faster, by avoiding duplicate work, but unless some of the test workflows are queued due to a lack of runners, I can't see how it would reduce the overall runtime because the build-dist processes run in parallel.
You have a point there... My mistake.
Can I start this task? There is a lot of debugging left to do here, and decisions regarding updates of 'expected' pictures, but it'll be more clear in the draft PR what the status is.
Enjoy! :-)
Rationale
Both unit tests, integration tests and render tests currently rely heavily on the
gl
npm package, which is the undermaintained headless-gl. It rely on an unmaintained version of ANGLE, which is a distant fork of the the google repo.The
gl
package has been good enough up until now for development to run our tests in node, but unfortunately it has only WebGL 1 support, and with WebGL 2 having wide support, and WebGPU being released within a week, we need a more modern testing story. This lack of modern support has already proved problematic in pr's like #1891 , and it'll only get worse. The google ANGLE repo actually got WebGL 2 support, not to long ago, but there is slim hope that will ever be available in the ANGLE fork used by thegl
package. There has been an open WebGL 2 ticket since 2017, so I wouldn't hold my breath on that one https://github.com/stackgl/headless-gl/issues/109#issuecomment-1374537584How does the current test suites work?
Currently, our unit tests are run with Jest in a JSDOM environment. In each unit test, the first thing we call is
beforeMapTest()
, which is a lot of browser mocking code we have in/src/util/util.ts
. Part of that mocking process is creating a WebGL context, and that is where we pull in thegl
package to help us out with that.For render tests, we don't use JSDOM or
beforeMapTest
, but instead run the tests with the jest node environment, and here we additionally run the/test/integration/render/mock_browser_for_node.ts
to create all the globals like global.navigator,How could we do?
We could pull in a browser through either playwright or puppeteer, create an actual canvas, and a webgl/webgl2/webgpu context inside. This would allow us to delete all the mocking code for the integration/render tests, and have features as they get added to the evergreen browsers. The unit tests still need the mocks, because it's necessary to generate the coverage reports.