Jdlrobson has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/348641 )
Change subject: Avoid loading toasts in tests that are not testing toasts ...................................................................... Avoid loading toasts in tests that are not testing toasts Hopefully this will reduce the unfinished animations in qunit test jobs. Bug: T162876 Change-Id: I7abc078f5647f133cd6ad6f2e009603ccdb94fe0 --- M tests/qunit/mobile.editor.overlay/test_EditorOverlay.js M tests/qunit/mobile.talk.overlays/test_TalkSectionOverlay.js M tests/qunit/mobile.watchstar/test_Watchstar.js 3 files changed, 10 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/41/348641/1 diff --git a/tests/qunit/mobile.editor.overlay/test_EditorOverlay.js b/tests/qunit/mobile.editor.overlay/test_EditorOverlay.js index b23cbec..d6bec5d 100644 --- a/tests/qunit/mobile.editor.overlay/test_EditorOverlay.js +++ b/tests/qunit/mobile.editor.overlay/test_EditorOverlay.js @@ -8,6 +8,7 @@ // prevent event logging requests this.sandbox.stub( EditorOverlay.prototype, 'log' ).returns( $.Deferred().resolve() ); + this.toastStub = this.sandbox.stub( mw, 'notify' ); getContentStub = this.sandbox.stub( EditorGateway.prototype, 'getContent' ); // the first call returns a getContent deferred for a blocked user. this.dBlockedContent = $.Deferred().resolve( 'section 0', { @@ -25,15 +26,17 @@ // has to be the first test here! See comment in setup stub. QUnit.test( '#initialize, blocked user', 1, function ( assert ) { + var toastStub = this.toastStub; // eslint-disable-next-line no-new new EditorOverlay( { title: 'test.css' } ); return this.dBlockedContent.then( function () { - assert.strictEqual( - $( '.mw-notification-content' ).text(), - 'Your IP address is blocked from editing. The block was made by Test for the following reason: Testreason.', + assert.ok( + toastStub.calledWith( + 'Your IP address is blocked from editing. The block was made by Test for the following reason: Testreason.' + ), 'There is a toast notice, that i am blocked from editing' ); } ); diff --git a/tests/qunit/mobile.talk.overlays/test_TalkSectionOverlay.js b/tests/qunit/mobile.talk.overlays/test_TalkSectionOverlay.js index 591e83f..3eb3d2c 100644 --- a/tests/qunit/mobile.talk.overlays/test_TalkSectionOverlay.js +++ b/tests/qunit/mobile.talk.overlays/test_TalkSectionOverlay.js @@ -6,6 +6,8 @@ QUnit.module( 'MobileFrontend TalkSectionOverlay - logged in', { setup: function () { + // don't create toasts in test environment + this.toastStub = this.sandbox.stub( mw, 'notify' ); this.api = new mw.Api(); renderFromApiSpy = this.sandbox.stub( TalkSectionOverlay.prototype, 'renderFromApi' ); this.sandbox.stub( user, 'isAnon' ).returns( false ); diff --git a/tests/qunit/mobile.watchstar/test_Watchstar.js b/tests/qunit/mobile.watchstar/test_Watchstar.js index 82bba46..41195227 100644 --- a/tests/qunit/mobile.watchstar/test_Watchstar.js +++ b/tests/qunit/mobile.watchstar/test_Watchstar.js @@ -37,6 +37,8 @@ QUnit.module( 'MobileFrontend: Watchstar.js', { setup: function () { + // Avoid unnecessary mw.notify animations + this.toastStub = this.sandbox.stub( mw, 'notify' ); this.sandbox.stub( user, 'isAnon' ).returns( false ); this.spy = this.sandbox.stub( mw.Api.prototype, 'postWithToken' ) .returns( $.Deferred().resolve() ); -- To view, visit https://gerrit.wikimedia.org/r/348641 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7abc078f5647f133cd6ad6f2e009603ccdb94fe0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits