From 96fec3a16d66ffa30da9682e91069195f6eb831e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 2 Nov 2016 11:54:12 +0000 Subject: [PATCH] Bug 17540: (Bug 7216 followup) Fix tests for auth_values_input_www.t This is caused by bug 17216 which modified the structure of the AV admin page Test plan: prove t/db_dependent/www/auth_values_input_www.t should return green Signed-off-by: Josef Moravec Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall --- t/db_dependent/www/auth_values_input_www.t | 39 ++++++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/t/db_dependent/www/auth_values_input_www.t b/t/db_dependent/www/auth_values_input_www.t index bcb441dd07..265865c41c 100644 --- a/t/db_dependent/www/auth_values_input_www.t +++ b/t/db_dependent/www/auth_values_input_www.t @@ -18,7 +18,7 @@ use Modern::Perl; use utf8; -use Test::More tests => 28; +use Test::More tests => 33; use Test::WWW::Mechanize; use XML::Simple; use JSON; @@ -71,18 +71,32 @@ $agent->get_ok( "$intranet/cgi-bin/koha/mainpage.pl", 'load main page' ); $category = '学協会μμ'; $dbh->do(q|DELETE FROM authorised_values WHERE category = ?|, undef, $category); +$dbh->do(q|DELETE FROM authorised_value_categories WHERE category_name = ?|, undef, $category); +$expected_base = q|authorised_values.pl|; $agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Connect to Authorized values page' ); $agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form", 'Open to create a new category' ); +$agent->form_name('Aform'); +$agent->field('category', $category); +$agent->click_ok( '', "Create new AV category " ); + +$agent->base_like(qr|$expected_base|, "check base"); +$add_form_link_exists = 0; +for my $link ( $agent->links() ) { + if ( $link->url =~ m|authorised_values.pl\?op=add_form&category=$category| ) { + $add_form_link_exists = 1; + } +} +is( $add_form_link_exists, 1, 'Add a new category button should be displayed'); +$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form&category=$category", 'Open to create a new AV for this category' ); + $agent->form_name('Aform'); $agent->field('authorised_value', 'επιμεq'); $agent->field('lib_opac', 'autdesc2'); $agent->field('lib', 'desc1'); -$agent->field('category', $category); $agent->field('branches', ''); -$agent->click_ok( '', "Create new auth category and value" ); +$agent->click_ok( '', "Create a new value for the category" ); -$expected_base = q|authorised_values.pl|; $agent->base_like(qr|$expected_base|, "check base"); $add_form_link_exists = 0; $delete_form_link_exists = 0; @@ -93,8 +107,8 @@ for my $link ( $agent->links() ) { $delete_form_link_exists = 1; } } -is( $add_form_link_exists, 1, ); -is( $delete_form_link_exists, 1, ); +is( $add_form_link_exists, 1, 'Add a new category button should be displayed'); +is( $delete_form_link_exists, 1, ''); $agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Return to Authorized values page' ); $agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?searchfield=学協会μμ&offset=0", 'Search the values inserted' ); @@ -122,20 +136,23 @@ if ($id_to_del) { $category = 'tòmas'; $dbh->do(q|DELETE FROM authorised_values WHERE category = ?|, undef, $category); +$dbh->do(q|DELETE FROM authorised_value_categories WHERE category_name = ?|, undef, $category); $agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Connect to Authorized values page' ); $agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form", 'Open to create a new category' ); $agent->form_name('Aform'); +$agent->field('category', $category); +$agent->click_ok( '', "Create new AV category" ); + +$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form&category=$category", 'Open to create a new AV for this category' ); +$agent->form_name('Aform'); $agent->field('authorised_value', 'ràmen'); $agent->field('lib_opac', 'autdesc2'); $agent->field('lib', 'desc1'); -$agent->field('category', $category); $agent->field('branches', ''); -$agent->click_ok( '', "Create new auth category and value" ); -$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?searchfield=tòmas&offset=0", 'Search the values inserted' ); +$agent->click_ok( '', "Create a new value for the category" ); -$expected_base = q|authorised_values.pl\?searchfield=| . uri_escape_utf8( $category ); -#$expected_base = q|authorised_values.pl\?searchfield=| . $category; +$expected_base = q|authorised_values.pl|; $agent->base_like(qr|$expected_base|, "check base"); $add_form_link_exists = 0; $delete_form_link_exists = 0; -- 2.39.5