Commit graph

510 commits

Author SHA1 Message Date
WMDE-Fisch 5fcc9dab86 [Cypress] Fix VE save
In some cases the click on the save button did not trigger the
save dialog. After playing around with this, it seems that the
only thing helping here is a little pause.

Even if we wait for the button to change the state to `enabled`
the click sometimes does not trigger the dialog.

Bug: T366383
Change-Id: I2754fd5a0e9b439e9e0378f3597f67e743a6d0c1
2024-06-27 19:01:44 +02:00
WMDE-Fisch bcc109f943 [Cypress] Re-enable skipped backlinks test
I could identify and fix the issue in

I3224c6131a6e959821bc36e4525889e5088777a2

stress test run fine see

I8e38e8cc533065998f91794a9e490d38d77ad21a

Bug: T368267
Change-Id: Ib7db6c39988ef45404817b8c7a68132572f16e36
2024-06-26 11:59:56 +02:00
WMDE-Fisch 4f7b5b2d60 [Cypress] Fix module wait
This was never working it seems. The result of the check needs to
be wrapped in an expect() call.

Bug: T368267
Change-Id: I3224c6131a6e959821bc36e4525889e5088777a2
2024-06-26 09:01:31 +02:00
Kosta Harlan c51dc6e280
cypress: Disable flaky backlinks.cy.js test
Bug: T368267
Change-Id: I469c5d63d2db09c691b49a83200fcf39e0f2ac4a
2024-06-24 15:23:11 +02:00
Ed Sanders 66fb3e661a Fix some documentation warnings
Change-Id: I7a97c99a919796f987a05ba17e25357fb5ef14c5
2024-06-21 18:00:45 +01:00
WMDE-Fisch aa5368ad32 Use full listKey for extends in the model
This makes it much easier to deal with the internal auto names
used on new elements created during one edit session.

We're ignoring the correct generation of the auto name literals
for now.

Bug: T367031
Bug: T367030
Change-Id: Idd579970cb64500dac27053213e9b116f23b6d76
2024-06-14 14:03:07 +02:00
WMDE-Fisch f3d0c8643d [Cypress] Use more helper methods for common code
Also removing the weird hook code that was only there to make sure
JS finished loading afaik and then was copied over to other parts
of the codebase.

Change-Id: I90185b14de69bf3f4b6230b9a87c7eff261e72b4
2024-06-14 10:15:11 +02:00
Umherirrender 3de8f65114 Use namespaced classes
Changes to the use statements done automatically via script

Change-Id: I4b49c4ab87f1fcd5cdf29d5f882dec3c3902e146
2024-06-08 23:31:42 +02:00
Ed Sanders 77b7f347c8 build: Update eslint-config-wikimedia to 0.28.0
Change-Id: I9f69e865d47e7cf4a8273bb0fdffbb9dac28b5cb
2024-06-06 16:28:53 +01:00
jenkins-bot 863dd201ad Merge "ESLint: Enforce prefer-arrow-callback" 2024-06-05 10:07:46 +00:00
jenkins-bot c11922c655 Merge "Add 'mw-cite-backlink' class to Parsoid's HTML" 2024-06-04 16:04:32 +00:00
WMDE-Fisch 90a4bb4ee5 [Cypress] Move a bit more code to helpers
Change-Id: I1191b38d6b92c87da9fd35d4ff118823c97a7c93
2024-06-04 11:14:02 +02:00
WMDE-Fisch b4f4dc7fb7 [Cypress] Streamline page edit and VE Cite setup
Change-Id: I4818b662e16f8d70a7d59dcfa29348e9468100df
2024-06-04 07:57:19 +02:00
WMDE-Fisch 1a67a23fbc [Cypress] Move VE helpers to own file
Change-Id: I9e5297f481ba1d70f027e805ed415378d4c8f15c
2024-06-04 07:56:56 +02:00
Ed Sanders 5a2154de38 ESLint: Enforce prefer-arrow-callback
Change-Id: I8d96b69e8c15bc8ad84cfb0c511396e5b3e7ac20
2024-06-03 12:31:33 +01:00
WMDE-Fisch d05b738a29 [Cypress] Disable CI Citoid flaky test
I'm still not sure what causes this to fail in CI locally they
are running fine. In the CI it seems from the recordings, that
Citoid is not loaded when these tests are executed.

Bug: T366383
Change-Id: Iee9e4dd04e08fd3ddfa77409d037ec80f84ead3e
2024-06-03 11:50:11 +02:00
jenkins-bot 477bda1085 Merge "Add 'reference-text' class to Parsoid's HTML" 2024-05-31 21:30:39 +00:00
Subramanya Sastry f38bcde14e Add 'mw-cite-backlink' class to Parsoid's HTML
This patch adds 'mw-cite-backlink' to the linkback span for both
named and unnamed refs. This requires us to add a span wrapper
for the unnamed refs case.

Verified in local testing that this causes aria attributes to be
added to the linkback tags in Parsoid HTML.

This should likely fix other gadgets and code that rely on this
class name to do their work.

Strictly speaking, this is a breaking change since we add an
extra span wrapper for the unnamed ref backlinks which *could*
break anyone using a li > a[rel="mw:referencedBy"] selector.
But, given the specificity of the a[rel] selector, the "li >"
part is unnecessary and might not be used. So, if we wanted to
push our luck (and break process), we could get this in.

Alternatively, we could:
- do this in the the read views OutputTransformPipeline.
- do a real major version bump -- we would be exercising that
  functionality and have to fix and implement any missing pieces
  that may have broke as part of the RESTBase sunsetting.
- not add the span wrapper and fix gadgets to explicitly look for
  both named and unnamed refs with their selectors.

Bug: T328695
Change-Id: Icbd325ebd12cb42186c5b5220dc016835eb18b64
2024-05-31 14:42:04 -05:00
jenkins-bot 56d7dd2496 Merge "[Cypress] Wait for VE modules to load" 2024-05-31 09:43:47 +00:00
WMDE-Fisch 1102102e8f [Cypress] Wait for VE modules to load
This should make sure events are added to the corresponding UI
elements and reduce flaky test results even more.

Change-Id: I2317321912945ef20f8f49405b54fddd65c618d1
2024-05-31 09:18:53 +00:00
C. Scott Ananian 6256b2fc58 Replace book-referencing page property with tracking category
Page property is removed immediately since $wgCiteBookReferencing has
never been enabled in production.

Bug: T239989
Change-Id: I6252fcf1485994244dca40470cc5955e8d4f6917
2024-05-30 07:50:59 +00:00
Subramanya Sastry 50f01c4f28 Add 'reference-text' class to Parsoid's HTML
This adds the 'reference-text' class where Parsoid added
'mw-reference-text'.

If we don't care about the "mw-" prefix, since there are very
few wiki and code references to 'mw-reference-text', it might
seem like we could update all those references and rip out
'mw-reference-text' from Parsoid output.

But, Parsoid HTML is also exposed via the REST API which means
there are likely many users out there analyzing Parsoid HTML.
https://github.com/search?q=%22mw-reference-text%22+NOT+language%3AHTML&type=code
says there are 512 references to this string - so looks like
we are probably going to rely on a major HTML version bump in
Parsoid in the future and then rip out all the duplicate
classes (mw-ref, mw-references, mw-reference-text OR
reference, references, reference-text).

Bug: T328695
Change-Id: I04b18ac75863a0e3e61bdd47b34508e5547dc872
2024-05-28 12:36:49 -05:00
mareikeheuer 1d729a934d [Cypress] Citoid breaks Cite browser tests
Make e2e tests work under either environment (Cite, Citoid)

Bug: T364382
Change-Id: Ib3b7865b9b6c3b1ae86bc792a659a39be3120bc4
2024-05-27 19:57:37 +02:00
jenkins-bot 4f8e06b97b Merge "Make it possible to disable the "cite_error" wrapper message" 2024-05-27 08:16:04 +00:00
thiemowmde 5841e03e10 Add missing skip instructions to Gadget integration test
Also simplify the @covers annotations while we are here. The class
is really simple. There isn't much that can be covered acidentally.

Change-Id: I105f4ea6d6beb119d1557a32b691e9eda1b8085c
2024-05-16 14:35:53 +02:00
jenkins-bot 44f0010c07 Merge "Separate names for server-side vs. client-side feature flags" 2024-05-16 12:29:42 +00:00
jenkins-bot 0c846421b3 Merge "Consolidate duplicate "is reference list empty" code paths" 2024-05-13 13:28:20 +00:00
thiemowmde c921c76dd2 Consolidate duplicate "is reference list empty" code paths
Introduce a static method so we don't need to copy paste code.

Note that the static method still largely duplicates what the method
.buildIndex() will later do. Both loops iterate the reference groups
and the references in each group. The main difference is that the
"is empty" check stops extremely early the moment it finds any
non-empty group.

That's also why I'm convinced it's not worth caching the result.
I benchmarked it and it's nanoseconds. But there are more reasons:

The non-static .isIndexEmpty() method is currently only used when
Citoid is active the same time. Which means the cached result was
entirely unused on installations without Citoid.

Bug: T356871
Change-Id: Id5c4295086bc977ef52ad141be9962d2eecb1bcc
2024-05-07 15:51:12 +02:00
Adam Wight 9699781545 Temporarily skip tests incompatible with Citoid
Cite tests are blocking Citoid patches, by failing in that
environment.

TODO: To be reverted once the incompatibility is resolved.

Bug: T364382
Change-Id: Ie8eeac79966ccb46389e4f9aaa4620e9bd75cc00
2024-05-07 13:37:25 +02:00
thiemowmde e3fdee52aa Separate names for server-side vs. client-side feature flags
The two are different:

* CiteReferencePreviews as specified in extension.json is a feature
flag that allows us to disable the feature entirely. It could be
named "CiteReferencePreviewsFeature" or "CiteEnableReferencePreviews",
but renaming a feature flag that's already in use is hard.

* The client-side flag tells the JavaScript code "you know what, it
was kind of a mistake you got loaded, please stop". This is because
we can not make all decisions before we register the ResourceLoader
module, e.g. if the user has certain gadgets enabled.

Adding the word "Active" is not a huge improvement, but at least
makes the two different now. Suggestions welcome.

Bug: T362771
Change-Id: I0f6a911df8772616ac50c1301f402f77dbe32089
2024-04-30 11:57:47 +00:00
jenkins-bot 29e8ba9ea0 Merge "Further delay search index build in ReferenceSearchWidget" 2024-04-30 10:49:17 +00:00
jenkins-bot 74b42ace80 Merge "Make ReferenceSearchWidget code a bit more functional" 2024-04-30 10:49:14 +00:00
WMDE-Fisch f0d7406811 Don't load ReferencePreviews when not enabled in the config
Includes a test and some improvements to the CiteHooks tests.

Change-Id: I0e9108d0d429ed9b7467f993441eefc2557c8e6f
2024-04-30 11:10:22 +02:00
WMDE-Fisch 963933ed33 Streamline ReferencePreviewsGadgetsIntegrationTest
Change-Id: If285c1f6fd8abc95e2f3ad393b443b8e8a5f4837
2024-04-26 12:38:18 +02:00
WMDE-Fisch 179d402344 Add ReferencePreviews config checks to Cite extension
PHP classes and test are somewhat copies from the Popups codebase.
Some refactoring was applied. More could be done. Not to sure if
this should happen more in follow ups though.

Could also reduce the complexity of checks on the JS side. Most of
these things can only change on page load. The only dynamic part
left is the anon user setting managed by the Popups extension.

Note, that I needed to add a new PHP config for here although the
other still exists and is needed in the Popups extension. This
will change, when the user settings code also moves.

I guess it's okay for now though. Both settings default to true
and are not overridden in the config repos.

Also needed to add the Gadget extension as phan dependency.

Bug: T362771
Depends-On: Ia028c41f8aaa1c522dfc7c372e1ce51e40933a5e
Change-Id: Ie6e8bc706235724494036c7f0d873f5c996c46e6
2024-04-25 12:50:27 +02:00
jenkins-bot ca629c3dd1 Merge "Internal config variables renamed from Popups to Cite" 2024-04-22 16:01:31 +00:00
Adam Wight f0849b2b17 Internal config variables renamed from Popups to Cite
This updates the easy variables which are set and get within a single
module, these changes should have no effect and don't need to be
coordinated across extensions.

Bug: T362332
Change-Id: Ibbe69c321e9e2b744ec88cebbdc3476d776f5956
2024-04-22 14:31:55 +02:00
jenkins-bot 583eeafd37 Merge "Use ParserOutput::setUnsortedPageProperty()" 2024-04-18 12:47:56 +00:00
mareikeheuer 30663d285b Cypress test for adding a reference in VisualEditor using templates
Verify the functionality of adding template references

- template dialog opens correctly
- allows undocumented parameter input
- verifies the presence of the added reference in saved mode

Bug: T358657
Change-Id: I5a35a5fe0c6f27f53a1d9de887bdf52b8e7f9c08
2024-04-16 16:44:22 +02:00
C. Scott Ananian 9ff28a0837 Use ParserOutput::setUnsortedPageProperty()
The ::setPageProperty() method has some tricky corner cases where the
type of the value determines whether or not the page property will be
sorted.  Since sort order for the BOOK_REF_PROPERTY is irrelevant,
use ::setUnsortedPageProperty() to communicate this clearly to the
reader.

Depends-On: Ia94c192c429d0482c58467bed787fd2e0aca052f
Followup-To: Ibfd84b52057baa8e249d321ec9df612efd6a29a6
Change-Id: I399f4895ec8720ff2927c5cd5a09c7af4664ee46
2024-04-16 09:51:43 -04:00
C. Scott Ananian fc5f22b32e CiteParserHooksTest: make test compatible with removal of dynamic property
Whether the dynamic property is present or not, it should have a null
value when 'unset' -- and don't use `unset` to delete an *actual*
property when one is present!

Change-Id: Ifcb9492cc5c814d702c6e61e8231abfd8ea0647c
2024-04-12 15:23:14 -04:00
Isabelle Hurbain-Palatin d94d7f923b Re-enable and fix tests after Parsoid modification
Bug: T214241
Depends-On: I022501851ea45cfd2554f9e914aa6f4fe2b07548
Change-Id: Ib7d7e6debb9ea73cb05d4142392b00a195644116
2024-04-09 15:57:17 -04:00
jenkins-bot 5d878d41f7 Merge "Disable some tests for Parsoid CI" 2024-04-04 15:56:55 +00:00
jenkins-bot 5041bb598b Merge "Move Cypress tests under tests/ directory" 2024-04-04 13:55:44 +00:00
thiemowmde 203a1cde34 Further delay search index build in ReferenceSearchWidget
The search index is really only used in a single place, in the
buildSearchResults method at the very bottom of the class. I find it
more obvious to understand what's going on when the places where the
search index is populated and used are as close together as possible.

This again really only moves existing code around without actually
changing anything.

We can also drop the extra "built" property and use a special null
value instead. This is possible because we know the only consumer of
the this.index property and can guarantee it can't get confused by
the null.

Bug: T356871
Change-Id: Iaddb3b16b3aa776f89fca2bf0350cce9b6bb1a23
2024-04-04 15:13:50 +02:00
thiemowmde e9561ade15 Make ReferenceSearchWidget code a bit more functional
This turns two methods with side-effects into more pure functions
with more obvious input and output. buildSearchIndex rebuilds the
internal search index from the internalList. buildSearchResults
filters and creates the result widgets the user will see.

This patch really only moves existing code around but doesn't change
anything. Except that this.built is set before onQueryChange is
called, not after. This avoids potential endless loops in case
onQueryChange happens to trigger buildIndex again.

Bug: T356871
Change-Id: Ib80a2dcb85779d64bec53caf90c49879d0ea2258
2024-04-04 15:12:57 +02:00
thiemowmde d2a244b753 Move Cypress tests under tests/ directory
Bug: T358851
Change-Id: I084f4e098c00d4c1bbcb0e692a2be3b1f8ce59a2
2024-04-04 13:06:26 +00:00
thiemowmde b02028b671 Move ve-cite QUnit tests to top-level tests/ directory
It's just hard to find and confusing when hidden in that
sub-directory.

Bug: T358851
Change-Id: I19ffe73b79fa9add52af12f477afe7abbc6db836
2024-04-03 12:03:33 +02:00
Isabelle Hurbain-Palatin b1ad116f89 Disable some tests for Parsoid CI
Bug: T214241
Needed-By: I022501851ea45cfd2554f9e914aa6f4fe2b07548
Change-Id: I40f3c82cbf861426137b935f1bf0bc4b3c6194b0
2024-04-03 03:01:21 +00:00
jenkins-bot 1fdc65548b Merge "Add strictly typed RefGroupItem class to Parsoid code" 2024-04-01 03:05:52 +00:00