Page MenuHomePhabricator

UploadWizard QUnit tests failing mw.uploadWizard.controller.Deed: Died on test #1: can't access property "top", offset is undefined
Closed, ResolvedPublic

Description

The UploadWizard QUnit tests fail when extension dependencies are not injected recursively. It also fails on CI without any dependencies set beside Vector ( https://integration.wikimedia.org/ci/job/quibble-requires-only-vendor-non-voting/1070/console ). I can not reproduce it locally :-\

Reproducible with

https://integration.wikimedia.org/ci/job/quibble-requires-only-vendor-non-voting/

ZUUL_URLhttps://gerrit.wikimedia.org/r
ZUUL_PROJECTmediawiki/extensions/UploadWizard
ZUUL_BRANCHmaster
ZUUL_REFmaster

QUnit failure

mw.uploadWizard.controller.Deed
    ✔ Constructor sense-check
    ✖ load

mw.uploadWizard.controller.Deed
     ✖ load
       Firefox 140.0 (Linux 0.0.0)
       Died on test #1: can't access property "top", offset is undefined
stacktrace
runScript@http://127.0.0.1:9413//index.php?title=Special:JavaScriptTest/qunit/export:11:471
execute@http://127.0.0.1:9413//index.php?title=Special:JavaScriptTest/qunit/export:13:1
doPropagation@http://127.0.0.1:9413//index.php?title=Special:JavaScriptTest/qunit/export:5:880

uw.ui.Step.prototype.load@http://localhost:9876/load.php?modules=ext.uploadWizard&version=1m67y:25:91
uw.ui.Deed.prototype.load@http://localhost:9876/load.php?modules=ext.uploadWizard&version=1m67y:28:233
uw.controller.Step.prototype.load@http://localhost:9876/load.php?modules=ext.uploadWizard&version=1m67y:64:44
uw.controller.Deed.prototype.load@http://localhost:9876/load.php?modules=ext.uploadWizard&version=1m67y:68:473
00:01:52.374     @http://localhost:9876/load.php?modules=%40wikimedia%2Fcodex%2Ccodex-styles%2Cmoment%2Coojs%2Coojs-ui-core%2Coojs-ui-widgets%2Coojs-ui-windows%2Cpinia%2Csinonjs%2Cvue%2Cvue-test-utils%7Cext.eventLogging%7Cext.eventLogging.metricsPlatform%7Cjquery.client%2ChighlightText%2ClengthLimit%2CmakeCollapsible%2Cspinner%2Ctablesorter%2CtextSelection%7Cjquery.makeCollapsible.styles%7Cjquery.spinner.styles%7Cjquery.tablesorter.styles%7Cmediawiki.DateFormatter%2CForeignApi%2CString%2CTitle%2CUri%2Capi%2Ccldr%2CconfirmCloseWindow%2Ccookie%2Cdeflate%2Cexperiments%2Cfeedback%2Cinspect%2CjqueryMsg%2Clanguage%2CmessagePoster%2Cqunit-testrunner%2Crouter%2Cstorage%2Ctemplate%2Ctoc%2Cuser%2Cutil%2CvisibleTimeout%2Cwidgets%7Cmediawiki.ForeignApi.core%7Cmediawiki.editfont.styles%7Cmediawiki.language.grammar.testdata%7Cmediawiki.language.jqueryMsg.testdata%7Cmediawiki.language.months%2Ctestdata%7Cmediawiki.libs.jpegmeta%2Cpluralruleparser%7Cmediawiki.page.ready%7Cmediawiki.pager.codex%7Cmediawiki.rcfilters.filters.ui%7Cmediawiki.special.block.codex%7Cmediawiki.template.mustache%7Cmediawiki.widgets.CategoryMultiselectWidget%2CDateInputWidget%2CMediaSearch%2CTable%2CUserInputWidget%2Cstyles%7Cmediawiki.widgets.DateInputWidget.styles%7Coojs-ui-core.icons%2Cstyles%7Coojs-ui-widgets.icons%7Coojs-ui-windows.icons%7Coojs-ui.styles.icons-alerts%2Cicons-content%2Cicons-editing-advanced%2Cicons-editing-core%2Cicons-editing-styling%2Cicons-interactions%2Cicons-layout%2Cicons-location%2Cicons-media%2Cicons-moderation%2Cicons-movement%2Cindicators%7Cskins.vector.clientPreferences%7Ctest.EventLogging%2CMediaWiki%2CUpload%20Wizard%2CVector&version=d80a8:2806:1096

Event Timeline

There is a single line of code matching offset.top:

resources/ui/uw.ui.Step.js
/**
 * Initialize this step.
 *
 * @param {mw.UploadWizardUpload[]} uploads
 */
uw.ui.Step.prototype.load = function ( uploads ) {
    // eslint-disable-next-line no-jquery/no-global-selector
    const offset = $( 'h1' ).first().offset();

    this.movedFrom = false;

    this.uploads = uploads;
    this.$div.append( this.$buttons ).show();

    // clear any errors that may have been visible
    this.updateErrorSummary();

    // eslint-disable-next-line no-jquery/no-global-selector
    $( 'html, body' ).animate( {
        scrollTop: offset.top,  // <<<---------------------------[ HERE ]---------<
        scrollLeft: offset.left 
    }, 'slow' );
};

Thus tentatively it can not find the <h1> element? Maybe when it runs with other extension the <h1> is defined somehow.

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

[mediawiki/extensions/UploadWizard@master] build: fix QUnit test that requires an H1 element

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

Change #1214579 merged by jenkins-bot:

[mediawiki/extensions/UploadWizard@master] build: fix QUnit test that requires an H1 element

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

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

[mediawiki/extensions/UploadWizard@REL1_45] build: fix QUnit test that requires an H1 element

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

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

[mediawiki/extensions/UploadWizard@REL1_44] build: fix QUnit test that requires an H1 element

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

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

[mediawiki/extensions/UploadWizard@REL1_43] build: fix QUnit test that requires an H1 element

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

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

[mediawiki/extensions/UploadWizard@REL1_39] build: fix QUnit test that requires an H1 element

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

When doing the backport to REL1_39 I noticed it had this.sandbox.stub( step.ui, 'load' ); which sidestep load.

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/UploadWizard/+/1214591/1/tests/qunit/controller/uw.controller.Deed.test.js

The stub has been removed in a954c7482bae4a7e10601eb078bef8e76e804a2e which made it to REL1_42 (and thus lacks in REL1_44 / REL1_45).

And there is no backport needed for REL1_39 ;)

Change #1214591 abandoned by Hashar:

[mediawiki/extensions/UploadWizard@REL1_39] build: fix QUnit test that requires an H1 element

Reason:

When doing the backport to REL1_39 I noticed it had `this.sandbox.stub( step.ui, 'load' );` which sidestep load.

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/UploadWizard/+/1214591/1/tests/qunit/controller/uw.controller.Deed.test.js


The stub has been removed in a954c7482bae4a7e10601eb078bef8e76e804a2e which made it to REL1_42 (and thus lacks in REL1_44 / REL1_45).

And there is no backport needed for REL1_39 ;)

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

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

[integration/config@master] Zuul: disable recursion on UploadWizard

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

Change #1214588 merged by jenkins-bot:

[mediawiki/extensions/UploadWizard@REL1_45] build: fix QUnit test that requires an H1 element

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

Change #1214589 merged by jenkins-bot:

[mediawiki/extensions/UploadWizard@REL1_44] build: fix QUnit test that requires an H1 element

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

Change #1214590 merged by jenkins-bot:

[mediawiki/extensions/UploadWizard@REL1_43] build: fix QUnit test that requires an H1 element

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

hashar claimed this task.

That one has been fixed and backported to release branches.

UploadWizard has another dependency upon EventLogging, that is tracked by T411660