Bugzilla – Attachment 70163 Details for
Bug 19243
Selenium test for testing the administration module functionality - part 1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19243: Fix tests for AV
Bug-19243-Fix-tests-for-AV.patch (text/plain), 4.36 KB, created by
Jonathan Druart
on 2017-12-26 19:25:34 UTC
(
hide
)
Description:
Bug 19243: Fix tests for AV
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-12-26 19:25:34 UTC
Size:
4.36 KB
patch
obsolete
>From b58164854f7115919c38c950b468e62d6ca62f00 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 26 Dec 2017 16:09:41 -0300 >Subject: [PATCH] Bug 19243: Fix tests for AV > >The tricky part here was to find an alternative for ends-with in Xpath >version 1 >Indeed there are 2 button with >"/admin/authorised_values.pl?op=add_form", and the first one was picked >(/admin/authorised_values.pl?op=add_form&category=Asort1) >--- > t/db_dependent/selenium/administration_tasks.t | 28 ++++++++++++++++++++++---- > t/lib/Selenium.pm | 17 +++++++++++++++- > 2 files changed, 40 insertions(+), 5 deletions(-) > >diff --git a/t/db_dependent/selenium/administration_tasks.t b/t/db_dependent/selenium/administration_tasks.t >index d02eb9a82b..0c9d8e9373 100644 >--- a/t/db_dependent/selenium/administration_tasks.t >+++ b/t/db_dependent/selenium/administration_tasks.t >@@ -32,7 +32,7 @@ my $login = $ENV{KOHA_USER} || 'koha'; > my $itemtype = 'UT_DVD'; > my $frameworkcode = 'UTFW'; # frameworkcode is only 4 characters max! > my $branchcode = 'UT_BC'; >-my $categoryname = 'Test'; >+my $av_category = 'AV_CAT_TEST'; > our ($cleanup_needed); > > SKIP: { >@@ -132,16 +132,35 @@ SKIP: { > > $s->click( { href => '/admin/authorised_values.pl', main => 'doc' } ); #Authorized values > >- $s->click( { href => '/admin/authorised_values.pl?op=add_form&category=Adult', main => 'doc3' } ); # New category >- $s->fill_form( { authorised_value => 'Hardover', lib => 'Hardcover book'} ); >+ $s->click( { href => { 'ends-with' => '/admin/authorised_values.pl?op=add_form' }, main => 'doc3' } ); # New category >+ $s->fill_form( { category => $av_category } ); > $s->submit_form; > > $s->click( > { >- href => '/admin/authorised_values.pl?op=delete&searchfield=Adult&id=400', >+ href => '/admin/authorised_values.pl?op=add_form&category=' . $av_category, >+ main => 'doc3' >+ } >+ ); # New authorised value for ... >+ $s->fill_form( >+ { >+ authorised_value => "$av_category" . "_xxx", >+ lib => "This is a description for staff", >+ lib_opac => "This is a description for OPAC" >+ } >+ ); >+ $s->submit_form; >+ >+ my $dbh = C4::Context->dbh; >+ my ( $av_id ) = $dbh->selectrow_array(q| >+ SELECT id FROM authorised_values WHERE category=?|, undef, $av_category ); >+ $s->click( >+ { >+ href => '/admin/authorised_values.pl?op=delete&searchfield=' . $av_category . '&id=' . $av_id, > main => 'doc3' > } > ); >+ $s->driver->accept_alert; > }; > > { #Patron categories >@@ -172,4 +191,5 @@ sub cleanup { > $dbh->do(q|DELETE FROM itemtypes WHERE itemtype=?|, undef, $itemtype); > $dbh->do(q|DELETE FROM biblio_framework WHERE frameworkcode=?|, undef, $frameworkcode); > $dbh->do(q|DELETE FROM branches WHERE branchcode=?|, undef, $branchcode); >+ $dbh->do(q|DELETE FROM authorised_value_categories WHERE category_name=?|, undef, $av_category); > } >diff --git a/t/lib/Selenium.pm b/t/lib/Selenium.pm >index f33e26981c..6741f62d32 100644 >--- a/t/lib/Selenium.pm >+++ b/t/lib/Selenium.pm >@@ -99,7 +99,22 @@ sub click { > $xpath_selector = '//div[@id="'.$params->{main}.'"]'; > } > if ( exists $params->{href} ) { >- $xpath_selector .= '//a[contains(@href, "'.$params->{href}.'")]'; >+ if ( ref( $params->{href} ) ) { >+ for my $k ( keys %{ $params->{href} } ) { >+ if ( $k eq 'ends-with' ) { >+ # ends-with version for xpath version 1 >+ my $ends_with = $params->{href}{"ends-with"}; >+ $xpath_selector .= '//a[substring(@href, string-length(@href) - string-length("'.$ends_with.'") + 1 ) = "'.$ends_with.'"]'; >+ # ends-with version for xpath version 2 >+ #$xpath_selector .= '//a[ends-with(@href, "'.$ends_with.'") ]'; >+ >+ } else { >+ die "Only ends-with is supported so far ($k)"; >+ } >+ } >+ } else { >+ $xpath_selector .= '//a[contains(@href, "'.$params->{href}.'")]'; >+ } > } > if ( exists $params->{id} ) { > $xpath_selector .= '//*[@id="'.$params->{id}.'"]'; >-- >2.11.0
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 19243
:
66788
|
67433
|
67492
|
67493
|
67494
|
67495
|
67496
|
67497
|
68123
|
68124
|
68125
|
68832
|
68833
|
69757
|
69939
|
70160
|
70161
|
70162
|
70163
|
70164
|
70268
|
70269
|
70270