Bugzilla – Attachment 146973 Details for
Bug 32926
Cannot expand or collapse some System preference sections after a search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32926: Add Selenium tests
Bug-32926-Add-Selenium-tests.patch (text/plain), 5.25 KB, created by
Fridolin Somers
on 2023-02-20 20:46:15 UTC
(
hide
)
Description:
Bug 32926: Add Selenium tests
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2023-02-20 20:46:15 UTC
Size:
5.25 KB
patch
obsolete
>From bb6cc661f17860c26198c4edca3dc589cdaa7372 Mon Sep 17 00:00:00 2001 >From: Andreas Roussos <a.roussos@dataly.gr> >Date: Thu, 9 Feb 2023 20:11:33 +0100 >Subject: [PATCH] Bug 32926: Add Selenium tests > >This adds a new Selenium test to automatically test the correct >behaviour when expanding/collapsing System preferences sections >after a System preferences search. > >Test plan: > >1) Apply the other patch from this bug report, then run the > new Selenium unit test which should pass without failures: > > prove -v t/db_dependent/selenium/system_preferences_search.t > >Signed-off-by: Fridolin <fridolin.somers@biblibre.com> >--- > .../selenium/system_preferences_search.t | 96 +++++++++++++++++++ > 1 file changed, 96 insertions(+) > create mode 100755 t/db_dependent/selenium/system_preferences_search.t > >diff --git a/t/db_dependent/selenium/system_preferences_search.t b/t/db_dependent/selenium/system_preferences_search.t >new file mode 100755 >index 0000000000..0bbff17530 >--- /dev/null >+++ b/t/db_dependent/selenium/system_preferences_search.t >@@ -0,0 +1,96 @@ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Koha::AuthUtils; >+use Test::More; >+ >+use t::lib::Mocks; >+use t::lib::Selenium; >+use t::lib::TestBuilder; >+ >+eval { require Selenium::Remote::Driver; }; >+if ( $@ ) { >+ plan skip_all => "Selenium::Remote::Driver is needed for Selenium tests."; >+} else { >+ plan tests => 1; >+} >+ >+my @cleanup; >+ >+my $builder = t::lib::TestBuilder->new; >+ >+my $s = t::lib::Selenium->new; >+my $driver = $s->driver; >+my $base_url = $s->base_url; >+ >+# Adjust the height and width of the generated screenshots >+#$driver->set_window_size( 2160, 991 ); # Height, then Width >+ >+my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { flags => 1, branchcode => 'CPL' } } ); >+my $password = Koha::AuthUtils::generate_password( $patron->category ); >+t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 ); >+$patron->set_password( { password => $password } ); >+ >+push @cleanup, $patron; >+ >+$s->auth( $patron->userid, $password ); >+ >+subtest 'Perform a system preferences search for "log", and try to expand/collapse both "Policy" sections that appear' => sub { >+ >+ plan tests => 6; >+ >+ $driver->get( $base_url . 'admin/preferences.pl?tab=&op=search&searchfield=log' ); >+ #$driver->capture_screenshot( 'Selenium_00.png' ); >+ >+ my $xpath_v1_expr1 = '//h3[@id="accounting_Policy"]'; >+ >+ # The first "Policy" section should be under the "Accounting" preferences top-level section and be initially expanded >+ my $first_policy_section_toggle_elt = $driver->find_element( $xpath_v1_expr1 ); >+ is( $first_policy_section_toggle_elt->get_attribute( 'class' , 1 ), 'expanded', 'The first "Policy" section (under "Accounting") is currently expanded' ); >+ >+ # Clicking on the expand/collapse button should collapse this section >+ $first_policy_section_toggle_elt->click; >+ #$driver->capture_screenshot( 'Selenium_01.png' ); >+ is( $first_policy_section_toggle_elt->get_attribute( 'class' , 1 ), 'collapsed', 'The first "Policy" section (under "Accounting") is now collapsed' ); >+ >+ # Clicking on the expand/collapse button once more should expand this section back to its original state >+ $first_policy_section_toggle_elt->click; >+ #$driver->capture_screenshot( 'Selenium_02.png' ); >+ is( $first_policy_section_toggle_elt->get_attribute( 'class' , 1 ), 'expanded', 'The first "Policy" section (under "Accounting") is back to the expanded state' ); >+ >+ my $xpath_v1_expr2 = '//h3[@id="acquisitions_Policy"]'; >+ >+ # The second "Policy" section should be under the "Acquisitions" preferences top-level section and be initially expanded >+ my $second_policy_section_toggle_elt = $driver->find_element( $xpath_v1_expr2 ); >+ is( $second_policy_section_toggle_elt->get_attribute( 'class' , 1 ), 'expanded', 'The second "Policy" section (under "Acquisitions") is currently expanded' ); >+ >+ # Clicking on the expand/collapse button should collapse this section >+ $second_policy_section_toggle_elt->click; >+ #$driver->capture_screenshot( 'Selenium_03.png' ); >+ is( $second_policy_section_toggle_elt->get_attribute( 'class' , 1 ), 'collapsed', 'The second "Policy" section (under "Acquisitions") is now collapsed' ); >+ >+ # Clicking on the expand/collapse button once more should expand this section back to its original state >+ $second_policy_section_toggle_elt->click; >+ #$driver->capture_screenshot( 'Selenium_04.png' ); >+ is( $second_policy_section_toggle_elt->get_attribute( 'class' , 1 ), 'expanded', 'The second "Policy" section (under "Acquisitions") is back to the expanded state' ); >+ >+}; >+ >+# Delete the test patron >+END { >+ $_->delete for @cleanup; >+}; >-- >2.39.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 32926
:
146440
|
146441
|
146448
|
146852
|
146973
|
146974
|
147197
|
147198
|
147199
|
150739