[Bps-public-commit] RTx-TakeScreenshots branch, master, updated. 2d8bf37ff4892efcf3efc60216b814bf66966c08

Thomas Sibley trs at bestpractical.com
Tue Mar 8 16:03:55 EST 2011


The branch, master has been updated
       via  2d8bf37ff4892efcf3efc60216b814bf66966c08 (commit)
       via  970e52c36617c661c55cdbb16fd767f81d87e4a2 (commit)
       via  8ae81f3f63e297d2a04590e6040057f3f78e9d2a (commit)
       via  1620d66587973e0ebbf3f2a490e8b3af6c8e3b1d (commit)
       via  e65563af7ddaf78bbebf127182cfcdee3fc4f384 (commit)
       via  7b544c220760281e26068dcc80040519f34d719d (commit)
      from  1095c8347af7e4800c1a50ce02f6d556ebed604f (commit)

Summary of changes:
 Makefile.PL                    |    8 -----
 bin/take-screenshots           |   31 ++++++++++++++----
 etc/initialdata                |   21 +++++++++++-
 inc/Module/Install/External.pm |   66 ----------------------------------------
 4 files changed, 43 insertions(+), 83 deletions(-)
 delete mode 100644 inc/Module/Install/External.pm

- Log -----------------------------------------------------------------
commit 7b544c220760281e26068dcc80040519f34d719d
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Mar 8 14:33:43 2011 -0500

    Remove the unneeded M::I plugin now

diff --git a/inc/Module/Install/External.pm b/inc/Module/Install/External.pm
deleted file mode 100644
index 5e29f10..0000000
--- a/inc/Module/Install/External.pm
+++ /dev/null
@@ -1,66 +0,0 @@
-#line 1
-package Module::Install::External;
-
-# Provides dependency declarations for external non-Perl things
-
-use strict;
-use Module::Install::Base ();
-
-use vars qw{$VERSION $ISCORE @ISA};
-BEGIN {
-	$VERSION = '1.00';
-	$ISCORE  = 1;
-	@ISA     = qw{Module::Install::Base};
-}
-
-sub requires_external_cc {
-	my $self = shift;
-
-	# We need a C compiler, use the can_cc method for this
-	unless ( $self->can_cc ) {
-		print "Unresolvable missing external dependency.\n";
-		print "This package requires a C compiler.\n";
-		print STDERR "NA: Unable to build distribution on this platform.\n";
-		exit(0);
-	}
-
-	# Unlike some of the other modules, while we need to specify a
-	# C compiler as a dep, it needs to be a build-time dependency.
-
-	1;
-}
-
-sub requires_external_bin {
-	my ($self, $bin, $version) = @_;
-	if ( $version ) {
-		die "requires_external_bin does not support versions yet";
-	}
-
-	# Load the package containing can_run early,
-	# to avoid breaking the message below.
-	$self->load('can_run');
-
-	# Locate the bin
-	print "Locating required external dependency bin:$bin...";
-	my $found_bin = $self->can_run( $bin );
-	if ( $found_bin ) {
-		print " found at $found_bin.\n";
-	} else {
-		print " missing.\n";
-		print "Unresolvable missing external dependency.\n";
-		print "Please install '$bin' seperately and try again.\n";
-		print STDERR "NA: Unable to build distribution on this platform.\n";
-		exit(0);
-	}
-
-	# Once we have some way to specify external deps, do it here.
-	# In the mean time, continue as normal.
-
-	1;
-}
-
-1;
-
-__END__
-
-#line 138

commit e65563af7ddaf78bbebf127182cfcdee3fc4f384
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Mar 8 15:58:47 2011 -0500

    Ignore empty lines in the DATA section

diff --git a/bin/take-screenshots b/bin/take-screenshots
index addc8a1..6c8492f 100755
--- a/bin/take-screenshots
+++ b/bin/take-screenshots
@@ -23,7 +23,7 @@ unless ($RT) {
 
 # title|path -> [title, path]
 my @pages = map  { [ split /\|/, $_, 2 ] }
-            grep { not /^#/ }
+            grep { not /^#/ and /\S/ }
             map  { chomp; $_ }
                  <DATA>;
 

commit 1620d66587973e0ebbf3f2a490e8b3af6c8e3b1d
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Mar 8 15:59:23 2011 -0500

    Use a cross-platform Javascript resizing solution instead
    
    This didn't work previously during my testing of alternate methods, but
    now it works just fine.  Odd.

diff --git a/Makefile.PL b/Makefile.PL
index 5061c7d..b9e28ff 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -3,12 +3,4 @@ use inc::Module::Install;
 RTx('RTx-TakeScreenshots');
 all_from('lib/RTx/TakeScreenshots.pm');
 
-if (not can_run('wmctrl')) {
-    warn <<'.';
-You don't appear to have wmctrl installed.  The take-screenshots script
-requires this external utility to resize the browser window after Selenium
-starts up.  It is, unfortunately, X only.
-.
-}
-
 &WriteAll;
diff --git a/bin/take-screenshots b/bin/take-screenshots
index 6c8492f..dda7e39 100755
--- a/bin/take-screenshots
+++ b/bin/take-screenshots
@@ -37,11 +37,8 @@ $firefox->type('name=user', 'jesse');
 $firefox->type('name=pass', 'password');
 $firefox->submit('id=login');
 
-# Hack to resize the browser window.  Width is what we really care about, since
-# the screenshots are stitched together vertically to capture the entire page.
-my ($title) = $firefox->get_all_window_titles;
-system qq[wmctrl -r "$title - Mozilla Firefox" -e 0,0,0,975,700];
-$firefox->pause(2000); # give wmctrl time to catch up
+# Resize to something reasonable
+resize_window($firefox, 975, 400);
 
 # Save the subscription so we see it on the homepage
 for my $subscribe (grep { $_->[1] =~ /Dashboards\/Subscription/ } @pages) {
@@ -80,6 +77,13 @@ for my $page (@pages) {
 
 $firefox->stop;
 
+
+sub resize_window {
+    my ($window, $w, $h) = @_;
+    $window->run_script("window.moveTo(0,0); window.resizeTo($w, $h);");
+    $window->pause(1000);
+}
+
 __DATA__
 homepage|/index.html
 ticket_basics|/Ticket/Display.html?id=1

commit 8ae81f3f63e297d2a04590e6040057f3f78e9d2a
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Mar 8 16:01:24 2011 -0500

    Add a quoted HTML reply in order to show off message folding
    
    This switches our ticket history screenshot to the first ticket where
    this reply is located.
    
    For the folding to actually be triggered by the blockquotes here, you
    need the 4.0/allow-blockquotes branch.

diff --git a/bin/take-screenshots b/bin/take-screenshots
index dda7e39..f7d0b38 100755
--- a/bin/take-screenshots
+++ b/bin/take-screenshots
@@ -87,7 +87,7 @@ sub resize_window {
 __DATA__
 homepage|/index.html
 ticket_basics|/Ticket/Display.html?id=1
-ticket_history|/Ticket/History.html?id=2
+ticket_history|/Ticket/History.html?id=1
 search_results|/Search/Results.html?Query=id+<+4;Order=DESC
 search_bulk_update|/Search/Bulk.html?Query=id+<+4;Order=DESC
 ticket_relationships|/Ticket/Graphs/index.html?id=1&Direction=LR&LeadingLink=DependsOn&MaxDepth=0&ShowLinks=MemberOf&ShowLinks=RefersTo&FillUsing=&Level-1-Properties=Subject&Level-1-Properties=Status&Level-2-Properties=Subject&Level-2-Properties=Status&Level-3-Properties=Subject&Level-3-Properties=Status&Update=Update+Graph&SavedSearchId=new&SavedSearchOwner=RT::User-12&SavedSearchDescription=&SavedSearchLoad=
diff --git a/etc/initialdata b/etc/initialdata
index 877a01d..8ddbc47 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -156,13 +156,30 @@ RFP sent out to the vendors.
         }
     },
     sub {
-        # Comment on ticket #1
+        # Reply to ticket #1
         my $user = RT::User->new( RT->SystemUser );
         $user->Load('jesse');
 
         my $ticket = RT::Ticket->new( $user );
         $ticket->Load(1);
-        $ticket->Correspond( Content => "I'll look into this ASAP." );
+        $ticket->Correspond(
+            MIMEObj => MIME::Entity->build(
+                Type => 'text/html',
+                Data => [<<'.'
+<blockquote>
+<p style="color: red; font-size: xx-large;">The worst has happened.</p>
+<p><b>There's no coffee to be found anywhere in the office.</b></p>
+</blockquote>
+
+<p>I'll look into this ASAP.  Thanks for the heads up.</p><script>alert("hi");</script>
+
+<blockquote>
+<p>Productivity is at an <u>all-time low</u>!</p>
+</blockquote>
+.
+                ],
+            )
+        );
     },
     sub {
         # Setup dashboards

commit 970e52c36617c661c55cdbb16fd767f81d87e4a2
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Mar 8 16:03:00 2011 -0500

    Screenshot a couple mobile pages too
    
    Once we hit a mobile page in our list, we resize the browser to more
    mobile-like dimensions.

diff --git a/bin/take-screenshots b/bin/take-screenshots
index f7d0b38..7ee102e 100755
--- a/bin/take-screenshots
+++ b/bin/take-screenshots
@@ -66,12 +66,20 @@ for my $subscribe (grep { $_->[1] =~ /Dashboards\/Subscription/ } @pages) {
     $firefox->capture_entire_page_screenshot("$output/ticket_create.png");
 }
 
+my $resized = 0;
+
 # Capture the pages we want
 for my $page (@pages) {
     my ($title, $url) = @$page;
 
     print "Screenshotting $title\n";
     $firefox->open("$RT$url");
+
+    if ($url =~ m{^/m/} and not $resized) {
+        resize_window($firefox, 416, 400);
+        $resized = 1;
+    }
+
     $firefox->capture_entire_page_screenshot("$output/$title.png");
 }
 
@@ -93,3 +101,7 @@ search_bulk_update|/Search/Bulk.html?Query=id+<+4;Order=DESC
 ticket_relationships|/Ticket/Graphs/index.html?id=1&Direction=LR&LeadingLink=DependsOn&MaxDepth=0&ShowLinks=MemberOf&ShowLinks=RefersTo&FillUsing=&Level-1-Properties=Subject&Level-1-Properties=Status&Level-2-Properties=Subject&Level-2-Properties=Status&Level-3-Properties=Subject&Level-3-Properties=Status&Update=Update+Graph&SavedSearchId=new&SavedSearchOwner=RT::User-12&SavedSearchDescription=&SavedSearchLoad=
 dashboard|/Dashboards/10/SLA+Performance
 dashboard_subscription|/Dashboards/Subscription.html?id=10
+# Once we hit a mobile page, we resize to a smaller window.  Only mobile pages
+# should be below this line.
+mobile|/m/
+mobile_ticket_basics|/m/ticket/show?id=1

commit 2d8bf37ff4892efcf3efc60216b814bf66966c08
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Mar 8 16:03:49 2011 -0500

    Screenshot the shiny new theme editor

diff --git a/bin/take-screenshots b/bin/take-screenshots
index 7ee102e..738bc54 100755
--- a/bin/take-screenshots
+++ b/bin/take-screenshots
@@ -101,6 +101,7 @@ search_bulk_update|/Search/Bulk.html?Query=id+<+4;Order=DESC
 ticket_relationships|/Ticket/Graphs/index.html?id=1&Direction=LR&LeadingLink=DependsOn&MaxDepth=0&ShowLinks=MemberOf&ShowLinks=RefersTo&FillUsing=&Level-1-Properties=Subject&Level-1-Properties=Status&Level-2-Properties=Subject&Level-2-Properties=Status&Level-3-Properties=Subject&Level-3-Properties=Status&Update=Update+Graph&SavedSearchId=new&SavedSearchOwner=RT::User-12&SavedSearchDescription=&SavedSearchLoad=
 dashboard|/Dashboards/10/SLA+Performance
 dashboard_subscription|/Dashboards/Subscription.html?id=10
+theme_editor|/Admin/Global/Theme.html
 # Once we hit a mobile page, we resize to a smaller window.  Only mobile pages
 # should be below this line.
 mobile|/m/

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



More information about the Bps-public-commit mailing list