Commit graph

85 commits

Author SHA1 Message Date
Nikki Nikkhoui
f16c46dcb0 api-testing: Remove 'matched_title' check
Sqlite and MySQL are returning results in different
orders for the REST Search handler, which affects how it handles
de-duplicating results with redirects.

If the Redirect Target is processed first, the matched_title
field is not populated because that page is not a redirect.
If the Redirect Source is processed first, the matched_title
field IS populated because that page is a redirect.

Either way, we don't have duplicate results (which is the most
important part). Until the logic is consistent, remove the
matched_title check.

Bug: T302706
Change-Id: Ic3977655565aa9f6d6c184749706273b0315b7be
2022-02-28 19:45:18 +00:00
Kosta Harlan
dc828c4aae
api-testing: Run all jobs in a few more tests
Follows-Up: I126d14d552eb060aba6c91764ea54092da7aff21
Change-Id: I4f9a2f16ed0472c27cced2235473837d4499ec8c
2022-02-22 09:26:37 +01:00
jenkins-bot
85e2a07fe6 Merge "Revert "api-testing: Skip flaky bot edit revert test"" 2022-02-21 15:19:44 +00:00
Kosta Harlan
03c070d467
api-testing: Disable failing contributions count tests
Partial revert of I0e30fdb6acba85cec4bb1499f7063ba6bfb0ffb2;
re-application of I3e1fe5e8112e3b1d487c46bc7fd8f924d65ce7fa and
I8f7b5e9257c7f283ded1a61e41d9e344f5cea67d

Bug: T301100
Change-Id: I90bea3fda48efdc7e915908d00535df220c4cc69
2022-02-16 16:30:56 +01:00
daniel
0ebf7786b1 DeferredUpdates: Introduce $wgForceDeferredUpdatesPreSend
Enabling this setting will cause post-send deferred updates to be run
before a response is sent to the client, so the client can observe all
effects of their last request immediately.

This resolves a problem with some end-to-end tests that were failing
because the updates caused by one request had not landed in the database
by the time the subsequent request was made.

This patch re-enabled some e2e tests that were disabled because of this
problem. If $wgForceDeferredUpdatesPreSend works as intended, the tests
should again pass reliably.

Bug: T230211
Bug: T301100
Change-Id: I0e30fdb6acba85cec4bb1499f7063ba6bfb0ffb2
2022-02-15 19:49:14 +01:00
jenkins-bot
a9658e06b5 Merge "api-testing: Run all jobs after edit in Watchlist.js" 2022-02-15 09:15:45 +00:00
Kosta Harlan
8197a4e5f6
api-testing: Run all jobs after edit in Search.js
Change-Id: I126d14d552eb060aba6c91764ea54092da7aff21
2022-02-11 10:59:41 +01:00
Kosta Harlan
d01950a57d
api-testing: Run all jobs after edit in Watchlist.js
See
https://integration.wikimedia.org/ci/job/mediawiki-quibble-apitests-vendor-php72-docker/28585/console
for a build failure where the watchlist query didn't return a result.

Change-Id: I891668e9daf92286d2cf8f98b9aab72f56c57d78
2022-02-10 14:03:57 +01:00
Ed Sanders
9e234e6a37 eslint: Only apply client rules to client files
Change-Id: I757b9616ce69b6020e9f0e556e006d39de59eb01
2022-02-09 02:40:11 +00:00
jenkins-bot
730b6ee3a7 Merge "api-testing: Skip flaky contributions count test" 2022-02-08 17:57:58 +00:00
jenkins-bot
07a36a3ca8 Merge "Add matched_title field to /search/page results" 2022-02-08 15:56:50 +00:00
Nikki Nikkhoui
9805798a21 Add matched_title field to /search/page results
Add a field to the response object of the REST
endpoint /search/page to display the title of the page
that the given page is a redirect to, or null if
the page is not a redirect.

Bug: T296671
Change-Id: I6673d50e8eae822455972403c82ec33e6ffce5dd
2022-02-08 10:18:46 -05:00
Kosta Harlan
9858e67baa
api-testing: Skip flaky contributions count test
Follows-Up: I8f7b5e9257c7f283ded1a61e41d9e344f5cea67d
Bug: T301100
Change-Id: I3e1fe5e8112e3b1d487c46bc7fd8f924d65ce7fa
2022-02-08 15:29:03 +01:00
Kosta Harlan
4075ed5ee5
api-testing: Skip flaky test
Bug: T301100
Change-Id: I8f7b5e9257c7f283ded1a61e41d9e344f5cea67d
2022-02-07 09:37:50 +01:00
Kosta Harlan
c5ba14f8cf api-testing: Disable flaky test
Bug: T285649
Change-Id: Ib13f81715c3bfcc4232d6a17da86a9e6d7e7f347
2022-02-02 13:52:07 +01:00
Kosta Harlan
b3fb341423 api-testing: Add wiki.runAllJobs() for two more tests
Bug: T285649
Change-Id: I4b770577b711c368541f4e7e53fe6e25bf26aa78
2022-02-02 13:50:39 +01:00
Hashar
b94cc17917 Revert "api-testing: Skip flaky bot edit revert test"
This reverts commit 0d41717c4b.

Reason for revert: the test fails when using Apache in CI instead
of the php built-in webserver.

Bug: T298514
Change-Id: Id47b469eb2698a80167665bba0b66a0b5d9308cd
2022-01-19 12:27:01 +01:00
Kosta Harlan
4874825d1a api-testing: Run jobs for tests dependent on deferred updates (part II)
Follows-Up: Ia9fd617ef02de57b82c5a7250b586d37bb2687b3
Bug: T285649
Change-Id: I6860b818f2690eec0904f24da6e1bdb878a068c1
2022-01-12 11:34:22 +01:00
Kosta Harlan
d269ef695e api-testing: Combine two dependent tests into one
The assertion made in the second it() statement depends on what happens
in the previous one, so combine these into a single test.

Bug: T298735
Change-Id: I120971bf747797de18ab0fdf71c16b7f520488a5
2022-01-07 13:58:13 +01:00
Kosta Harlan
9f87887e95 api-testing: Run jobs for tests dependent on deferred updates
Bug: T285649
Change-Id: Ia9fd617ef02de57b82c5a7250b586d37bb2687b3
2022-01-07 12:38:49 +01:00
Kosta Harlan
0d41717c4b api-testing: Skip flaky bot edit revert test
Bug: T298514
Change-Id: I711fbc644872d9ed2902067dc30c1766665d3e99
2022-01-04 14:02:12 +01:00
Ed Sanders
9fe2995989 build: Update eslint-config-wikimedia to 0.21.0
* Replace `substr`/`substring` with `slice`. The second argument
  to `substring` is length, not end index as in `substr`/`slice`,
  so convert where necessary.
* Replace `new Date().getTime()` with `Date.now()`
* Documentation fixes
* Replace `throw Error` with `throw new Error`

Change-Id: I532500ea4c99d8ebec01efb21273c8df21626e59
2021-11-09 21:08:55 +00:00
James D. Forrester
c2b52ea1fb api-testing: Adjust DiffCompare expected outcome to cope with new wikidiff2 output
The library now adds 'diff-side-added' and 'diff-side-deleted'.

Bug: T292676
Depends-On: If4bc60c35403799de4e330103d8aaa6f039d96fe
Change-Id: Id92aee4029f008402d9d331876c81fe2263580a7
2021-10-06 22:30:15 +00:00
Fomafix
213d45e5dd Make first char of username in ApiQueryAllUsers case-insensitive
This change uses $contentLanguage->ucfirst( $name ) to get the
canonical username like this is done in UserNameUtils::getCanonical().
This makes the first character case-insensitive. The toUpperCase() in
JavaScript is not needed anymore.

toUpperCase() in JavaScript and $contentLanguage->ucfirst() in PHP
differ on some characters:
* JavaScript: "ß".toUpperCase() // "SS"
* PHP: $contentLanguage->ucfirst( "ß" ) // "ß"

Bug: T291339
Change-Id: Id9afb2dd0212e4b871bb6a7a9d8762e1bcb81d6a
2021-09-21 06:21:21 +00:00
daniel
d55f361a5b Add more end-to-end tests related to page protection
This covers:
* cascading protection
* unprotecting a page

Bug: T218395
Change-Id: I7639930e379256f720f864c758b1735a0cfa04c9
2021-08-28 17:59:29 +02:00
daniel
23aa8db51f Improve structure of e2e tests for page protection.
This does not change any tests, it just adds nested "describes"
structures and improves descriptions.

Change-Id: I3b5628405b97e784b05337ea22b9878dc63ab26d
2021-08-28 17:52:57 +02:00
TChin
eac9174eb3 Added integration tests for ApiQueryExternalLinks
Bug: T286498
Change-Id: Ie97a517968a498de5b2d282a9e30027c2462d450
2021-07-16 16:30:21 -04:00
daniel
b38e0e8e32 REST edit: handle null edits correctly
For null-edits, the new revision is the same as the old revision.

Bug: T277601
Change-Id: I73f902f7ef890470ff6ee3e4500095adbb00938a
2021-03-19 14:10:25 +01:00
James D. Forrester
5a622b6a2e build: Upgrade eslint-config-wikimedia from 0.17.0 to 0.18.1
Change-Id: I5e3687be2b197134578126e1b890ee37dbc1bc1b
2021-02-18 08:39:09 -08:00
Kosta Harlan
9445358f6e Avoid Promise.all when creating users to prevent deadlock
See also I884ca6e15a1

Bug: T199393
Change-Id: I3d0a8c3896e7879bc48e251beb26b41a328b71d0
2021-01-05 14:13:07 +00:00
daniel
fa8ddd48fc Implement /revision/{id} endpoint
Also implements and endpoint for revision source,
for parity with /page/{title}.

Bug: T267981
Change-Id: I88c714df6e428fbc02aa4ff7f4ecea7d8b458468
2020-12-14 16:54:43 +00:00
daniel
a4b51d2774 Implement /revision/{id}/html endpoint
This doesn't have caching yet.

Bug: T267981
Change-Id: I32a35bb7bc6c6832ce7c79fb942922abc1ddb0e0
2020-12-14 16:54:35 +00:00
daniel
36127ffd9d ApiOptions: log when userjs-* option changes
Bug: T259073
Change-Id: I99b9f224d3c0c21ef22a0ffa98ad2f72bf300943
2020-09-15 16:50:03 +02:00
Nikki Nikkhoui
783258900f UserContribs tags prop as array
Make the tags property in each contribution in
the User Contributions REST endpoint an array of tag
objects (instead of a key/value pair mapping tag names
to tag properties).

Bug: T259716
Change-Id: I8265ded81f05fef5f88d5a565266f91a307dd38c
2020-08-25 22:31:17 +00:00
Nikki Nikkhoui
c26d64fc18 UserContributions endpoint add tags 'display' property
Add a property to the 'tags' object in the /user/{name}/contributions
REST endpoint named 'display' which shows the display
HTML for the tag which is either defined in i18n .json
files or overriden at MediaWiki:tag-$name

Bug: T259716
Depends-On: I57e2a7253944a3fde3f52f52bbf5fe8473c8a415
Change-Id: Id755adcab8b0115e19df2a6046643ebe97881e28
2020-08-19 06:04:50 -07:00
Nikki Nikkhoui
c0f4b8a1eb Make array of tags with property 'text'
Change the tag property on each contribution from an
array of strings to an array of objects with property
'text'.

Bug: T252202
Bug: T235073
Change-Id: I9ececd1f351600e3e0fd54be2fb34449898285e1
2020-08-06 07:35:29 -07:00
jenkins-bot
8991f53965 Merge "REST /page/{title}: Fix title encoding." 2020-07-28 19:09:48 +00:00
Nikki Nikkhoui
3ba476102d /contributions/user/{user}/count
REST Endpoint for getting the number of contributions for a given
user (not yourself).

Change-Id: Ib3bfedcec0aa1af1983cec0a7bda28fc49ddc673
2020-07-28 18:36:41 +00:00
daniel
d2d2906ce7 REST /page/{title}: Fix title encoding.
Page titles used in URL paths, such as the Location header returned
after a page was created, must use the correct encoding for spaces and
pluses.

Bug: T258606
Change-Id: I75e91ac8f8da4eb183a9c8f1a682ea08c2225227
2020-07-23 23:17:17 +02:00
Nikki Nikkhoui
43f2d5440f Rename 'revisions' to 'contributions'
Extensions have the ability to inject their own idea of what
a contribution is into the ContribsPager query resultset (via
the ContribsPager__reallyDoQueryHook). Because of this,
stable chronological ordering of ContribsPager results
becomes virtually impossible

For the purpose of the User Contribution REST endpoints, we will
restrict the resultset to ONLY mediawiki revisions for now.

This patch renames 'revisions' to 'contributions' and adds the
'type' field to future-proof work on adding different kinds of
contributions to the User Contribution REST endpoints.

Bug: T257838
Change-Id: I1e6de1c14a5f47e0310df86325fa6d791833addb
2020-07-22 18:29:29 +02:00
Ostrzyciel
435d5f4d55 Add mw-manual-revert change tag
Based on the patch that introduces manual revert detection, this is
to create a software-defined change tag that will be applied to all
edits that restore a page to an exact previous state. This is also
for consistency with mw-undo and mw-rollback that will make a
"reverted" tag appear on reverted edits in the future.

Note about the REST API tests: in the next patch in this chain
I encountered even more issues with comparing returned changed tags
with expectations, so I decided it'd better if we just checked the
change tags applied manually in these tests. Otherwise we can run into
nasty race conditions, as the reverted tag is processed after sending
the response to client in the deferred update. It also makes the test
hard to maintain.

Bug: T256001
Change-Id: Ic367886f39faedcb823222b7d63bf4d5cb236ae9
2020-07-16 13:29:12 +02:00
Nikki Nikkhoui
764fd295c4 ActionAPI Tag end to end test
Create initial test for action api action=tag
end to end test.

Bug: T256826
Change-Id: I7b4f43112534efd7258cf1368d198fbe4bdef7d8
2020-07-14 13:16:52 -07:00
daniel
7717db62e1 REST /user/{name}/contribs
Bug: T235073
Change-Id: Ia262d055185c20142629d0824e4ba14a5e5fa9d3
2020-07-09 12:34:52 -07:00
daniel
afdcacbfd5 REST /me/contributions/count filter by tag
Bug: T251806
Change-Id: Ib071ebb91f20a0ca1c0e14b4a271fc17f343a648
2020-07-06 19:56:17 +02:00
daniel
c1a73e64e1 REST me/contributions/count endpoint
Introduce endpoint for getting a uer's contribution count.

Bug: T251805
Change-Id: I409b7943941437f46dd8cdb2194fca9b7404f185
2020-07-06 09:28:33 +00:00
daniel
2cf5a251b9 me/contributions: filter by tag
Bug: T251803
Change-Id: I5ba4164abe414df4b24858422f2a601e00516d7f
2020-07-02 22:27:21 +02:00
daniel
01b959fb83 UserContributions endpoint: return deltas
Bug: T252202
Change-Id: Ie38c658bddb974ded85a532b2fc556af5706275e
2020-06-26 11:44:57 +02:00
jenkins-bot
038f57ec69 Merge "REST /me/contributions: return change tags" 2020-06-25 18:03:14 +00:00
Nikki Nikkhoui
7452d8c067 REST /me/contributions: return change tags
The endpoint for user contributions should include change tags in the
result. Bump the version of npm module api-testing.

Bug: T252202
Change-Id: Iccc0c378bc65d0f34b38557f4c78f424d95a951f
2020-06-25 19:28:02 +02:00
Ed Sanders
c7926a58d6 api-testing: Fix variable scopes to avoid shadowing
Change-Id: I3ba5e9bd98c0e66c7e4050ca5c9f0320042149d7
2020-06-24 13:21:36 +01:00