Bugzilla – Attachment 82287 Details for
Bug 21777
Checkouts table in circulation is out of alignment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21777: Add a regression test
Bug-21777-Add-a-regression-test.patch (text/plain), 4.21 KB, created by
Tomás Cohen Arazi (tcohen)
on 2018-11-13 15:01:31 UTC
(
hide
)
Description:
Bug 21777: Add a regression test
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2018-11-13 15:01:31 UTC
Size:
4.21 KB
patch
obsolete
>From cc8f96c5003f5690b757972b562367432ed4a4f8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 7 Nov 2018 14:23:27 -0300 >Subject: [PATCH] Bug 21777: Add a regression test > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/selenium/regressions.t | 93 ++++++++++++++++++++++++++- > 1 file changed, 92 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/selenium/regressions.t b/t/db_dependent/selenium/regressions.t >index 4c6cd9957c..84c6d62ccd 100644 >--- a/t/db_dependent/selenium/regressions.t >+++ b/t/db_dependent/selenium/regressions.t >@@ -19,9 +19,12 @@ use Modern::Perl; > > use C4::Context; > >-use Test::More tests => 3; >+use Test::More tests => 4; >+use Test::MockModule; > > use C4::Context; >+use C4::Biblio qw( AddBiblio ); >+use C4::Circulation; > use Koha::AuthUtils; > use t::lib::Selenium; > use t::lib::TestBuilder; >@@ -113,8 +116,96 @@ subtest 'Play sound on the circulation page' => sub { > push @cleanup, $patron, $patron->category, $patron->library; > }; > >+subtest 'Display circulation table correctly' => sub { >+ plan tests => 1; >+ >+ my $builder = t::lib::TestBuilder->new; >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { branchcode => $library->branchcode, flags => 0 } >+ } >+ ); >+ >+ my ( $biblionumber, $biblioitemnumber ) = add_biblio(); >+ my $item = $builder->build_object( >+ { >+ class => 'Koha::Items', >+ value => { >+ biblionumber => $biblionumber, >+ homebranch => $library->branchcode, >+ holdingbranch => $library->branchcode, >+ notforloan => 0, >+ itemlost => 0, >+ withdrawn => 0, >+ } >+ } >+ ); >+ my $context = Test::MockModule->new('C4::Context'); >+ $context->mock( >+ 'userenv', >+ sub { >+ return { branch => $library->branchcode }; >+ } >+ ); >+ >+ C4::Circulation::AddIssue( $patron->unblessed, $item->barcode ); >+ >+ my $mainpage = $s->base_url . q|mainpage.pl|; >+ $driver->get($mainpage . q|?logout.x=1|); >+ $s->auth; >+ >+ $driver->get( $base_url >+ . "/circ/circulation.pl?borrowernumber=" >+ . $patron->borrowernumber ); >+ >+ # Display the table clicking on the "Show checkouts" button >+ $driver->find_element('//a[@id="issues-table-load-now-button"]')->click; >+ >+ my @thead_th = $driver->find_elements('//table[@id="issues-table"]/thead/tr/th'); >+ my $thead_length = 0; >+ $thead_length += $_->get_attribute('colspan') || 0 for @thead_th; >+ >+ my @tfoot_td = $driver->find_elements('//table[@id="issues-table"]/tfoot/tr/td'); >+ my $tfoot_length = 0; >+ $tfoot_length += $_->get_attribute('colspan') || 0 for @tfoot_td; >+ >+ my @tbody_td = $driver->find_elements('//table[@id="issues-table"]/tbody/tr/td'); >+ my $tbody_length = 0; >+ $tbody_length += $_->get_attribute('colspan') || 0 for @tbody_td; >+ >+ is( $thead_length == $tfoot_length && $tfoot_length == $tbody_length, >+ 1, "Checkouts table must be correctly aligned" ) >+ or diag( >+ "thead: $thead_length ; tfoot: $tfoot_length ; tbody: $tbody_length"); >+ >+ push @cleanup, $patron->checkouts, $item->biblio, $item, $patron, >+ $patron->category, $library; >+}; >+ > END { > C4::Context->preference('SearchEngine', $SearchEngine_value); > C4::Context->preference('AudioAlerts', $AudioAlerts_value); > $_->delete for @cleanup; > }; >+ >+sub add_biblio { >+ my ($title, $author) = @_; >+ >+ my $marcflavour = C4::Context->preference('marcflavour'); >+ >+ my $biblio = MARC::Record->new(); >+ my ( $tag, $code ); >+ $tag = $marcflavour eq 'UNIMARC' ? '200' : '245'; >+ $biblio->append_fields( >+ MARC::Field->new($tag, ' ', ' ', a => $title || 'a title'), >+ ); >+ >+ ($tag, $code) = $marcflavour eq 'UNIMARC' ? (200, 'f') : (100, 'a'); >+ $biblio->append_fields( >+ MARC::Field->new($tag, ' ', ' ', $code => $author || 'an author'), >+ ); >+ >+ return C4::Biblio::AddBiblio($biblio, ''); >+} >-- >2.19.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21777
:
82021
|
82023
|
82043
|
82231
| 82287 |
82288
|
82320