launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #04074
[Merge] lp:~danilo/launchpad/speed-up-subscription-tests into lp:launchpad
Данило Шеган has proposed merging lp:~danilo/launchpad/speed-up-subscription-tests into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~danilo/launchpad/speed-up-subscription-tests/+merge/66120
= Speed-up subscribers list JS tests =
Monkey patch the animation time so tests execute faster.
== Tests ==
lib/lp/bugs/javascript/tests/test_subscribers_list.html
== Demo and Q/A ==
If the test passes (and it does), qa-ok.
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/bugs/javascript/tests/test_subscribers_list.js
--
https://code.launchpad.net/~danilo/launchpad/speed-up-subscription-tests/+merge/66120
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~danilo/launchpad/speed-up-subscription-tests into lp:launchpad.
=== modified file 'lib/lp/bugs/javascript/tests/test_subscribers_list.js'
--- lib/lp/bugs/javascript/tests/test_subscribers_list.js 2011-06-17 10:38:53 +0000
+++ lib/lp/bugs/javascript/tests/test_subscribers_list.js 2011-06-28 11:43:26 +0000
@@ -1128,10 +1128,14 @@
setUp: function() {
this.root = Y.Node.create('<div />');
Y.one('body').appendChild(this.root);
+ // Monkey-patch animation duration to make the tests quicker.
+ this.anim_duration = Y.lazr.anim.flash_in.defaults.duration;
+ Y.lazr.anim.flash_in.defaults.duration = 0;
},
tearDown: function() {
this.root.remove();
+ Y.lazr.anim.flash_in.defaults.duration = this.anim_duration;
},
_should: {
@@ -1241,7 +1245,7 @@
// But after waiting for animation to complete,
// callback is called.
Y.Assert.isTrue(callback_called);
- }, 1100);
+ }, 20);
},
test_stopSubscriberActivity_no_callback: function() {
@@ -1262,7 +1266,7 @@
this.wait(function() {
// Nor is it called after any potential animations complete.
Y.Assert.isFalse(callback_called);
- }, 1100);
+ }, 20);
}
}));
@@ -1631,10 +1635,14 @@
setUp: function() {
this.root = Y.Node.create('<div />');
Y.one('body').appendChild(this.root);
+ // Monkey-patch animation duration to make the tests quicker.
+ this.anim_duration = Y.lazr.anim.flash_in.defaults.duration;
+ Y.lazr.anim.flash_in.defaults.duration = 0;
},
tearDown: function() {
this.root.remove();
+ Y.lazr.anim.flash_in.defaults.duration = this.anim_duration;
},
test_unsubscribe_callback_success: function() {
@@ -1681,7 +1689,7 @@
// Removal is triggered from the stopSubscriberActivity,
// which shows the success animation first.
Y.Assert.isTrue(removed_subscriber);
- }, 1100);
+ }, 20);
// Restore the real method.
module.SubscribersList.prototype.removeSubscriber = old_rmSub;
@@ -1760,10 +1768,14 @@
setUp: function() {
this.root = Y.Node.create('<div />');
Y.one('body').appendChild(this.root);
+ // Monkey-patch animation duration to make the tests quicker.
+ this.anim_duration = Y.lazr.anim.flash_in.defaults.duration;
+ Y.lazr.anim.flash_in.defaults.duration = 0;
},
tearDown: function() {
this.root.remove();
+ Y.lazr.anim.flash_in.defaults.duration = this.anim_duration;
},
test_constructor_calls_setup: function() {
@@ -2103,7 +2115,7 @@
// Remove function is only called after animation completes.
this.wait(function() {
Y.Assert.isTrue(remove_called);
- }, 1100);
+ }, 20);
// Restore original methods.
module.SubscribersList.prototype.removeSubscriber = old_remove;