in reply to Re^3: Failing Tests in MozRepl
in thread Failing Tests in MozRepl

Thank you. Using WWW::Mechanize::Firefox is indeed my goal. After forcing installation of MozRepl, I was able to install MozRepl::RemoteObject, but WWW::Mechanize::Firefox fails some tests:
t/51-click_button.t ............... Got status code 500 at t/51-click_ +button.t line 32 # Looks like your test exited with 255 before it could output anything +. t/51-click_button.t ............... Dubious, test returned 255 (wstat +65280, 0xff00) Failed 13/13 subtests (...) t/70-real-status.t ................ 9/11 # Failed test 'We got the correct error number (404)' # at t/70-real-status.t line 61. # got: '500' # expected: '404' # Looks like you failed 1 test of 11. t/70-real-status.t ................ Dubious, test returned 1 (wstat 25 +6, 0x100) Failed 1/11 subtests (...) t/75-save_url-cookies.t ........... 4/8 # Failed test 'We sent the magic cookie' # at t/75-save_url-cookies.t line 58. # 'Request: # GET / HTTP/1.1 # Connection: keep-alive # Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q= +0.8 # Accept-Encoding: gzip, deflate # Accept-Language: en-us,en;q=0.5 # Host: localhost:56864 # User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20100101 Fi +refox/10.0 # Cookie: log-server-httponly=supersecret; log-server=shazam2 # # # ' # doesn't match '(?^m:^Cookie:.*? www_mechanize_firefox_test\=t\/7 +5\-save_url\-cookies\.t\-shazam)' t/75-save_url-cookies.t ........... 6/8 # Failed test 'We sent the magic cookie' # at t/75-save_url-cookies.t line 67. # 'Request: # GET /save_url_test HTTP/1.1 # Connection: keep-alive # Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q= +0.8 # Accept-Encoding: gzip, deflate # Accept-Language: en-us,en;q=0.5 # Host: localhost:56864 # User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20100101 Fi +refox/10.0 # Cookie: log-server-httponly=supersecret; log-server=shazam2 # # # ' # doesn't match '(?^m:^Cookie:.*? www_mechanize_firefox_test\=t\/7 +5\-save_url\-cookies\.t\-shazam)' # Looks like you failed 2 tests of 8. t/75-save_url-cookies.t ........... Dubious, test returned 2 (wstat 51 +2, 0x200) Failed 2/8 subtests

Replies are listed 'Best First'.
Re^5: Failing Tests in MozRepl
by Corion (Patriarch) on Feb 12, 2012 at 10:20 UTC

    This could be a problem with the local test server not starting up or the browser not (always) getting a connection to it. Is the machine under heavy load? THe tests expect the server to be up after 1 second or so...

    The second error seems to be that cookies are not sent, or already have expired. The test cookies get an expiry of 5 seconds. If the machine is under heavy load, that timeout might be too fast, as well...

      Thanks again.
      I ran the install several times, the first failure happens only sometimes (approx. half of the runs). The second errors appear always. It's running on my home machine under no load at all (but it is an older Pentium 4): tested with just fvwm2, firefox and cpan running.

        This is really weird, this seems to be a peculiarity of your setup. As most tests are passing, I would venture that it's safe to force-install, but it seems that at least sending cookies when downloading a file is broken.

        I can't reproduce the problem locally, so maybe there is some finer stuff in the module (or software) versions. The output of this test file looks for me as follows:

        #!perl -T use strict; use warnings; use Test::More tests => 1; my $module; BEGIN { $module = "WWW::Mechanize::Firefox"; require_ok( $module ); } diag( sprintf "Testing %s %s, Perl %s", $module, $module->VERSION, $] +); for (sort grep /\.pm\z/, keys %INC) { s/\.pm\z//; s!/!::!g; eval { diag(join(' ', $_, $_->VERSION || '<unknown>')) }; } __END__ > perl -Ilib -wT t\00-load.t 1..1 ok 1 - require WWW::Mechanize::Firefox; # Testing WWW::Mechanize::Firefox 0.59, Perl 5.012001 # AutoLoader 5.70 # CPAN::Meta::YAML 0.003 # Carp 1.16 # Config <unknown> # Cwd 3.31 # DynaLoader 1.10 # Encode 2.39 # Encode::Alias 2.12 # Encode::Config 2.05 # Encode::Encoding 2.05 # Exporter 5.64_01 # Exporter::Heavy 5.64_01 # Fcntl 1.06 # File::Basename 2.78 # File::HomeDir::Driver 0.98 # File::Spec 3.31 # File::Spec::Unix 3.3 # File::Spec::Win32 3.3 # FileHandle 2.02 # Firefox::Application 0.59 # HTML::Selector::XPath 0.06 # HTTP::Cookies 6.00 # HTTP::Cookies::MozRepl 0.59 # HTTP::Cookies::Netscape 6.00 # HTTP::Date 6.00 # HTTP::Headers 6.00 # HTTP::Headers::Util 6.00 # HTTP::Message 6.02 # HTTP::Response 6.01 # HTTP::Status 6.00 # IO 1.25_02 # IO::File 1.14 # IO::Handle 1.28 # IO::Seekable 1.1 # JSON 2.53 # JSON::XS 2.3 # List::Util 1.23 # MIME::Base64 3.09 # MozRepl::RemoteObject 0.29 # MozRepl::RemoteObject::Methods 0.29 # Parse::CPAN::Meta 1.4401 # PerlIO 1.06 # Portable 0.13 # Portable::CPAN 0.13 # Portable::Config 0.13 # Portable::HomeDir 0.13 # Portable::minicpan 0.13 # Scalar::Util 1.23 # SelectSaver 1.02 # Storable 2.22 # Symbol 1.07 # Test::Builder 0.98 # Test::Builder::Module 0.98 # Test::More 0.98 # Time::HiRes 1.9721 # Time::Local 1.1901_01 # URI 1.54 # URI::Escape 3.30 # WWW::Mechanize::Firefox 0.59 # WWW::Mechanize::Link <unknown> # XSLoader 0.10 # attributes 0.12 # base 2.15 # bytes 1.04 # common::sense 3.4 # constant 1.20 # overload 1.10 # parent 0.223 # re 0.11 # strict 1.04 # utf8 1.08 # vars 1.01 # warnings 1.09 # warnings::register 1.01

        But I doubt that the difference really lies on the Perl side of things. Modifying t/50-app-new.t to also output the mozrepl version shows for my test setup that the tests pass across 1.1beta2 and 1.1.0:

        eval { @addons = $ff->addons; $lives++ }; ok $lives, "We can query the addons" or diag $@; diag "Found " . scalar @addons . " addons"; ok @addons >= 1, "You have at least one addon"; # The mozrepl addo +n, duh my ($mozrepl) = grep { $_->{id} eq 'mozrepl@hyperstruct.net' } @ad +dons; isn't $mozrepl, undef, "We find the mozrepl addon"; is $mozrepl->{name}, 'MozRepl', 'The name is "MozRepl"'; diag "Using MozRepl version $mozrepl->{version}";

        If you have any other mozrepl version, that could be an easy solution, but you already said you use 1.1.0.