Current RESTBase tests for the endpoints powering VE are already written in a fashion very similar to what api-testing tool is doing. In order to make changes with confidence, we can convert relevant tests into api-testing framework and reuse them when building PHP infrastructure for VE.
Description
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Stalled | None | T324931 Clean up open RESTBase related tickets | |||
In Progress | None | T262315 <CORE TECHNOLOGY> API Migration & RESTBase Sunset | |||
Open | None | T264669 Move VE API from RESTBase into core. | |||
Open | None | T265846 Turn RESTBase tests for /html and /transform endpoints into api-testing integration tests |
Event Timeline
This is going to be an experiment to figure out if this is viable. In the beginning, let's try tests/features/transform/transform.js
These tests are integration tests and they rely on the fact that some pages exist on beta wiki. For now we should just keep those pages hard-coded - in future we will start using api-testing lib to create these pages on demand, after we move these tests into MW.
api-testing is heavily geared towards testing MediaWiki, so we might need to put some bogus unused configuration in there to satisfy it. The changes pretty much would be switching existing tests from using preq for HTTP requests to using api-testing machinery for HTTP requests.
I'm not yet sure this is a viable and valuable idea, let's see how it goes with the first file converted.
I have pushed a PR for this task here where I was able to replace preq with the api-testing REST client within 11 out of 13 tests.
The two tests that are failing when I switch them to client.post are;
- The html2wt with scrub_wikitext test fails with error 400 whenever the scrub_wikitext: 1 parameter is added.
- The supports stashing content test fails at the second client.post.
Could there be something I am missing that is causing these two tests to fail?
Adding Platform Engineering project tag as tasks need to be discoverable and as the current PET Clinic Duty tag got archived in T266534