Merge lp:~danilo/launchpad/speed-up-subscription-tests into lp:launchpad

Proposed by Данило Шеган
Status: Merged
Approved by: Данило Шеган
Approved revision: no longer in the source branch.
Merged at revision: 13322
Proposed branch: lp:~danilo/launchpad/speed-up-subscription-tests
Merge into: lp:launchpad
Diff against target: 84 lines (+16/-4)
1 file modified
lib/lp/bugs/javascript/tests/test_subscribers_list.js (+16/-4)
To merge this branch: bzr merge lp:~danilo/launchpad/speed-up-subscription-tests
Reviewer Review Type Date Requested Status
Deryck Hodge (community) code Approve
Review via email: mp+66120@code.launchpad.net

Commit message

[r=deryck][no-qa] Speed up test_subscribers_list.html by making the animation patched by a monkey to be faster and waiting less for it to complete.

Description of the change

= 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

To post a comment you must log in.
Revision history for this message
Deryck Hodge (deryck) wrote :

Looks good. 50ms FTW per our RL/IRC discussion and r=me. :)

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 16:27:42 +0000
@@ -1128,10 +1128,14 @@
1128 setUp: function() {1128 setUp: function() {
1129 this.root = Y.Node.create('<div />');1129 this.root = Y.Node.create('<div />');
1130 Y.one('body').appendChild(this.root);1130 Y.one('body').appendChild(this.root);
1131 // Monkey-patch animation duration to make the tests quicker.
1132 this.anim_duration = Y.lazr.anim.flash_in.defaults.duration;
1133 Y.lazr.anim.flash_in.defaults.duration = 0;
1131 },1134 },
11321135
1133 tearDown: function() {1136 tearDown: function() {
1134 this.root.remove();1137 this.root.remove();
1138 Y.lazr.anim.flash_in.defaults.duration = this.anim_duration;
1135 },1139 },
11361140
1137 _should: {1141 _should: {
@@ -1241,7 +1245,7 @@
1241 // But after waiting for animation to complete,1245 // But after waiting for animation to complete,
1242 // callback is called.1246 // callback is called.
1243 Y.Assert.isTrue(callback_called);1247 Y.Assert.isTrue(callback_called);
1244 }, 1100);1248 }, 50);
1245 },1249 },
12461250
1247 test_stopSubscriberActivity_no_callback: function() {1251 test_stopSubscriberActivity_no_callback: function() {
@@ -1262,7 +1266,7 @@
1262 this.wait(function() {1266 this.wait(function() {
1263 // Nor is it called after any potential animations complete.1267 // Nor is it called after any potential animations complete.
1264 Y.Assert.isFalse(callback_called);1268 Y.Assert.isFalse(callback_called);
1265 }, 1100);1269 }, 50);
1266 }1270 }
12671271
1268}));1272}));
@@ -1631,10 +1635,14 @@
1631 setUp: function() {1635 setUp: function() {
1632 this.root = Y.Node.create('<div />');1636 this.root = Y.Node.create('<div />');
1633 Y.one('body').appendChild(this.root);1637 Y.one('body').appendChild(this.root);
1638 // Monkey-patch animation duration to make the tests quicker.
1639 this.anim_duration = Y.lazr.anim.flash_in.defaults.duration;
1640 Y.lazr.anim.flash_in.defaults.duration = 0;
1634 },1641 },
16351642
1636 tearDown: function() {1643 tearDown: function() {
1637 this.root.remove();1644 this.root.remove();
1645 Y.lazr.anim.flash_in.defaults.duration = this.anim_duration;
1638 },1646 },
16391647
1640 test_unsubscribe_callback_success: function() {1648 test_unsubscribe_callback_success: function() {
@@ -1681,7 +1689,7 @@
1681 // Removal is triggered from the stopSubscriberActivity,1689 // Removal is triggered from the stopSubscriberActivity,
1682 // which shows the success animation first.1690 // which shows the success animation first.
1683 Y.Assert.isTrue(removed_subscriber);1691 Y.Assert.isTrue(removed_subscriber);
1684 }, 1100);1692 }, 50);
16851693
1686 // Restore the real method.1694 // Restore the real method.
1687 module.SubscribersList.prototype.removeSubscriber = old_rmSub;1695 module.SubscribersList.prototype.removeSubscriber = old_rmSub;
@@ -1760,10 +1768,14 @@
1760 setUp: function() {1768 setUp: function() {
1761 this.root = Y.Node.create('<div />');1769 this.root = Y.Node.create('<div />');
1762 Y.one('body').appendChild(this.root);1770 Y.one('body').appendChild(this.root);
1771 // Monkey-patch animation duration to make the tests quicker.
1772 this.anim_duration = Y.lazr.anim.flash_in.defaults.duration;
1773 Y.lazr.anim.flash_in.defaults.duration = 0;
1763 },1774 },
17641775
1765 tearDown: function() {1776 tearDown: function() {
1766 this.root.remove();1777 this.root.remove();
1778 Y.lazr.anim.flash_in.defaults.duration = this.anim_duration;
1767 },1779 },
17681780
1769 test_constructor_calls_setup: function() {1781 test_constructor_calls_setup: function() {
@@ -2103,7 +2115,7 @@
2103 // Remove function is only called after animation completes.2115 // Remove function is only called after animation completes.
2104 this.wait(function() {2116 this.wait(function() {
2105 Y.Assert.isTrue(remove_called);2117 Y.Assert.isTrue(remove_called);
2106 }, 1100);2118 }, 50);
21072119
2108 // Restore original methods.2120 // Restore original methods.
2109 module.SubscribersList.prototype.removeSubscriber = old_remove;2121 module.SubscribersList.prototype.removeSubscriber = old_remove;