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
1=== modified file 'lib/lp/bugs/javascript/tests/test_subscribers_list.js'
2--- lib/lp/bugs/javascript/tests/test_subscribers_list.js 2011-06-17 10:38:53 +0000
3+++ lib/lp/bugs/javascript/tests/test_subscribers_list.js 2011-06-28 16:27:42 +0000
4@@ -1128,10 +1128,14 @@
5 setUp: function() {
6 this.root = Y.Node.create('<div />');
7 Y.one('body').appendChild(this.root);
8+ // Monkey-patch animation duration to make the tests quicker.
9+ this.anim_duration = Y.lazr.anim.flash_in.defaults.duration;
10+ Y.lazr.anim.flash_in.defaults.duration = 0;
11 },
12
13 tearDown: function() {
14 this.root.remove();
15+ Y.lazr.anim.flash_in.defaults.duration = this.anim_duration;
16 },
17
18 _should: {
19@@ -1241,7 +1245,7 @@
20 // But after waiting for animation to complete,
21 // callback is called.
22 Y.Assert.isTrue(callback_called);
23- }, 1100);
24+ }, 50);
25 },
26
27 test_stopSubscriberActivity_no_callback: function() {
28@@ -1262,7 +1266,7 @@
29 this.wait(function() {
30 // Nor is it called after any potential animations complete.
31 Y.Assert.isFalse(callback_called);
32- }, 1100);
33+ }, 50);
34 }
35
36 }));
37@@ -1631,10 +1635,14 @@
38 setUp: function() {
39 this.root = Y.Node.create('<div />');
40 Y.one('body').appendChild(this.root);
41+ // Monkey-patch animation duration to make the tests quicker.
42+ this.anim_duration = Y.lazr.anim.flash_in.defaults.duration;
43+ Y.lazr.anim.flash_in.defaults.duration = 0;
44 },
45
46 tearDown: function() {
47 this.root.remove();
48+ Y.lazr.anim.flash_in.defaults.duration = this.anim_duration;
49 },
50
51 test_unsubscribe_callback_success: function() {
52@@ -1681,7 +1689,7 @@
53 // Removal is triggered from the stopSubscriberActivity,
54 // which shows the success animation first.
55 Y.Assert.isTrue(removed_subscriber);
56- }, 1100);
57+ }, 50);
58
59 // Restore the real method.
60 module.SubscribersList.prototype.removeSubscriber = old_rmSub;
61@@ -1760,10 +1768,14 @@
62 setUp: function() {
63 this.root = Y.Node.create('<div />');
64 Y.one('body').appendChild(this.root);
65+ // Monkey-patch animation duration to make the tests quicker.
66+ this.anim_duration = Y.lazr.anim.flash_in.defaults.duration;
67+ Y.lazr.anim.flash_in.defaults.duration = 0;
68 },
69
70 tearDown: function() {
71 this.root.remove();
72+ Y.lazr.anim.flash_in.defaults.duration = this.anim_duration;
73 },
74
75 test_constructor_calls_setup: function() {
76@@ -2103,7 +2115,7 @@
77 // Remove function is only called after animation completes.
78 this.wait(function() {
79 Y.Assert.isTrue(remove_called);
80- }, 1100);
81+ }, 50);
82
83 // Restore original methods.
84 module.SubscribersList.prototype.removeSubscriber = old_remove;