3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
21 use Koha::BackgroundJobs;
23 use Test::More tests => 2;
26 use t::lib::TestBuilder;
29 my $builder = t::lib::TestBuilder->new;
31 my $login = $ENV{KOHA_USER} || 'koha';
36 eval { require Selenium::Remote::Driver; };
37 skip "Selenium::Remote::Driver is needed for selenium tests.", 2 if $@;
39 my $s = t::lib::Selenium->new;
40 my $driver = $s->driver;
41 $driver->set_window_size(3840,1080);
42 my $mainpage = $s->base_url . q|mainpage.pl|;
43 $driver->get($mainpage);
44 like( $driver->get_title(), qr(Log in to Koha), );
47 subtest 'test encoding sent to the broker' => sub {
48 my $item = $builder->build_sample_item;
50 # Navigate to the batch item mod tool
52 { href => '/cataloguing/cataloging-home.pl', main => 'container-main' }
55 { href => 'tools/batchMod.pl', main_class => 'main container-fluid' } );
56 $driver->find_element('//textarea[@id="barcodelist"]')->send_keys($item->barcode);
58 my $itemnotes = q{✔ ❤ ★};
59 $driver->find_element('//input[@name="items.itemnotes"]')
60 ->send_keys($itemnotes);
63 my $view_detail_link = $driver->find_element('//a[contains(@href, "/cgi-bin/koha/admin/background_jobs.pl?op=view&id=")]');
64 my $href = $view_detail_link->get_attribute('href');
66 if ( $href =~ m{id=(\d+)} ) {
69 my $job = Koha::BackgroundJobs->find($job_id);
71 while ( $job->discard_changes->status ne 'finished' ) {
75 is ( $job->status, 'finished', 'job is finished' );
77 is( Koha::Items->find($item->itemnumber)->itemnotes, $itemnotes );
79 push @cleanup, $item, $item->biblio;
86 $_->delete for @cleanup;