Commit graph

238 commits

Author SHA1 Message Date
Umherirrender 03634118e3 tests: Use fresh RequestContext in FeatureManagerTest
RequestContext::getMain() is global state and
should not be used by unit tests

Change-Id: I8ea64ebc4c83b909b4d397532b7dba4ebf9a9f07
2024-10-30 21:12:18 +01:00
Jon Robson 0e2e1a9a17 Remove PerformanceBudgetTest
This test has not served the original purpose it intended and is
now more of a nuisance than supportive to our goal of monitoring
performance across MediaWiki.

For now, we are going to remove this test in favor of a new test
that we are currently finalizing in T360590 that we hope to land
after the next MediaWiki release.

Bug: T373017
Change-Id: I0eb22ebbed67ded008de7ca75f9f8f399a214ef8
2024-09-25 22:58:32 +00:00
Sergio Gimeno d11e77a5ec PerformanceBugetTest: increase budget for GrowthExperiments styles
Should unblock merges in GrowthExperiments repo

Bug: T373017
Change-Id: Iadc09e048c46d6d0cf255dbc82932cd07c33d5a2
2024-09-25 15:39:30 +02:00
Jon Robson 1dd7fcc32b Bump size of Vector performance budget to accomodate FlaggedRevs styles
Styles for message boxes are now loaded on page load.

This is temporary until I2808de0fa9826ae0eb5dc09ad62f0a901479110e lands.

Bug: T373602
Change-Id: I34730117cfdb2204883224c9d9f2bd902025cdb2
2024-09-21 00:37:03 +00:00
Hannah Okwelum 8f25cfbde2 phpunit: Remove use of internal KeyValueDependencyStore class
ResourceLoader uses the KeyValueDependencyStore by default. And, in
PHPUnit context, MediaWiki's MainStash defaults to HashBagOStuff. It makes sense to remove this since both are the default already.

Additionally, since we are in the process of merging KeyValueDependencyStore into DependencyStore, the internal
KeyValueDependencyStore class name will no longer exist.

Neeeded by Ia581ac107cb139afb0740a36f4f22f047d0de1ad.

Bug: T343492
Change-Id: Ib3c41ff5d615ba75ec25af4858746eaf708c8750
2024-09-11 00:43:25 +00:00
Jon Robson acb79c5e1b Improve documentation for how feature manager classes work.
This changes nothing about the existing classes, it just improves
how they are documented.

The FIXME comment was making things confusing.

Make sure every feature class is accounted for and audited and
throw a RuntimeException if we forget to document it.

Change-Id: I9d8f6553fe6b8c2ae80d8b2490c8895a8334a537
2024-08-08 20:19:48 +00:00
jenkins-bot 2f92e61a13 Merge "Inject service LanguageConverterFactory into VectorComponentVariants" 2024-06-24 18:32:00 +00:00
Fomafix c9408c027e Inject service LanguageConverterFactory into VectorComponentVariants
Change-Id: I0e1fa5a8f8f6705e2439bdbc914b9d80b0072c30
2024-06-14 11:23:51 +00:00
Michael Große b32116de30 Add styles performance budget for GrowthExperiments extension
We have CI failing on this test for GrowthExperiments with the styles
budget being exceeded. On changes that do not touch production code at
all.

I do not know how this can happen in the first place, or whether fixing
it this way is sensible, but we need to unblock our CI.

Change-Id: I178cb7ff6f111a11e9b6060960548e65d1c7d3c0
2024-06-14 13:01:43 +02:00
Steph Toyofuku 578e8aaf18 Raise performance budget for GrowthExperiments extension
Bump the GrowthExperiments extension-specific performance budget from
5000 to 7500 since we seem to be running right up against the limit.
Adding a bit of extra wiggle room since this seems to be causing issues
for the growth team, although we should potentially work with them as
the existing comment suggests to lower this

https: //wikimedia.slack.com/archives/C8W3HEHLG/p1718263715588799
Change-Id: Ide1cc5cc1e78dc86b90d731f54a913893ba8c8bd
2024-06-13 14:44:02 -07:00
Umherirrender e8ffe82549 tests: Use renamed class BundleSizeTestBase
Follow-Up: I131e0d85bd14e75aaebd6f212b2e64a45d4c73a2
Change-Id: I55d7a3f0aa281e813e92f676c225fc825c256f13
2024-06-12 20:39:06 +02:00
Umherirrender d3b251de52 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I84dc0ec8a909fce94db2b958eadac9caf661972b
2024-06-10 22:28:40 +02:00
James D. Forrester ab7d8ada65 PerformanceBudgetTest: Increase WikiLambda's budget post-Codex 1.6.1
Change-Id: Id2ce4de5efc7bfa67334eecfea0bdda85ac11640
2024-05-31 09:45:51 -04:00
thiemowmde 79dae4ad7a Remove redundant test cases and comments from tests
* Remove stray @package comments. They appear to be auto-generated
  as they just repeat the namespace name (but the wrong one).
* Remove redundant test that effectively doesn't do anything other
  than testing if the constructor doesn't fail. This is already
  covered by other tests.

Change-Id: Icb1136b7018a88310a37a3989d18a678e6cb9ddf
2024-05-27 09:18:05 +02:00
Jdrewniak 607e6b39c5 Revert "Add exclusion behaviour for "width" option in Appearance menu"
This reverts commit ff5a61e9c6.

Reason for revert: The behaviour introduced in this patch needs some more consideration.

Bug: T364015
Change-Id: Ieab4ca4084df4f1b5c942fe81c7fb99b058e0623
2024-05-23 23:51:46 +00:00
James D. Forrester ac3c525420 PerformanceBudgetTest: Add WikiLambda dependencies to unbreak merge
Rough numbers for now.

Change-Id: Ie487fc56eb199f94e0b72f59d5c54f623570773b
2024-05-22 13:25:01 -04:00
Jon Robson f797b8760d Adapt bundlesize based on installed extensions
Allocate specific space for each installed extension based on
whether it is installed. This should reduce false positives (assuming
we have accounted for every installed extension)

If we haven't we'll follow up with additional budgets as we learn
about them.

Bug: T365480
Change-Id: Ie487fc56eb199f94e0b72f59d5c54f623570773a
2024-05-22 05:37:28 +00:00
Jan Drewniak ff5a61e9c6 Add exclusion behaviour for "width" option in Appearance menu
- Adds the notice "This page is always wide" and disables
  the inputs for the "width" options in the Appearance menu
  when pages are excluded via configuration ( `$wgVectorMaxWidthOptions`).
- Changes layout behaviour so that pages in the
  $wgVectorMaxWidthOptions['exlcude'] configuration
  stretch the entire viewport width.
- Stops the width settings in the Appearance menu from
  being hidden on smaller resolutions.

Bug: T364015
Change-Id: Idee294adf3b309e03834276ea75e4ae43b0cffcb
2024-05-17 17:58:19 +00:00
Jon Robson 176a6397ce Correct behaviour of ConfigHelper, add tests
Bug: T365084
Change-Id: I220990554d0a07642dd03a0c7bd53f9bd7ff55ec
2024-05-16 08:04:45 +02:00
Jdlrobson b7743a1dbe Revert "Add exclusion notice for "width" option in Appearance menu"
This reverts commit 89c250c18e.

Reason for revert: We need some more time to test this one and
the resulting behaviour. After discussing this morning we decided
to remove from the next train release.

Bug: T364015
Change-Id: I0dfc17d9c8a8697b8b4f590acdbc2d2c54de9429
2024-05-13 21:33:49 +00:00
ksarabia 5c9fc606dd Deploy limited width settings
* Main page set to true for exclude.
* Makes it default to all wikis.

Bug: T357706
Change-Id: I72d2e9e4eb2e11b1c9bfbdacbd6e298ec205040d
2024-05-10 17:34:08 -05:00
Jan Drewniak 89c250c18e Add exclusion notice for "width" option in Appearance menu
Adds the notice "This page is always wide" and disables
the inputs for the "width" options in the Appearance menu
when pages are excluded via configuration ( `$wgVectorMaxWidthOptions`).

Bug: T364015
Change-Id: Ie99b41c9130f496ab23b60c95e551a9ea602d5a0
2024-05-09 16:47:07 -04:00
Fomafix d7735c8d57 Use context of FeatureManagerFactory in FeatureManager
Change-Id: I5e77b6ce2df1245e8a5c710b7e84813f04a77ae2
2024-05-07 18:49:06 +00:00
Fomafix 6320921bd4 Inject service UserOptionsLookup into FeatureManager
Change-Id: I3a056731c4a4e970cae0b974dab574bdbb0401f5
2024-05-06 20:07:58 +00:00
Jon Robson 55e6dfd81c Fixes: exclusion logic for anonymous users
Bug: T364159
Change-Id: I7c7e9cff7b99f8e37f3f1ffb93464fd3f31c799b
2024-05-06 12:20:40 -04:00
bwang 0109218ab9 Rename client preference menu to appearance menu
Bug: T362808
Change-Id: Id6800d38eebf433cf0c9e3f179dd83df2eefd1fb
2024-04-29 15:38:20 +00:00
Jan Drewniak a3801497b9 Add exclusion notice for night mode feature
If night-mode is disabled on a certain page via the
exclude list in skin.json, then the following class:
".skin-theme-clientpref-excluded" will be added to the HTML element.

In this scenario, the related client-preferences
menu options are visible, but disabled, and a notice
is rendered below the options informing users of this state.

Bug: T361158
Change-Id: I46d335d079a2d27c7a4122e23ac7e479c286b886
2024-04-16 22:38:35 -04:00
jenkins-bot b98e0a0017 Merge "Allow disabling of night mode on certain pages via config" 2024-03-29 08:03:00 +00:00
Steph Toyofuku feb8cc90dc Allow disabling of night mode on certain pages via config
* Using the new ConfigHelper, support disabling night mode on certain
pages via configuration options
* In addition, adds test coverage for this case and the query parameter
case (in a new integration test file as we now require accessing the
service container for request context)
* Finally, supply a default configuration in skin.json with all the
values set to null

For the easiest possible approach while we evaulate our general feature
management system, this logic is handled inside of getFeatureBodyClass
using the new shouldDisable general function.  In the future, it may
make sense to break this out into its own requirement class, but for now
that feels premature

Bug: T359606
Change-Id: I3e7a4720ec3cc2afd9777e36f59aa56b682258f0
2024-03-28 16:37:30 -07:00
Steph Toyofuku 3387ef3ee4 Add tests for ConfigHelper
This class is being used in both vector and minerva, and we are
currently depending on it working for our night mode rollout, so let's
add some test coverage!  Also fixed a small spacing issue in production
code that was bothering me lol

Note: these are not totally exhaustive - next steps would be to ensure
that the exclusions/inclusions work with arrays and not only single
elements, but hopefully this helps build some confidence ☺️

Change-Id: Iebea43eae6b1517fd778763db4f5db3b0fd9c30f
2024-03-27 16:49:39 -07:00
jenkins-bot e7a6fe9b12 Merge "Type hint UserIdentity in Requirements/Components" 2024-03-18 05:58:30 +00:00
Jon Robson a67a260451 Restore budget test with better guidance and special case FlaggedRevs
Restore the budget test with better guidance on the process to
handling this issue.

Bug: T360102
Change-Id: I1ca80945e2ef49604a85e1bec6004f30ad13924d
2024-03-14 11:47:54 -07:00
Muhammad Jaziraly be0e56bb73 Skip PerformanceBudgetTest::testTotalModulesSize
Unblocks CI for Wikibase extension.
CI failed in I824acad352c366a35a243dac2086e3c5e98bc6eb

Bug: T350338
Change-Id: Id9926ff9a60cb0cac56a612a792d5ffde55c4c63
2024-03-14 09:06:34 +00:00
Umherirrender 558359c06d Type hint UserIdentity in Requirements/Components
Only id or registered state is needed.

Change-Id: I184db486ed2763e0402fe75ed9afb0e71a0d57c6
2024-03-13 21:59:40 +01:00
Umherirrender 7afaa93ab2 build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0
Change-Id: Ic8e1a7bc4bab091b0e959deae5258181fc54891b
2024-03-12 20:51:09 +01:00
jenkins-bot 06ed0b8e19 Merge "Create a FeatureManagerFactory" 2024-03-11 07:24:06 +00:00
Umherirrender ea4fd5d182 Create a FeatureManagerFactory
Some feature requirements needs access to the request user or title.
Currently the context is given in the ServiceWiring callback,
access to RequestContext::getMain() should be avoided during service
wiring (T218555).
Create a factory to hold the code from the service wiring and call the
factory with the request context from the skin to get a feature manager.

Bug: T359665
Change-Id: I57515ec02ed454620f729a109d0ace43b447b6ce
2024-03-08 20:28:31 +01:00
Fomafix 9d1819f4ec Inject services in Hooks
Change-Id: Ice931a7596c73781f05265d96e0086729402ae63
2024-03-07 20:23:51 +00:00
Fomafix e423bf9a45 Use overrideConfigValue/overrideConfigValues instead of setMwGlobals
Change-Id: Ic5b008c3e75226946fe1c6ffd3580303072b38d2
2024-03-06 20:17:36 +00:00
Fomafix fe449821c8 Use $this->getServiceContainer() in tests
Use
	$this->getServiceContainer()
instead of
	MediaWikiServices::getInstance()
in tests.

Change-Id: Id614ed8948fff75991ecf2c805707bc7f16f36a6
2024-03-01 15:31:49 +00:00
bwang 230c837052 Remove language notice
Bug: T353619
Change-Id: I75430c8b1e66158f798fbe27eec4942a089f3931
2024-02-29 17:04:16 -06:00
jenkins-bot 450b84603e Merge "Add PHPUnit tests for VectorComponentMainMenu" 2024-02-27 00:50:27 +00:00
jenkins-bot 2470c2b332 Merge "Add PHPUnit tests for VectorComponentMainMenuAction" 2024-02-12 22:14:14 +00:00
jenkins-bot 533b83a863 Merge "test: Add PHPUnit tests for LanguageService" 2024-02-12 17:06:07 +00:00
Doğu Abaris 1b692aef4d test: Add PHPUnit tests for LanguageService
Adds tests for LanguageService in Vector skin.
Covered:
- `testConstruct`: Validates property initialization.
- `canWordsBeSplitSafely`: Tests that the language is splittable or not.

Change-Id: Icc1c269c56e0e53c624074516aee95ba242a55d7
2024-02-12 16:25:43 +00:00
Doğu Abaris 71f9552bb2 Add PHPUnit tests for VectorComponentMenu
Adds tests for VectorComponentMenu in Vector skin.
The test suite includes the following validations:
- Constructor initialization with expected parameters and behaviors.
- Validate counting logic for menu items.
- Validates `getTemplateData` method's output for correctness.

Change-Id: Ia52aa70e9213f6627d063d520fdbb2e353f0bfcb
2024-02-10 09:16:39 +00:00
Doğu Abaris fab1b342e0 Add PHPUnit tests for VectorComponentMainMenu
Adds tests for VectorComponentMainMenu in Vector skin.
The test suite includes the following validations:
- Constructor initialization with expected parameters and behaviors.
- Correct identification of 'is-pinned' state
- Inclusion of data for first portlet and rest portlets
- Handling of pin/unpin actions and language alert considerations
- Proper integration of menu elements based on user and feature flags

Change-Id: Ie408ff668893d1de2cf9dd1211a9c82c0b882f99
2024-02-10 01:38:59 +00:00
Doğu Abaris f1c6c828a9 Add PHPUnit tests for VectorComponentMainMenuAction
Adds tests for VectorComponentMainMenuAction in Vector skin.
The test suite includes the following validations:
- Constructor initialization with expected parameters and behaviors.
- Validates `getTemplateData` method's output for correctness.

Change-Id: I5deda64dc1bd3db85df69d0bb5a5a27f6fb8c1ff
2024-02-10 01:38:47 +00:00
Doğu Abaris 6212b8feac Add PHPUnit tests for VectorComponentLanguageDropdown
Adds tests for VectorComponentLanguageDropdown in Vector skin.
The test suite includes the following validations:
- Proper handling based on page type (subject/talk).
- Correct labeling and icon selection.
- Accurate class and aria label configuration.

Change-Id: I145cb250c513f3f81e780195485907897788f5c4
2024-02-10 00:20:12 +00:00
Doğu Abaris cd032f4c4c Add PHPUnit tests for VectorComponentDropdown
Adds tests for VectorComponentDropdown in Vector skin.
The test suite includes the following validations:
- Correct template data generation.
- Proper label, tooltip, and icon handling.
- Accurate CSS class construction for various states.

Change-Id: Iafd28cfe62eb4b8c6039f819b9d8f005b0b32d48
2024-02-07 10:40:26 +00:00