Page MenuHomePhabricator

CommunityConfiguration unconditionally requires CommunityConfigurationExample
Closed, ResolvedPublic

Description

On CI, when an extension depends on CommunityConfiguration, tests will fail cause it also requires CommunityConfigurationExample which force us to add it as a dependency to any extension that uses CommunityConfiguration. Currently CommunityConfigurationExample is being injected because CI processes dependencies recursively and we are removing that behavior (see T389998).

The affected extensions are: AutoModerator, Babel, CheckUser,Cite, GrowthExperiments, ReportIncident

A build would fail with:

1) MediaWiki\Extension\CommunityConfiguration\Tests\CommunityConfigurationTestHelpersTest::testOverrideProviderOK
InvalidArgumentException: Provider CommunityConfigurationExample is not supported

extensions/CommunityConfiguration/src/Provider/ConfigurationProviderFactory.php:100
extensions/CommunityConfiguration/tests/phpunit/CommunityConfigurationTestHelpers.php:42
extensions/CommunityConfiguration/tests/phpunit/integration/CommunityConfigurationTestHelpersTest.php:23
2) MediaWiki\Extension\CommunityConfiguration\Tests\Integration\UpdateEmergencyDefaultsTest::testUpdateOK
MediaWiki\Maintenance\MaintenanceFatalError: 

maintenance/includes/Maintenance.php:565
extensions/CommunityConfiguration/maintenance/UpdateEmergencyDefaults.php:57
vendor/wikimedia/testing-access-wrapper/src/TestingAccessWrapper.php:114
extensions/CommunityConfiguration/tests/phpunit/integration/maintenance/UpdateEmergencyDefaultsTest.php:53

This task is about making it possible to run CommunityConfiguration tests without CommunityConfigurationExample.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change #1189797 had a related patch set uploaded (by Hashar; author: Hashar):

[mediawiki/extensions/CommunityConfiguration@master] Skip tests when CommunityConfigurationExample is not loaded

https://gerrit.wikimedia.org/r/1189797

Change #1189797 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] Skip tests when CommunityConfigurationExample is not loaded

https://gerrit.wikimedia.org/r/1189797

Change #1189926 had a related patch set uploaded (by Hashar; author: Hashar):

[mediawiki/extensions/CommunityConfiguration@REL1_43] Skip tests when CommunityConfigurationExample is not loaded

https://gerrit.wikimedia.org/r/1189926

Change #1189927 had a related patch set uploaded (by Hashar; author: Hashar):

[mediawiki/extensions/CommunityConfiguration@REL1_44] Skip tests when CommunityConfigurationExample is not loaded

https://gerrit.wikimedia.org/r/1189927

Change #1189927 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@REL1_44] Skip tests when CommunityConfigurationExample is not loaded

https://gerrit.wikimedia.org/r/1189927

Change #1189926 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@REL1_43] Skip tests when CommunityConfigurationExample is not loaded

https://gerrit.wikimedia.org/r/1189926

This has been fixed and backported.

In my original run I did not take in account browser tests. The Cypress testsuite in CommunitConfiguration requires ConfigurationExample, they should be skipped when it is not present.

Example https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WP25EasterEggs/+/1214005 which depends on CommunityConfiguration and has recursion disabled:

zuul/dependencies.yaml
WP25EasterEggs:
  recurse: false
  dependencies:
    - CommunityConfiguration
    - Wikibase

And that leads to the failure:

Community Configuration Example Page
  1) should save configuration changes and verify them on the example page
  Form elements and basic functionality
    2) should have all expected form elements and labels
    3) should have a save button
    4) should have a disabled save button for logged-out users
    5) should update a simple string via API and verify the update on the form
Expected to find element: `#CCExample_String input[type="text"]`, but never found it.
Expected to find element: `#CCExample_String`, but never found it.
Expected to find content: '(communityconfiguration-editor-form-submit-button-text)' within the element: <button.cdx-button.cdx-search-input__end-button> but never did.
Expected to find content: '(communityconfiguration-editor-form-submit-button-text)' within the element: <button.cdx-button.cdx-search-input__end-button> but never did.
User "WikiAdmin": Action "communityconfigurationedit" returned error code "badvalue": Unrecognized value for parameter "provider": CommunityConfigurationExample.!

The Cypress tests should skip https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Cite/+/1213500

I have tried to have the tests to be skipped in the before hook without using @cypress/skip-test since it is deprecated. I could not figure it out :-\ Thus I guess I should just add @cypress/skip-test. That will be for tomorrow.

hashar renamed this task from CommunityConfiguration uconditionally requires CommunityConfigurationExample to CommunityConfiguration unconditionally requires CommunityConfigurationExample.Dec 9 2025, 8:26 AM

I have tried to have the tests skipped from the before hook using:

describe( 'Community Configuration Example Page', () => {

   before( () => {
        cy.visit( 'index.php?title=Special:CommunityConfiguration/CommunityConfigurationExample&uselang=qqx' );
        cy.contains( 'communityconfiguration-provider-not-found', { timeout: 0 } )
            .then( () => {
                cy.state( 'runnable' ).ctx.skip();
            } );
    } );

cy.state() is not part of the official API and the contains() assertion obviously fails when CommunityConfigurationExample is present which leads to all tests failing :]

Change #1216756 had a related patch set uploaded (by Hashar; author: Hashar):

[mediawiki/extensions/CommunityConfiguration@master] cypress: skip when CommunityConfigurationExample is not loaded

https://gerrit.wikimedia.org/r/1216756

Change #1216759 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/config@master] Zuul: [WP25EasterEggs] add CommunityConfigurationExample

https://gerrit.wikimedia.org/r/1216759

Change #1216760 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/config@master] Revert "Zuul: [WP25EasterEggs] add CommunityConfigurationExample"

https://gerrit.wikimedia.org/r/1216760

Change #1216759 merged by jenkins-bot:

[integration/config@master] Zuul: [WP25EasterEggs] add CommunityConfigurationExample

https://gerrit.wikimedia.org/r/1216759

Change #1217162 had a related patch set uploaded (by Hashar; author: Hashar):

[mediawiki/extensions/CommunityConfiguration@REL1_43] cypress: skip when CommunityConfigurationExample is not loaded

https://gerrit.wikimedia.org/r/1217162

Change #1217163 had a related patch set uploaded (by Hashar; author: Hashar):

[mediawiki/extensions/CommunityConfiguration@REL1_44] cypress: skip when CommunityConfigurationExample is not loaded

https://gerrit.wikimedia.org/r/1217163

Change #1217164 had a related patch set uploaded (by Hashar; author: Hashar):

[mediawiki/extensions/CommunityConfiguration@REL1_45] cypress: skip when CommunityConfigurationExample is not loaded

https://gerrit.wikimedia.org/r/1217164

Change #1216756 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] cypress: skip when CommunityConfigurationExample is not loaded

https://gerrit.wikimedia.org/r/1216756

Change #1217162 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@REL1_43] cypress: skip when CommunityConfigurationExample is not loaded

https://gerrit.wikimedia.org/r/1217162

Change #1217163 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@REL1_44] cypress: skip when CommunityConfigurationExample is not loaded

https://gerrit.wikimedia.org/r/1217163

Change #1217164 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@REL1_45] cypress: skip when CommunityConfigurationExample is not loaded

https://gerrit.wikimedia.org/r/1217164

Change #1216760 merged by jenkins-bot:

[integration/config@master] Revert "Zuul: [WP25EasterEggs] add CommunityConfigurationExample"

https://gerrit.wikimedia.org/r/1216760