Page MenuHomePhabricator

GrowthExperiments tests fail when non required extensions are not loaded
Open, Needs TriagePublic

Description

GrowthExperiments solely requires CommunityConfiguration and VisualEditor

LocalSettings.php
wfLoadSkin( 'Vector' );

wfLoadExtensions( [
    'GrowthExperiments', 
    'CommunityConfiguration',
    'VisualEditor',
] );

Some tests rely on other extensions which leads to 22 errors and 9 failures. Those tests should be skipped instead.

1) GrowthExperiments\Tests\Integration\ApiQueryGrowthTasksTest::testExecute
MediaWiki\Api\ApiUsageException: Too many values supplied for parameter "gttasktypes". The limit is 1.
2) GrowthExperiments\Tests\Integration\ApiQueryImageSuggestionDataTest::testQuery
MediaWiki\Api\ApiUsageException: The "Suggested edits" module has been disabled.
3) GrowthExperiments\Tests\Integration\HomepageHooksTest::testGetTaskTypesJsonParsesNonbreakingSpaceCorrectly
Undefined array key "tt1"
4) GrowthExperiments\Tests\Integration\LinkRecommendationUpdaterTest::testProcessCandidateExcludedTemplate
Error: Class "CirrusSearch\CirrusSearchServices" not found
5) GrowthExperiments\Tests\Integration\LinkRecommendationUpdaterTest::testProcessCandidateExcludedCategory
Error: Class "CirrusSearch\CirrusSearchServices" not found
6) GrowthExperiments\Tests\Integration\LinkRecommendationUpdaterTest::testProcessCandidateRecentlyEdited
Error: Class "CirrusSearch\CirrusSearchServices" not found
7) GrowthExperiments\Tests\Integration\NewcomerTasksPageUpdatedSubscriberTest::testDoNotClearLinkRecommendationForNewPage
PHPUnit\Framework\MockObject\UnknownTypeException: Class or interface "CirrusSearch\WeightedTagsUpdater" does not exist
8) GrowthExperiments\Tests\Integration\AddLinkSuggestionsHandlerTest::testRun
MediaWiki\Rest\HttpException: Disabled
9) GrowthExperiments\Tests\Integration\ServiceWiringTest::testService with data set "GrowthExperimentsLinkRecommendationUpdater" ('GrowthExperimentsLinkRecommen...pdater')
Error: Class "CirrusSearch\CirrusSearchServices" not found
10) GrowthExperiments\Tests\Integration\ComputedUserImpactLookupTest::testGetUserImpactForTemporaryAccount
Error: Call to a member function getUser() on null
11) GrowthExperiments\Tests\Integration\RefreshLinkRecommendationsTest::testIteratingThroughAllPages_storesHandoverAfterLimitReached
Error: Class "CirrusSearch\CirrusSearchServices" not found
12) GrowthExperiments\Tests\Integration\RefreshLinkRecommendationsTest::testIteratingThroughAllPages_pickupAtStoredPageId
Error: Class "CirrusSearch\CirrusSearchServices" not found
13) GrowthExperiments\Tests\Integration\RefreshLinkRecommendationsTest::testCanSetLastPageIdInStashManually
Error: Class "CirrusSearch\CirrusSearchServices" not found
14) GrowthExperiments\Tests\Unit\HomepageHooksTest::testOnCirrusSearchScoreBuilder
PHPUnit\Framework\MockObject\UnknownTypeException: Class or interface "CirrusSearch\Search\SearchContext" does not exist
15) GrowthExperiments\Tests\Unit\HomepageHooksTest::testOnCirrusSearchScoreBuilderDisabled
PHPUnit\Framework\MockObject\UnknownTypeException: Class or interface "CirrusSearch\Search\SearchContext" does not exist
16) GrowthExperiments\Tests\Unit\SuggestedEditsTest::testAddsReviseToneIfNotInitiated
PHPUnit\Framework\MockObject\UnknownTypeException: Class or interface "MediaWiki\Minerva\Skins\SkinMinerva" does not exist
17) GrowthExperiments\Tests\Unit\SuggestedEditsTest::testAddsNoReviseToneIfInitiated
PHPUnit\Framework\MockObject\UnknownTypeException: Class or interface "MediaWiki\Minerva\Skins\SkinMinerva" does not exist
18) GrowthExperiments\Tests\Unit\AddImageSubmissionHandlerTest::testValidateAccepted
PHPUnit\Framework\MockObject\UnknownTypeException: Class or interface "CirrusSearch\WeightedTagsUpdater" does not exist
19) GrowthExperiments\Tests\Unit\AddImageSubmissionHandlerTest::testValidateAcceptedSectionImage
PHPUnit\Framework\MockObject\UnknownTypeException: Class or interface "CirrusSearch\WeightedTagsUpdater" does not exist
20) GrowthExperiments\Tests\Unit\TopicDecoratorTest::testUseOresTopics
Error: Class "CirrusSearch\Query\ArticleTopicFeature" not found
21) Error
The data provider specified for GrowthExperiments\Tests\Unit\NewcomerTasks\Topic\WikimediaTopicRegistryTest::testGetTopics is invalid.
Error: Class "MediaWiki\Extension\WikimediaMessages\ArticleTopicFiltersRegistry" not found
22) GrowthExperiments\Tests\Unit\NewcomerTasks\Topic\WikimediaTopicRegistryTest::testGetCampaignTopics
Error: Class "MediaWiki\Extension\WikimediaMessages\ArticleTopicFiltersRegistry" not found

Event Timeline

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

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

[mediawiki/extensions/GrowthExperiments@master] Skip tests when WikimediaMessages is not loaded

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

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

[mediawiki/extensions/GrowthExperiments@master] Homepage: remove a test dependency on SkinMinerva

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

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

[mediawiki/extensions/GrowthExperiments@master] Skip tests requiring CirrusSearch when it is not loaded

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

hashar updated the task description. (Show Details)

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

[mediawiki/extensions/GrowthExperiments@master] Skip tests requiring PageViewInfo

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

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

[mediawiki/extensions/GrowthExperiments@master] Make WeightedTags updater optional in LinksRecommendationUpdater

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

Change #1230380 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Homepage: remove a test dependency on SkinMinerva

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

I have send a change merging all the pending changes at https://gerrit.wikimedia.org/r/c/mediawiki/extensions/GrowthExperiments/+/1230919 . The job https://integration.wikimedia.org/ci/job/quibble-requires-only-vendor-non-voting/ has 1 error:

14:37:23 There was 1 error:
14:37:23 
14:37:23 1) GrowthExperiments\Tests\Integration\AddLinkSuggestionsHandlerTest::testRun
14:37:23 MediaWiki\Rest\HttpException: Disabled
14:37:23 
14:37:23 /workspace/src/extensions/GrowthExperiments/includes/Rest/Handler/AddLinkSuggestionsHandler.php:40
14:37:23 /workspace/src/extensions/GrowthExperiments/tests/phpunit/integration/Rest/Handler/AddLinkSuggestionsHandlerTest.php:73

Solved by https://gerrit.wikimedia.org/r/c/mediawiki/extensions/GrowthExperiments/+/1227917/4..5

I seem to have been able to address PHPUnit failures (based on an octopus merge change at https://gerrit.wikimedia.org/r/c/mediawiki/extensions/GrowthExperiments/+/1230919/3). The next step is fixing the couple QUnit tests that fail:

✖ 2 tests failed

FAILED TESTS:
  ext.growthExperiments.Help/HelpPanelProcessDialog.js
    ✖ updateEditMode for link-recommendation
      Firefox 140.0 (Linux 0.0.0)
    Expected: "machineSuggestions"
    Actual: undefined
    tests/qunit/ext.growthExperiments.Help/HelpPanelProcessDialog.test.js/<@http://localhost:9876/load.php?modules=oojs-ui.styles.icons-interactions%2Cicons-layout%2Cicons-media%2Cicons-moderation%2Cicons-movement%2Cicons-user%2Cindicators%7Cpinia%2Crangefix%2Csinonjs%2Cspark-md5%2CtreeDiffer%2Cvue%2Cvue-test-utils%7Cskins.vector.clientPreferences%7Ctest.GrowthExperiments%2CMediaWiki%2CVector%2CVisualEditor&version=1ypqi:1249:948

    ✖ updateEditMode for copyedit, isEditing
      Firefox 140.0 (Linux 0.0.0)
    Expected: "visualeditor"
    Actual: undefined
    tests/qunit/ext.growthExperiments.Help/HelpPanelProcessDialog.test.js/<@http://localhost:9876/load.php?modules=oojs-ui.styles.icons-interactions%2Cicons-layout%2Cicons-media%2Cicons-moderation%2Cicons-movement%2Cicons-user%2Cindicators%7Cpinia%2Crangefix%2Csinonjs%2Cspark-md5%2CtreeDiffer%2Cvue%2Cvue-test-utils%7Cskins.vector.clientPreferences%7Ctest.GrowthExperiments%2CMediaWiki%2CVector%2CVisualEditor&version=1ypqi:1250:722

Change #1230386 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Skip tests requiring PageViewInfo

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

Change #1195363 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Skip tests requiring CirrusSearch when it is not loaded

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

Change #1227917 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Skip tests when WikimediaMessages is not loaded

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

The PHPUnit tests passes after my fixes got approved 🎉

The ext.growthExperiments.Help/HelpPanelProcessDialog.js tests fail (see above T415278#11548999), when WikimediaMessage is not present (that is when GrowthExperiments as a dependency of CheckUser, MetricsPlatform and TestKitchen).

The two errors are in ext.growthExperiments.Help/HelpPanelProcessDialog.js.

The task type raises an error:

Task types are unavailable because Suggested edits is not enabled, see GEHomepageSuggestedEditsEnabled.

In this case, the SuggestedEditsPanel does not fully initialize and skips setting the preferredEditor:

function SuggestedEditsPanel( config ) {
    SuggestedEditsPanel.super.call( this, Object.assign( {
        expanded: false,
        scrollable: false,
        continuous: true,
    }, config ) );
    this.config = config;
    if ( !config.taskTypeData ) {
        return;
    }
    this.editorInterface = config.editorInterface;
    this.preferredEditor = config.preferredEditor;

It is thus undefined and cause the assertion to fail.

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

[mediawiki/extensions/GrowthExperiments@master] test: skip assert when SuggestedEdit is not available

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