Commit graph

503 commits

Author SHA1 Message Date
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
msantos 72b4f8cdbb Rename HTMLTransform related classes
* Rename imported classes in VE that will be renamed in core
* Re-enable tests that would fail when the core patch is merged

Depends-On: I506f3303ae8f9e4db17299211366bef1558f142c
Change-Id: I59ebeb24fa0de5f10d1501cc0830c7e4805e1003
2022-11-04 11:43:36 +00:00
jenkins-bot 2972e744cc Merge "Skip tests while renaming HTMLTransform" 2022-11-02 16:34:34 +00:00
daniel 1a5a52440c api-testing: Add test for switching from source to visual mode
Bug: T321862
Depends-On: Id611e6e022bf8d9d774ca1a3a214220ada713285
Change-Id: I685e4bcef9b1c398265afdf375b478643ab74cdd
2022-11-01 13:22:51 +00:00
msantos 1647a0ae89 Skip tests while renaming HTMLTransform
HTMLTransform is being renamed at I506f3303ae8f9e4db17299211366bef1558f142c.
This is a temporary measure to allow CI to succeed in the core patch

Change-Id: Id11068e34d4b3ed6ccc210c91e449656e74138a2
2022-10-22 19:55:55 +00:00
jenkins-bot 02a4cfa424 Merge "Pick ParsoidClient implementation based on etag." 2022-10-20 18:14:38 +00:00
daniel adc017f73f Pick ParsoidClient implementation based on etag.
When receiving HTML from a VE session, process it with the same kind of
ParsoidClient that was originally used to generate the HTML. If we were
to use a different implementation, the ETag wouldn't match, so we would
fail to find the stashed data-parsoid map, and the edit would fail.

Bug: T320704
Change-Id: I3b73431fccacecb4ad88b82f8f5675b1042e03ce
2022-10-20 08:52:20 +00:00
Esther Akinloose b96f0bc411 selenium: Toolbar should open switch editor
Bug: T296187
Change-Id: Ife5b833acc39596b7e40a2c5a5512a6fd61150af
2022-10-19 13:08:55 +00:00
jenkins-bot e49765d418 Merge "selenium: Content editable should insert a table" 2022-10-19 12:53:54 +00:00
daniel 92e52d0bad Remove AutoConfig setting
AutoConfig was used to set VE to call internal REST API endpoints exposed by the parsoid extension.
With DirectParsoidClient available, this is no longer needed.

NOTE: this causes all wikis that do not have a RESTbase backend
configured to start using DirectParsoidClient. This is true in
particular for officewiki and labswiki.

Bug: T320704
Change-Id: Ia4c6184dd75a653c3202ea160b6605335f36f6eb
2022-10-14 10:55:53 +02:00
daniel 07afdba500 Don't try to contact RESTbase directly when in PHP direct mode.
If VE is configured to call parsoid directly in PHP, the client
should not try to fetch HTML from restbase. Doing so will
lead to inconsistencies, and may cause edits to fail.

Bug: T320704
Bug: T320703
Change-Id: I98bfdd305dcd188d91db6a8fe5885156cdeca7db
2022-10-13 11:22:52 +00:00
jenkins-bot a87f9882c0 Merge "Local implementation of ParsoidClient (DirectParsoidClient)" 2022-10-12 20:50:20 +00:00
Željko Filipin e63bedb988 selenium: Content editable should insert a table
Bug: T296187
Change-Id: Ic0395637690a40a9b6f889072f80b56e5f02390c
2022-10-12 16:00:25 +02:00
daniel 35cb550747 Local implementation of ParsoidClient (DirectParsoidClient)
* DirectParsoidClient makes use of parsoid directly for performing
transformations on both wikitext and/or HTML contents.

* Also, it's used to fetch HTML from parsoid's parser cache. Before,
this operation was done via RESTBase but now it's being fetched in
core's parsoid parser cache.

* This patch also enables VE clients to transform HTML to
Wikitext when switching from HTML to source mode on. It
makes use of the HtmlInputTransformHelper to perform this
transformation.

* Now, VE client can make use of core code for switching
between HTML to source mode and back without RESTBase.

Change-Id: I5c7cfcc4086d8da7905897194d8601aa07418b59
2022-10-11 18:34:06 +01:00
Esther Akinloose 529f004fc6 selenium: Move code to beforeEach and afterEach hooks
Bug: T296187
Change-Id: Iad8482e432491895eac070692fd3448e6362e4ce
2022-10-10 14:36:33 +01:00
daniel 7f9573f994 api-testing: Add assertions to e2e tests
This adds assertions for the return values of the following pactions:
metadata, parse, parsefragment.

It also adds a test that asserts that edits are not possible with
an invalid token.

Change-Id: Idb453d3561a46930afb5366c1a96787895fc8e40
2022-10-04 19:36:39 +00:00
Derick Alangi 1746b76129 ApiVisualEditor: Remove parsedoc VE paction
This VE paction was removed in I90d775dd71d5f5a61d651b63d946ab60a27e2ca3
so this code can be deleted per Bartosz, so this patch removes the code.

NOTE: A merged API test that uses this is also removed along side.

Change-Id: I4ff75df57fd58f508ef7212486e52cb11a7cfb57
2022-10-03 14:12:35 +01:00
Emeka Chukwukere 2749611071
api-testing: Add more visualeditoredit e2e tests
This patch adds more tests covering the `visualeditoredit` action
API.

Change-Id: I3a20afdb4a146672e272a87eafe8203c384e3405
2022-09-30 00:16:28 +01:00
Emeka Chukwukere db6cc66749 api-testing: Add test for creating and saving a page
Testing the visualeditoredit action API for VisualEditor.

Change-Id: I951ecf1c71e2ee66e3d1fc15a29b312b8fe9956e
2022-09-29 21:23:59 +01:00
Emeka Chukwukere 5b5ed387c9 Add basic end-to-end tests for action=visualeditor
Bug: T318403
Change-Id: I7a607edc69d8fcf51a634ce0f536548979eef95b
2022-09-28 18:28:05 +02:00
daniel 1c7468191b Add api-testing script to package.json
The test file is just a placeholder for now, so we can enable the CI job.
Actual tests will follow in a separate patch.

Bug: T318403
Change-Id: I8105f49f8898c8ebfd80eb898d30a49e58db5b25
2022-09-27 13:15:39 +00:00
Bartosz Dziewoński 209aaf6943 ParsoidClient: Fix getPageHtml() $targetLanguage param inconsistencies
* DirectParsoidClient: Actually allow null to be provided.
  Previously we tried to call methods on it unconditionally.

* VRSParsoidClient: Require the param to be provided (even if null).
  No reason to diverge from the interface, which requires it.

Change-Id: Id9a450dc8b8eb3e82cf87718b96975e5a3c6180c
2022-09-26 22:52:31 +02:00
daniel 4c1ec8fc40 ParsoidClient: error should be array or null
This follows up the initial fix with additional sanitation and a
regression test. See I21c7a2b2541061a858a9791a2cb12866acd38dc5.

Bug: T318083
Change-Id: I4e433e711c068336a888f4aafa243455764fd710
2022-09-20 21:05:51 +02:00
daniel 0cd6c90d5a Extract RESTbase client code into VRSParsoidClient.
This makes the "direct" client and the VRS based client
implement the same interface, so the caller doesn't have to know
which one it is using.

It looks like ParsoidHelper will not be needed if we use this approach.

Change-Id: Ib1c1d7355951fc0765227dd01a9edfc554fc448d
2022-09-14 18:20:36 +01:00
Derick Alangi b029fd8ede Introduce VisualEditorParsoidClientFactory
This patch introduces a factory service for creating VE Parsoid
clients.

NOTE: This patch also injects a GlobalIdGenerator to the client
 and avoids usage of deprecated UIDGenerator class.

Change-Id: I787c0afb227308aab56770d14d62e08eb0084a6c
2022-09-06 12:47:43 +01:00
jenkins-bot 6b25a6b15a Merge "ApiVisualEditorTest: Set Database annotation and $tablesUsed" 2022-07-12 13:31:02 +00:00
Kosta Harlan 21de9f4728 ApiVisualEditorTest: Set Database annotation and $tablesUsed
Bug: T312849
Change-Id: Iacb1e7f3b66f93d54c2512718ea00f46a0b55c89
2022-07-12 13:07:31 +00:00
Esther Akinloose b69c89e378 selenium: Enable all tests
EditPage.activationComplete() was flaky.
We have replaced it with EditPage.toolbar.waitForDisplayed().
We have run all the tests 100 times in a row in CI and it works fine.

Bug: T310772
Change-Id: I321b4114ca03ebd02a79d8bd3863ea0e68494dc2
2022-07-04 12:22:38 +00:00
Kosta Harlan b736f35740 selenium: Disable flaky test
Bug: T310772
Change-Id: I19df39298129ac911ed79c1ba5731638ab0332d3
2022-06-22 17:24:59 +00:00
Esther Akinloose 9b9304b13f selenium: Do not retry tests
Bug: T296187
Change-Id: Iddfff777d783ad372eebf9ff285361fa129ebe02
2022-06-14 14:31:21 +01:00