Commit graph

484 commits

Author SHA1 Message Date
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
Željko Filipin f91253b0ef WIP: selenium: Enable Content Editable should save an edit
Bug: T309712
Change-Id: I342bd53fb461d5194a1c8320c26125f54f6717e9
2022-06-13 14:00:51 +02:00
Esther Akinloose 3e93410e68 selenium: Add EditPage.saveComplete()
Add new check for page saving.

Bug: T296187
Change-Id: I07639c58377f6f285df1bfeccfb5e037a3e619d5
2022-06-09 14:42:02 +01:00
jenkins-bot bffaab97fb Merge "selenium: Better assertion after saving the page" 2022-06-08 14:32:52 +00:00
Željko Filipin 4b7d505891 selenium: Better assertion after saving the page
The 'should save an edit' test is skipped because saving an edit fails
in CI because of T309712.

Bug: T296187
Bug: T309712
Change-Id: Ie4f067ed9b49a993acadaa01c953a9fe46aaae81
2022-06-02 15:51:41 +02:00
Željko Filipin ba0b671fa9 selenium: Run only one test in Jenkins daily job
selenium-daily-beta-VisualEditor Jenkins daily job became really
unstable. Let's run just the simplest test for a few days to see if that
would help with job stability.

Bug: T296187
Change-Id: I858a3c5614277ea029fdabfd4468bb0d124e94d5
2022-06-02 15:43:43 +02:00
Esther Akinloose 9de7c6743d selenium: Improve debugging
Looks like Selenium tests are flaky. To improve debugging:

- Move code from beforeEach hook to specs.
  (Video recording happens only in specs, not in hooks.)

- Increase logLevel from error to info.

Bug: T296187
Change-Id: Iffcfae9a76085670eb8858fbcf622e596a4ff2f0
2022-05-20 16:44:23 +02:00
Željko Filipin e9ee23aace selenium: Content Editable should save an edit
Bug: T296187
Change-Id: I5a48662bb271fd49b6cfa0365e4775c8865dc5c7
2022-05-16 15:11:56 +01:00
jenkins-bot 6336e996b8 Merge "selenium: Check if content editable is editable" 2022-05-09 15:05:18 +00:00
Esther Akinloose 1e030bcde5 selenium: Check if content editable is editable
Bug: T296187
Change-Id: I7a7808bf5cabdccc3f0a01ccecfdadeb7fdc9b91
2022-05-02 13:11:57 +01:00
Ed Sanders c9046685fa eslint: Lint all files except those in .eslintignore
Fix resulting errors (mostly useless escape in i18n files).

Change-Id: Id29c6aecece75d4a462bddb7e547ca5b4eb5c2db
2022-04-13 15:44:49 +01:00
Bartosz Dziewoński 37bb0075db Add tests for the expected properties in API result and auto-save
The goal is to have some tests fail if a new property is added to the
API result, but it's not stored in auto-save data.

Bug: T305225
Change-Id: I9ac328c71c616a8f33e1cfb39431cd9a665adafc
2022-04-08 01:02:53 +02:00
jenkins-bot 39c350ae3e Merge "selenium: Check if editing toolbar is displayed" 2022-04-04 14:24:47 +00:00
Kosta Harlan 9241add01e Allow hook implementations to modify params
This is needed because the $params array is then passed on to
ApiEditPage, so if the hook implementer wants to alter the data used
with the edit, it needs to be able to modify the $params.

See I494d72a42d9103c28c4d44077cfe0f1269fc7b00 for an example where
GrowthExperiments would like to modify the 'tags' parameter for an
edit.

Depends-On: Idd052281898f99e4f13f241d5633294b59b29329
Bug: T304747
Change-Id: Ia4842a1593028f5fa145de167ccf9b72efa81351
2022-03-29 11:31:30 +00:00
Željko Filipin 636ffbbb98 selenium: Check if editing toolbar is displayed
A better assertion if the VisualEditor is opened would be to check for
editing toolbar instead of checking for a notices popup.

Bug: T296187
Change-Id: Ide816646254bc856b44725490c25b2b9962188c9
2022-03-21 15:54:47 +01:00
Reedy 239fbb64e4 Namespace rest of the extension
Change-Id: I4f3e2793099d81401035ea282f268a3afaa03067
2022-03-14 22:27:15 +00:00
Ed Sanders 131d940d99 ApiVisualEditorTest: Assert properties in result
Change-Id: Ibc63ec4c2fc9d3b002b016d01417f61f68b9dc54
2022-03-01 15:09:58 +00:00
Thalia b0c0917f19 ApiVisualEditor: Support Special:MyLanguage for preload param
This allows nonexistent translated pages to fall back to the
corresponding page in a suitable language.

Bug: T299544
Change-Id: I43f461e9f595c364ecdaf2faccbd580fc0df6799
2022-02-25 12:23:16 +00:00
Thalia 0c5ed2e772 ApiVisualEditorTest: Avoid using VirtualRESTServiceClient
Use paction 'metadata' instead of 'parse' by default, to avoid
accidentally using VirtualRESTServiceClient when testing cases
that don't require it.

Change-Id: I02492a2dc444cf531a5c8767b0dcfe0d20ac7339
2022-02-25 12:15:37 +00:00
Željko Filipin 09668285d6 selenium: Wait for VisualEditor to load
Bug: T296187
Change-Id: Iac98690dd49b6e82062973da05ce30c6f08ba8bc
2022-02-16 14:57:13 +01:00