Commit graph

461 commits

Author SHA1 Message Date
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
osamaahmed17 40c5c4fe9e selenium: Refactor WebdriverIO tests from sync to async mode
WebdriverIO has dropped support of sync mode, hence changed to async.

Update npm packages: @wdio/*, wdio-mediawiki and webdriverio
because async mode needs at least webdriverio v7.9.

Remove npm package: @wdio/sync.

Bug: T299756
Change-Id: I4a09ccddd8049f84232b035b664b42a4e98d7ff0
2022-02-03 10:41:35 +11:00
jenkins-bot 4519fd5458 Merge "selenium: Rename load test to content editable" 2022-01-25 13:47:18 +00:00
Esther Akinloose 698075a6df selenium: Rename load test to content editable
Bug: T296187
Change-Id: I2e4f1f672bb3414444839013cc82897d56bf48b5
2022-01-24 16:24:56 +01:00
Thalia 8807b07d37 Add basic test for ApiVisualEditor::execute
Bug: T299791
Change-Id: I1217f065572565f076ecb24271c3b5af34e74121
2022-01-24 12:28:49 +00:00
Željko Filipin 0593278d05 selenium: The first test
The first test just opens the page for editing and checks if it opened.

Bug: T284165
Change-Id: Ifffaf3e5ab14811605d96fcdcfdc1f773880e52c
2021-11-09 16:11:22 +01:00
Thiemo Kreuz a3a738b4f9 Rewrite ApiVisualEditor::getAvailableNamespaceIds()
For readability. The current implementation is a sequence of
7 (!) array_…() function calls. It is also not free from bugs.
If one of the two inputs (ExtensionRegistry and Config) specifies
namespaces by e.g. canonical name, but the other by number,
the two are not properly merged. It should be possible to use
configuration to disable a namespace that would otherwise be
enabled. This currently works only if both use the same array
keys.

Bug: T291727
Change-Id: I2671f391cdc510da21eda8a1dc5ed4d2513a378a
2021-10-01 14:10:08 +02:00
DannyS712 492fcfbd9f Don't include null in the namespaces where VE can be enabled
Bug: T291728
Change-Id: I2cb168a21c559e61bf2c9e881d46f7f23110e826
2021-09-29 16:23:48 +00:00
Thiemo Kreuz 3484f1927d Add unit tests for static ApiVisualEditor methods
Done for I2cb168a.

Change-Id: I29f8c127ea19abd3449ee0e2742c3ddcc4db23ba
2021-09-28 10:49:47 +02:00
Thiemo Kreuz 61fac2fb44 Add a first PHPUnit test for SpecialCollabPad
Change-Id: I871f3d9616a40300ee306f58b4bae5a58b57b53f
2021-08-26 12:09:59 +02:00
Thiemo Kreuz d78af2c0e9 Add a first trivial PHPUnit test
This is more a proof of concept. The PHP code in this codebase
is rather small, but not trivial, and worth being covered by
tests.

Change-Id: I20c713c3c3be5d289947a343cd4fbf5256234a4a
2021-08-20 15:20:35 +00:00
Trevor Parscal 76bac7d152 Move test files
Change-Id: Id0a0bd5b4a91f702cad34e9f5e7f2121763abffd
2012-07-25 14:35:49 -07:00
Trevor Parscal a5b7d6d7c7 Merge "Parsoid: move tests/parser to modules/parser/test" 2012-07-25 21:14:13 +00:00
Catrope 13ba9b7de8 (bug 37980) Cutting all text and repasting it breaks the editor
This was caused by a bug in fixupInsertion that caused it to believe
that inserting something like "a</p><p>b</p><p>c" into the middle of an
empty paragraph was invalid.

This commit fixes the fixupInsertion bug, which fixes the
select-all-cut-paste behavior in Chrome. It's still broken in Firefox
because of selection-related issues, but I'll split that out into a
different bug report.

Change-Id: I767f5d37ec7e511778ae9ca8283ec4b26c728298
2012-07-25 12:29:19 -07:00
Carl Fürstenberg dca609e3f9 Parsoid: move tests/parser to modules/parser/test
In preparation for the big extraction of Parsoid out of VisualEditor,
we'll start by moving the tests into the parsoid location.

Change-Id: I4a926ee4aad1490d4f769d44e91af80842b881f0
2012-07-25 02:29:25 +02:00
Gabriel Wicke 305b5981fe Update test README
Change-Id: Icc4f26804295d48bcf244e61ef7654e31b05b306
2012-07-24 10:55:12 -07:00
GWicke 83730035be Merge "Added Jasmine specs to Parsoid." 2012-07-24 17:01:36 +00:00
Trevor Parscal ef0e4b4973 Moved summary functions into custom assertions
Also updated tests to use the new assert as an argument style

Change-Id: I3c82b4b068134bba755ae4a5c26f5bb98d400c43
2012-07-20 13:59:21 -07:00
Catrope 6703bfc265 Fix selectNodes bug where selecting </li><li> returned an empty result
* When ascending back up the stack, check for a start between two closings
* Also check for an end between two openings
* This introduces code duplication but selectNodes() is full of that
  already. I'll have to do a duplication cleanup soon
* Add test case for </li><li>
* Update existing test case that covered a </li>

Change-Id: Ifc80585ce0e0d6988bc54228602c69f0d519200a
2012-07-19 18:10:57 -07:00
Trevor Parscal a0f537712e Converted some instances of "var\t" to "var "
Change-Id: I02154e0381d5ae65b482bbcfc21ac93d0bf30d86
2012-07-19 17:24:54 -07:00
Trevor Parscal 6b34f09df2 Removed some whitespace
And added a license to some files that didn't have it yet

Change-Id: I3a7e60374d1198d369a0475b8f65f7415012a337
2012-07-19 14:25:16 -07:00
Trevor Parscal c40174b60c Changed to use MIT license per agreement with the VisualEditor team
This license change is aimed at maximizing the reusability of this code
in other projects. VisualEditor is more than just an awesome editor for
MediaWiki, it's the new editor for the entire internet.

Added license and author files, plus mentions of the license to all
VisualEditor PHP, JavaScript and CSS files. Parser files have not been
modified but are effectively re-licensed since there's no overriding
license information. 3rd party libraries are not changed, but are all
already MIT licensed.

Change-Id: I895b256325db7c8689756edab34523de4418b0f2
2012-07-19 13:25:45 -07:00
Krinkle ab47265c34 Merge "JSHint: Added dotfiles and fixed tons of linting warnings." 2012-07-19 17:09:03 +00:00
Trevor Parscal a564f81aa7 JSHint: Added dotfiles and fixed tons of linting warnings.
* "onevar" warning sometimes solved by just merging var statements
  other times solved by making it a function declaration instead
  of a function expression.
* Also fixed several '_this' variable names in ve.es.Surface to
  more descriptive names, and enabled warnings for dangling _
  in identifiers.

Change-Id: I7d411881e3e06cf9a7fe56d689c29375881a81de
2012-07-19 10:01:00 -07:00