Commit graph

532 commits

Author SHA1 Message Date
Umherirrender 0463bec879 Use namespaced classes
Changes to the use statements done automatically via script

Change-Id: Ic6450685433e240a4e93ce2beec381da16587b15
2024-10-20 14:01:32 +02:00
John Bolorinos 4c3710c035 selenium: Document when, how and why a test is skipped
Bug: T280652
Change-Id: I04539a8fe9d0bcab43eeebaa1cc89f011b711376
2024-09-16 15:02:31 +02:00
Umherirrender b985813c56 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: Ia08d43b3973a12b8e0628c8552bee1c4b702f249
2024-06-10 22:36:31 +02:00
jenkins-bot 932df6759e Merge "Add type declarations and remove redundant PHPDoc tags" 2024-06-04 18:24:54 +00:00
thiemowmde 1d449787ef Add type declarations and remove redundant PHPDoc tags
Most of this code was already typed, but not everything. Using
language-level type declarations allows us to remove extra PHPDoc
blocks that just repeat the same information.

I'm also using the more narrow UserIdentity instead of User in a
few places where this is possible.

Change-Id: I7661824fcb34180af1a4fd3030fcd6c0b7d34089
2024-06-04 16:55:00 +00:00
libraryupgrader 702677220d build: Updating eslint-config-wikimedia to 0.28.0
The following rules are failing and were disabled:
* modules/ve-mw/tests:
  * implicit-arrow-linebreak

Change-Id: If857233c0de24c8cf619dbb1347ebb375f3ab1ba
2024-06-04 03:40:00 +00:00
C. Scott Ananian b91c47b1c0 Remove unused reference to ParsoidOutputAccess
Change-Id: I543a6e9da4fc473a2ac54ac635286453f2aff96a
2024-05-17 12:44:36 -04:00
thiemowmde 2216426f61 Fix empty provider in HooksTest
This was not doing anything any more after I50b20ed.

Change-Id: I5af8f9cd2f6fb94b3bb007b72417dcb7a7f67ac9
2024-02-20 12:19:49 +00:00
Umherirrender 66ac85e025 Stop writing to tablesUsed in tests
Bug: T351733
Change-Id: If99bfa771835f1738d1b88245c154a500722f8ef
2024-01-20 12:46:35 +01:00
Ed Sanders 3966573f02 build: Update ESLint to 0.26.0 and autofix
Change-Id: Ia5e15684c1c3dcd69985445a09fc4e4910368b5b
2023-11-28 11:18:09 +00:00
Arlo Breault 2c1989c338 Stop injecting ServiceOptions in VisualEditorParsoidClientFactory
Change-Id: I7a3c5ef6435a38ef136e830b343dc19166659ef0
2023-08-30 17:05:17 +02:00
Arlo Breault de2935928c Remove unused VisualEditorParsoidClientFactory options
Looks like these were introduced in b029fd8 and could have gone out in
f2bb8cf.

Bug: T341614
Change-Id: I4f77a7fabb1016864cafb15848c0199028a7b6bb
2023-08-30 14:58:55 +00:00
Daimona Eaytoy 3d63e08a02 Use getExistingTestPage consistently in DirectParsoidClientTest
testTransformHtml currently passes just because the previous test
(testGetPageHtml) calls getExistingTestPage for the same page, but it
fails when run on its own because the page doesn't exist. Make it use
getExistingTestPage consistently to fix that.

This is also needed by core change Ie2f1809d, after which all tables
will be reset between tests.

Change-Id: Id4cb4803fae0d62c695ff1d1051056062c54da82
2023-08-18 01:04:34 +00:00
jenkins-bot b65e676d80 Merge "Merge SkinTemplateNavigation::Universal hook handlers" 2023-08-16 16:03:20 +00:00
Bartosz Dziewoński ca64e7e407 ApiParsoidTrait/DirectParsoidClient: Simplify error handling
After catching the REST exception, just throw an API exception.
Remove the step inbetween where we built a response array.

Bonus:
* Remove tests that only tested this array building.
* Remove the unused 'code' from successful responses, and update
  documentation of return value shapes.
* Remove impossible check for `$ex instanceof LocalizedException`.
  After moving the code into one place, it's obvious that it can't
  happen, since LocalizedException doesn't inherit from HttpException.

Bug: T341613
Change-Id: I31370efeed9d5283b53eafca102b2f1efc811d27
2023-08-16 17:09:18 +02:00
Umherirrender 9b4c433cd8 Merge SkinTemplateNavigation::Universal hook handlers
- The code in the hook handler is more related to the hook and the
  structure of the $links array as to the special page.
- Loading another class to process the hook is not necessary.
- Allows better migration to new hook handlers (special page classes and
  hook handler should be separated).
- Replace SpecialCollabPad::getSubPage with
  SpecialPageFactory::resolveAlias.
- The local url to Special:CollabPad is now in the content language
  (only relevant for non-english wikis).

Change-Id: I82985a8ba129b4e336cee337af31452e804090b3
2023-08-15 20:39:10 +02:00
Daimona Eaytoy e3a2b537ca Do not assume that UTPage exists in ApiVisualEditorTest
Create a test page explicitly, specifying the expected content as well.

Bug: T342428
Change-Id: I5a6e211fe6d36b6bf0576d1739b7fbc2cf49495b
2023-08-07 16:33:53 +02:00
Derick Alangi 4418b61894 Remove DualParsoidClient::class and related code from VE (p.2)
I've verified that no other extension uses this code apart from VE
and locally tested that with this patch, VE still works and nothing
explodes.

There parent patch takes care of making sure the mode is no longer
injected and we now have just etags with no hacked in modes because
we now use direct mode always.

Bug: T341612
Change-Id: Ib1756bf60104467a3a34be9bbb06d8f63537e550
2023-07-25 09:01:44 +00:00
Derick Alangi daa6861f01
Remove ::injectMode(), prep to remove DualParsoidClient p.1
In order not to break clients who already have VE open with etag
that injects the "mode:direct..." in their etag, let's first stop
injecting the direct mode to subsequent VE sessions (for edits)
and wait for 24hrs+ so that we're sure we've processed all sessions
with the direct mode etag.

After 24hrs of this patch merged and going live, we'll then remove
the DualParsoidClient entirely as the p.2 of this cleanup.

Bug: T341612
Change-Id: Ie4f43089ee6f94f51fc0398e84604a17bc5bebcf
2023-07-17 11:26:47 +03:00
thiemowmde ab2cbb3b70 Change almost all code to use Bcp47Code instead of Language
This patch makes the following assumptions:

1. There is no class outside of this codebase that implements the
ParsoidClient interface. According to CodeSearch this appears to be
correct.

2. It is fine to use the Bcp47Code instead of the internal MediaWiki
language code in the "Accept-Language" HTTP header. As far as I
understand this might even qualify as a bugfix.

Depends-On: If059674597e261039df7f4613a89cb08120c3262
Change-Id: Icd160da2d5555891b9a91a0cb966bd36a55f6fdd
2023-07-12 09:38:16 +02:00
Derick Alangi f2bb8cf45d Remove VirtualRESTService code from VisualEditor
This follows the event of VE no longer using RESTBase anything. All
actions related to stashing and Parsoid and now handled in MW core.

Bug: T339227
Change-Id: I50b20ed5abb721a6ac8987cac37a6f395a4816dc
2023-07-11 19:38:05 +02:00
Ed Sanders ea03287908 Convert MWPopupTool into MWHelpListToolGroup
The popup contains three buttons, one of which already exists
in core as a tool. By converting them all to tools we can reduce
some duplication, and better integrate with other features
that use the tool factory, such as HelpCompletionAction.

Bug: T339153
Change-Id: I81d217bc1ab9a1a6a9bf7c7ad588c2a3216b10db
2023-07-01 11:10:53 +01:00
jenkins-bot 4077345c73 Merge "selenium: run tests concurrently" 2023-06-30 08:18:03 +00:00
WMDE-Fisch 70128a0f21 selenium: run tests concurrently
Especially useful to reduce the job runtime here because the VE
tests are executed in a couple of CI selenium jobs of other
extensions.

Bug: T226869
Change-Id: I8a8eae8cf2d548b7c905f00e748974bc5a88d337
2023-06-29 15:14:05 +02:00
Kosta Harlan 85c3f13c2c
selenium: Disable flaky test
See https://integration.wikimedia.org/ci/job/wmf-quibble-selenium-php74-docker/43144/consoleFull

Bug: T296187
Change-Id: Iba71488ffb10b85598461c0d85fac99cc491a69e
2023-06-21 22:07:17 +02:00
Umherirrender 60e3706f09 tests: Make PHPUnit data providers static
Initally used a new sniff with autofix (T333745)

Bug: T332865
Change-Id: Iad05a3579ec60c576c4aa99567eb3e4fa4c30550
2023-05-20 17:02:35 +02:00
Bartosz Dziewoński a88084509d Use edit intro messages and preloaded content from MediaWiki core
Use MediaWiki core helpers to provide intro messages (including edit
notices), initial page content, and CSS classes for the edit area.

The following intro messages were previously unimplemented,
and will be shown now:
* 'sharedupload-desc-create'
* 'sharedupload-desc-edit'

The following intro messages were previously unimplemented,
but they only apply to pages where VE should never be available,
and will be shown now when editing those pages with 2017WTE:
* 'code-editing-intro'
* 'talkpagetext'

The following intro messages were previously unimplemented,
and are now explicitly skipped:
* 'editpage-head-copy-warn'

The following intro messages were previously unimplemented,
but they only apply to pages where neither VE nor 2017WTE should
ever be available:
* 'userinvalidconfigtitle'
* 'usercssyoucanpreview'
* 'userjsonyoucanpreview'
* 'userjsyoucanpreview'

Depends-On: If0b05710cb52a977bf4e85947d72d68683a0a29e
Bug: T201613
Change-Id: If26e39e383b983f7ee834ed6dd73b80e0545b068
2023-05-16 02:34:35 +02:00
Bartosz Dziewoński 37ab4c2a80 Expose automatic temporary user info in the API
Depends-On: I62b4bb630decac92cbb8c7ddf00307df0dadb516
Bug: T332435
Change-Id: I84ce108b4d46b4e19fad032382f8b69a1b0065d5
2023-05-04 00:44:10 +02:00
daniel 96292e770a Don't force the "view" flavor when using stashing!
Bug: T333402
Change-Id: I6fc598cb2309c442a0b5bfe665f6f96c1a6edf85
2023-04-06 12:17:11 +02:00
C. Scott Ananian 10cb01cdd1 Update DirectParsoidClient to match BCP-47 changes in core
We're trying to avoid passing raw strings around, since they can be
ambiguous specifiers of language.  This patch makes VE compatible
with I982e0df706a633b05dcc02b5220b737c19adc401, with a backward
compatibility workaround which can be removed after
I982e0df706a633b05dcc02b5220b737c19adc401 merges.

The new code also uses slightly more methods of the Language object,
which need to be mocked in a unit test.

Change-Id: I830867d58f8962d6a57be16ce3735e8384f9ac1c
2023-03-08 21:19:21 +00:00
Derick Alangi deecb3cdcb Use helper classes from the new namespace
Helper classes have been moved to a dedicated namespace
of their own, this patch references the new namespace.

Depends-On: Ieeb7a0a706a4cb38778f312bfbfe781a1f366d14
Change-Id: I5a2792a3536f6d953905561410f0e4966254ccbe
2023-01-16 14:22:38 +01:00
Umherirrender 31fdf64247 tests: Replace deprecated Language::factory
Bug: T325986
Change-Id: I87e3c799fcb8959d2b31084479b1d15219a10261
2022-12-28 19:38:38 +01:00
Esther Akinloose 99f9899193 selenium: Toolbar should open format paragraph menu
Bug: T296187
Change-Id: Icb1fabcf054a2fb1b290815d6cc9945bda0433a4
2022-12-21 14:10:31 +00:00
Esther Akinloose d5825af59d selenium: Toolbar should open style text options
Bug: T296187
Change-Id: I909176da40faa64b23d0dfcafa4b9a6f62c0820e
2022-12-20 15:36:13 +00:00
Esther Akinloose 4df16fac5b selenium: Toolbar should open structure options menu
Bug: T296187
Change-Id: Ia8abb12c911174c2c6778b5aff4272a9b14fbbe0
2022-12-19 15:05:28 +00:00
daniel 3a50a092d9 Catch HttpException early
Catch HttpException from REST helpers, even when they are triggered
already during initialization. This will happen e.g. when the request is
asking for a render key for which the stashed rendering has expired.

Bug: T325310
Change-Id: I9e622b5bb253f5e40fe2b50ff08471beddac9acf
2022-12-15 18:12:37 +00:00
Željko Filipin 15c53f0576 selenium: Decrease logLevel from info to error
logLevel from info is very verbose. It is no longer needed. The default
error logLevel should be enough.

Bug: T296187
Change-Id: I1bde5b57f64df2d6c00b4a7b8e24f9887a865bb6
2022-12-09 13:36:56 +01:00
jenkins-bot e6bcdb7e78 Merge "selenium: Toolbar should open insert menu" 2022-12-07 16:07:22 +00:00
jenkins-bot d6f577b3df Merge "Revert "selenium: Do not retry tests"" 2022-12-06 14:58:21 +00:00
Kosta Harlan 68f0539fa8 Revert "selenium: Do not retry tests"
This reverts commit 9b9304b13f.

Reason for revert: Selenium tests occasionally fail for many different
reasons. We should use the default specFileRetries, so that a single
failure doesn't cause ~20 minutes of delay when someone is backporting
a change. See also e.g. T324544

Bug: T324544
Change-Id: I043eb5e57bec13a16efb35bbdffda6d3ea65b8e9
2022-12-06 12:40:00 +00:00
Esther Akinloose 5347c6adf6 selenium: Toolbar should open insert menu
Bug: T296187
Change-Id: I4af64851d95a5bca26d8ae6ed5fcd9b0d13aba55
2022-12-02 22:07:49 +00:00
jenkins-bot d386acf9b0 Merge "selenium: Toolbar should open special characters menu" 2022-11-30 18:01:54 +00:00
jenkins-bot 79b64eb837 Merge "selenium: Toolbar should open notices popup as soon as it loads" 2022-11-30 14:18:35 +00:00
Esther Akinloose fb5cbbd6c8 selenium: Toolbar should open special characters menu
Bug: T296187
Change-Id: Iab55907f648a99f7a7a56dc49bc0686df619c6dd
2022-11-30 14:17:33 +00:00
jenkins-bot 0e4bda00e9 Merge "selenium: Toolbar should open help popup" 2022-11-30 14:08:37 +00:00
Esther Akinloose 5f8dbcf2dd selenium: Toolbar should open notices popup as soon as it loads
Bug: T296187
Change-Id: I705d4d3e8a0135b500ec63749f519f7b86855a2f
2022-11-30 13:43:32 +00:00
Esther Akinloose 329574d645 selenium: Toolbar should open help popup
Bug: T296187
Change-Id: Ic818a97405e93e7545b6655073a62fd7e5b4e8a3
2022-11-30 12:36:42 +00:00
Esther Akinloose 552e82c308 selenium: Toolbar should open page options
Bug: T296187
Change-Id: I46b5c7c2c3dd4d823a9727ea0c4eb8c2e9aaf207
2022-11-28 15:02:47 +00:00
daniel f36572432b Use PageRestHelperFactory
This isolates this extension from knowledge about the constructor
signature of the helper classes. Constructore signatures are not stable
interfaces.

Needed-By: Ie430acd0753880d88370bb9f22bb40a0f9ded917
Depends-On: I10af85b2da96568cfffd03867d1cb299645fb371
Change-Id: If1914dbfbefc3501b4d4cef4beb1fae307c36455
2022-11-19 21:21:11 +00:00
jenkins-bot a013b8c292 Merge "api-testing: Add test for switching from source to visual mode" 2022-11-04 17:10:47 +00:00