[Rt-commit] rt branch, watching-tool, updated. rt-3.8.8-494-gc0d16d6

Shawn Moore sartak at bestpractical.com
Fri Aug 20 19:49:55 EDT 2010


The branch, watching-tool has been updated
       via  c0d16d6ee03e652601ff6b546410c225fb5dc489 (commit)
       via  79e5196f4c45340401d2b8678f64b10485845e55 (commit)
       via  f2397e3632705f74b68998832f0170fdecfdbe8e (commit)
       via  804c44c99f5d35b36697a74a1390897a5777bb60 (commit)
       via  69db97cfce479723a82da990952ffb84a60791a7 (commit)
       via  261207e9592b5979d4cfe9b38f781ed02c605f0e (commit)
       via  1fea868b816d509fb520e4df1ebdcd7af3e72a9c (commit)
       via  f4809fb7b5937f62d596e392b074911ed076b011 (commit)
      from  f6fa229efa59f48f8f8f12215eab90d81375613f (commit)

Summary of changes:
 sbin/rt-test-dependencies.in   |    1 +
 share/html/Tools/Watching.html |    5 +-
 t/web/watching-queues.t        |  232 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 236 insertions(+), 2 deletions(-)
 create mode 100644 t/web/watching-queues.t

- Log -----------------------------------------------------------------
commit f4809fb7b5937f62d596e392b074911ed076b011
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Aug 20 17:58:15 2010 -0400

    Improve class names for watching queues elements

diff --git a/share/html/Tools/Watching.html b/share/html/Tools/Watching.html
index 99ebee9..b1b962b 100644
--- a/share/html/Tools/Watching.html
+++ b/share/html/Tools/Watching.html
@@ -76,8 +76,8 @@ while (my $Queue = $Queues->Next) {
     $count += @types;
 </%perl>
 
-    <li class="queue"><& /Ticket/Elements/ShowQueue, QueueObj => $Queue &>
-        <ul class="queue-roles">
+    <li class="queue-roles"><& /Ticket/Elements/ShowQueue, QueueObj => $Queue &>
+        <ul class="queue-role-list">
 %           for my $type (@types) {
                 <li class="queue-role"><% $type %></li>
 %           }

commit 1fea868b816d509fb520e4df1ebdcd7af3e72a9c
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Aug 20 17:58:56 2010 -0400

    Add Test::XPath dev dependency

diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 6de8b14..bf44a35 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -301,6 +301,7 @@ Test::Builder 0.77 # needed to fix TODO test
 Test::MockTime
 HTTP::Server::Simple::Mason 0.13
 Log::Dispatch::Perl
+Test::XPath
 .
 
 $deps{'FASTCGI'} = [ text_to_hash( << '.') ];

commit 261207e9592b5979d4cfe9b38f781ed02c605f0e
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Aug 20 17:59:06 2010 -0400

    First cut of watching-queues.t

diff --git a/t/web/watching-queues.t b/t/web/watching-queues.t
new file mode 100644
index 0000000..6a0176f
--- /dev/null
+++ b/t/web/watching-queues.t
@@ -0,0 +1,79 @@
+#!/usr/bin/perl -w
+use strict;
+
+use RT::Test tests => 20;
+use Test::XPath;
+my ($baseurl, $m) = RT::Test->started_ok;
+
+ok $m->login, 'logged in';
+
+diag "check watching page" if $ENV{'TEST_VERBOSE'};
+{
+    $m->follow_link( text => 'Tools' );
+    $m->title_is('Tools', 'tools screen');
+    $m->follow_link( text => 'Watching Queues' );
+    $m->title_is('Watching Queues', 'watching screen');
+
+    $m->content_contains('You are not watching any queues.');
+
+    # need to recover from embedded javascript using <!-- -->
+    my $tx = Test::XPath->new(xml => $m->content, is_html => 1, options => { recover => 1 });
+    $tx->not_ok('//ul[contains(@class,"queue-list")]', 'no queue list when watching nothing');
+}
+
+diag "add self as AdminCc on queue" if $ENV{'TEST_VERBOSE'};
+{
+    $m->follow_link( text => 'Configuration' );
+    $m->title_is('RT Administration', 'admin page');
+    $m->follow_link( text => 'Queues' );
+    $m->title_is('Admin queues', 'queues page');
+    $m->follow_link( text => 'General' );
+    $m->title_is('Editing Configuration for queue General');
+    $m->follow_link( text => 'Watchers' );
+    $m->title_is('Modify people related to queue General');
+
+    $m->submit_form_ok({
+        form_number => 3,
+        fields => {
+            UserField  => 'Name',
+            UserOp     => 'LIKE',
+            UserString => 'root',
+        },
+    });
+
+    $m->title_is('Modify people related to queue General', 'caught the right form! :)');
+
+    my $user = RT::User->new($RT::SystemUser);
+    $user->LoadByEmail('root at localhost');
+
+    $m->submit_form_ok({
+        form_number => 3,
+        fields => {
+            'Queue-AddWatcher-Principal-' . $user->id => 'AdminCc',
+        },
+    });
+
+    $m->title_is('Modify people related to queue General', 'caught the right form! :)');
+
+    my $queue = RT::Queue->new($RT::SystemUser);
+    $queue->Load('General');
+    ok($queue->IsWatcher(Type => 'AdminCc', PrincipalId => $user->PrincipalId), 'added root as AdminCc on General');
+}
+
+diag "check watching page" if $ENV{'TEST_VERBOSE'};
+{
+    $m->follow_link( text => 'Tools' );
+    $m->title_is('Tools', 'tools screen');
+    $m->follow_link( text => 'Watching Queues' );
+    $m->title_is('Watching Queues', 'watching screen');
+
+    $m->content_lacks('You are not watching any queues.');
+
+    # need to recover from embedded javascript using <!-- -->
+    my $tx = Test::XPath->new(xml => $m->content, is_html => 1, options => { recover => 1 });
+    $tx->ok('//ul[contains(@class,"queue-list")]', sub {
+        my $tx = shift;
+        $tx->is('count(//li[contains(@class,"queue-roles")])', 1, 'only one queue');
+    });
+}
+

commit 69db97cfce479723a82da990952ffb84a60791a7
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Aug 20 18:29:47 2010 -0400

    More markup for easier testing

diff --git a/share/html/Tools/Watching.html b/share/html/Tools/Watching.html
index b1b962b..f17e2e8 100644
--- a/share/html/Tools/Watching.html
+++ b/share/html/Tools/Watching.html
@@ -76,7 +76,8 @@ while (my $Queue = $Queues->Next) {
     $count += @types;
 </%perl>
 
-    <li class="queue-roles"><& /Ticket/Elements/ShowQueue, QueueObj => $Queue &>
+    <li class="queue-roles">
+        <span class="queue-name"><& /Ticket/Elements/ShowQueue, QueueObj => $Queue &></span>
         <ul class="queue-role-list">
 %           for my $type (@types) {
                 <li class="queue-role"><% $type %></li>

commit 804c44c99f5d35b36697a74a1390897a5777bb60
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Aug 20 18:30:09 2010 -0400

    Factor out new_tx function

diff --git a/t/web/watching-queues.t b/t/web/watching-queues.t
index 6a0176f..93ace7b 100644
--- a/t/web/watching-queues.t
+++ b/t/web/watching-queues.t
@@ -16,8 +16,7 @@ diag "check watching page" if $ENV{'TEST_VERBOSE'};
 
     $m->content_contains('You are not watching any queues.');
 
-    # need to recover from embedded javascript using <!-- -->
-    my $tx = Test::XPath->new(xml => $m->content, is_html => 1, options => { recover => 1 });
+    my $tx = new_tx($m->content);
     $tx->not_ok('//ul[contains(@class,"queue-list")]', 'no queue list when watching nothing');
 }
 
@@ -69,11 +68,23 @@ diag "check watching page" if $ENV{'TEST_VERBOSE'};
 
     $m->content_lacks('You are not watching any queues.');
 
-    # need to recover from embedded javascript using <!-- -->
-    my $tx = Test::XPath->new(xml => $m->content, is_html => 1, options => { recover => 1 });
+    my $tx = new_tx($m->content);
     $tx->ok('//ul[contains(@class,"queue-list")]', sub {
         my $tx = shift;
         $tx->is('count(//li[contains(@class,"queue-roles")])', 1, 'only one queue');
     });
 }
 
+sub new_tx {
+    my $content = shift;
+
+    # need to recover from embedded javascript using <!-- -->
+    my $tx = Test::XPath->new(
+        xml     => $content,
+        is_html => 1,
+        options => { recover => 1 },
+    );
+
+    return $tx;
+}
+

commit f2397e3632705f74b68998832f0170fdecfdbe8e
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Aug 20 18:30:16 2010 -0400

    Complete tests for making sure the queue/role list is correct (no more no less)

diff --git a/t/web/watching-queues.t b/t/web/watching-queues.t
index 93ace7b..02fefb0 100644
--- a/t/web/watching-queues.t
+++ b/t/web/watching-queues.t
@@ -1,12 +1,13 @@
 #!/usr/bin/perl -w
 use strict;
 
-use RT::Test tests => 20;
+use RT::Test tests => 25;
 use Test::XPath;
 my ($baseurl, $m) = RT::Test->started_ok;
 
 ok $m->login, 'logged in';
 
+
 diag "check watching page" if $ENV{'TEST_VERBOSE'};
 {
     $m->follow_link( text => 'Tools' );
@@ -70,8 +71,14 @@ diag "check watching page" if $ENV{'TEST_VERBOSE'};
 
     my $tx = new_tx($m->content);
     $tx->ok('//ul[contains(@class,"queue-list")]', sub {
-        my $tx = shift;
-        $tx->is('count(//li[contains(@class,"queue-roles")])', 1, 'only one queue');
+        $_->is('count(.//li[contains(@class,"queue-roles")])', 1, 'only one queue');
+        $_->ok('.//li[contains(@class,"queue-roles")]', sub {
+            $_->like('.//span[contains(@class,"queue-name")][text()]', qr/^\s*General\s*$/, 'correct queue');
+            $_->ok('.//ul[contains(@class,"queue-role-list")]', sub {
+                $_->is('count(.//li[contains(@class,"queue-role")])', 1, 'only one role');
+                $_->like('.//li[contains(@class,"queue-role")][text()]', qr/^\s*AdminCc\s*$/, 'correct role');
+            });
+        });
     });
 }
 

commit 79e5196f4c45340401d2b8678f64b10485845e55
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Aug 20 18:34:26 2010 -0400

    Make sure the list grows as we add more roles

diff --git a/t/web/watching-queues.t b/t/web/watching-queues.t
index 02fefb0..ec4f124 100644
--- a/t/web/watching-queues.t
+++ b/t/web/watching-queues.t
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 use strict;
 
-use RT::Test tests => 25;
+use RT::Test tests => 45;
 use Test::XPath;
 my ($baseurl, $m) = RT::Test->started_ok;
 
@@ -82,6 +82,68 @@ diag "check watching page" if $ENV{'TEST_VERBOSE'};
     });
 }
 
+diag "add self as Cc on queue" if $ENV{'TEST_VERBOSE'};
+{
+    $m->follow_link( text => 'Configuration' );
+    $m->title_is('RT Administration', 'admin page');
+    $m->follow_link( text => 'Queues' );
+    $m->title_is('Admin queues', 'queues page');
+    $m->follow_link( text => 'General' );
+    $m->title_is('Editing Configuration for queue General');
+    $m->follow_link( text => 'Watchers' );
+    $m->title_is('Modify people related to queue General');
+
+    $m->submit_form_ok({
+        form_number => 3,
+        fields => {
+            UserField  => 'Name',
+            UserOp     => 'LIKE',
+            UserString => 'root',
+        },
+    });
+
+    $m->title_is('Modify people related to queue General', 'caught the right form! :)');
+
+    my $user = RT::User->new($RT::SystemUser);
+    $user->LoadByEmail('root at localhost');
+
+    $m->submit_form_ok({
+        form_number => 3,
+        fields => {
+            'Queue-AddWatcher-Principal-' . $user->id => 'Cc',
+        },
+    });
+
+    $m->title_is('Modify people related to queue General', 'caught the right form! :)');
+
+    my $queue = RT::Queue->new($RT::SystemUser);
+    $queue->Load('General');
+    ok($queue->IsWatcher(Type => 'Cc', PrincipalId => $user->PrincipalId), 'added root as Cc on General');
+}
+
+diag "check watching page" if $ENV{'TEST_VERBOSE'};
+{
+    $m->follow_link( text => 'Tools' );
+    $m->title_is('Tools', 'tools screen');
+    $m->follow_link( text => 'Watching Queues' );
+    $m->title_is('Watching Queues', 'watching screen');
+
+    $m->content_lacks('You are not watching any queues.');
+
+    my $tx = new_tx($m->content);
+    $tx->ok('//ul[contains(@class,"queue-list")]', sub {
+        $_->is('count(.//li[contains(@class,"queue-roles")])', 1, 'only one queue');
+        $_->ok('.//li[contains(@class,"queue-roles")]', sub {
+            $_->like('.//span[contains(@class,"queue-name")][text()]', qr/^\s*General\s*$/, 'correct queue');
+            $_->ok('.//ul[contains(@class,"queue-role-list")]', sub {
+                $_->is('count(.//li[contains(@class,"queue-role")])', 2, 'two roles');
+                $_->like('.//li[contains(@class,"queue-role")][text()]', qr/AdminCc/, 'list includes AdminCc');
+                $_->like('.//li[contains(@class,"queue-role")][text()]', qr/(?<!Admin)Cc/, 'list includes Cc too');
+            });
+        });
+    });
+}
+
 sub new_tx {
     my $content = shift;
 

commit c0d16d6ee03e652601ff6b546410c225fb5dc489
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Aug 20 18:38:06 2010 -0400

    Test a second queue

diff --git a/t/web/watching-queues.t b/t/web/watching-queues.t
index ec4f124..95720da 100644
--- a/t/web/watching-queues.t
+++ b/t/web/watching-queues.t
@@ -1,12 +1,16 @@
 #!/usr/bin/perl -w
 use strict;
 
-use RT::Test tests => 45;
+use RT::Test tests => 70;
 use Test::XPath;
 my ($baseurl, $m) = RT::Test->started_ok;
 
 ok $m->login, 'logged in';
 
+my $other_queue = RT::Queue->new($RT::SystemUser);
+$other_queue->Create(
+    Name => 'Fancypants',
+);
 
 diag "check watching page" if $ENV{'TEST_VERBOSE'};
 {
@@ -21,7 +25,7 @@ diag "check watching page" if $ENV{'TEST_VERBOSE'};
     $tx->not_ok('//ul[contains(@class,"queue-list")]', 'no queue list when watching nothing');
 }
 
-diag "add self as AdminCc on queue" if $ENV{'TEST_VERBOSE'};
+diag "add self as AdminCc on General" if $ENV{'TEST_VERBOSE'};
 {
     $m->follow_link( text => 'Configuration' );
     $m->title_is('RT Administration', 'admin page');
@@ -82,7 +86,7 @@ diag "check watching page" if $ENV{'TEST_VERBOSE'};
     });
 }
 
-diag "add self as Cc on queue" if $ENV{'TEST_VERBOSE'};
+diag "add self as Cc on General" if $ENV{'TEST_VERBOSE'};
 {
     $m->follow_link( text => 'Configuration' );
     $m->title_is('RT Administration', 'admin page');
@@ -144,6 +148,75 @@ diag "check watching page" if $ENV{'TEST_VERBOSE'};
     });
 }
 
+diag "add self as AdminCc on Fancypants" if $ENV{'TEST_VERBOSE'};
+{
+    $m->follow_link( text => 'Configuration' );
+    $m->title_is('RT Administration', 'admin page');
+    $m->follow_link( text => 'Queues' );
+    $m->title_is('Admin queues', 'queues page');
+    $m->follow_link( text => 'Fancypants' );
+    $m->title_is('Editing Configuration for queue Fancypants');
+    $m->follow_link( text => 'Watchers' );
+    $m->title_is('Modify people related to queue Fancypants');
+
+    $m->submit_form_ok({
+        form_number => 3,
+        fields => {
+            UserField  => 'Name',
+            UserOp     => 'LIKE',
+            UserString => 'root',
+        },
+    });
+
+    $m->title_is('Modify people related to queue Fancypants', 'caught the right form! :)');
+
+    my $user = RT::User->new($RT::SystemUser);
+    $user->LoadByEmail('root at localhost');
+
+    $m->submit_form_ok({
+        form_number => 3,
+        fields => {
+            'Queue-AddWatcher-Principal-' . $user->id => 'AdminCc',
+        },
+    });
+
+    $m->title_is('Modify people related to queue Fancypants', 'caught the right form! :)');
+
+    ok($other_queue->IsWatcher(Type => 'AdminCc', PrincipalId => $user->PrincipalId), 'added root as AdminCc on Fancypants');
+}
+
+diag "check watching page" if $ENV{'TEST_VERBOSE'};
+{
+    $m->follow_link( text => 'Tools' );
+    $m->title_is('Tools', 'tools screen');
+    $m->follow_link( text => 'Watching Queues' );
+    $m->title_is('Watching Queues', 'watching screen');
+
+    $m->content_lacks('You are not watching any queues.');
+
+    my $tx = new_tx($m->content);
+    $tx->ok('//ul[contains(@class,"queue-list")]', sub {
+        $_->is('count(.//li[contains(@class,"queue-roles")])', 2, 'two queues');
+
+        $_->ok('.//li[contains(@class,"queue-roles")][contains(.//span[contains(@class,"queue-name")][text()],"General")]', sub {
+            $_->like('.//span[contains(@class,"queue-name")][text()]', qr/^\s*General\s*$/, 'correct queue');
+            $_->ok('.//ul[contains(@class,"queue-role-list")]', sub {
+                $_->is('count(.//li[contains(@class,"queue-role")])', 2, 'two roles');
+                $_->like('.//li[contains(@class,"queue-role")][text()]', qr/AdminCc/, 'list includes AdminCc');
+                $_->like('.//li[contains(@class,"queue-role")][text()]', qr/(?<!Admin)Cc/, 'list includes Cc too');
+            });
+        });
+
+        $_->ok('.//li[contains(@class,"queue-roles")][contains(.//span[contains(@class,"queue-name")][text()],"Fancypants")]', sub {
+            $_->like('.//span[contains(@class,"queue-name")][text()]', qr/^\s*Fancypants\s*$/, 'correct queue');
+            $_->ok('.//ul[contains(@class,"queue-role-list")]', sub {
+                $_->is('count(.//li[contains(@class,"queue-role")])', 1, 'one roles');
+                $_->like('.//li[contains(@class,"queue-role")][text()]', qr/^\s*AdminCc\s*$/, 'correct role');
+            });
+        });
+    });
+}
+
 sub new_tx {
     my $content = shift;
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list