Bugzilla – Attachment 105799 Details for
Bug 19185
Web installer and onboarding tool selenium test
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19185: Add selenium tests for installation and onboarding process
Bug-19185-Add-selenium-tests-for-installation-and-.patch (text/plain), 6.51 KB, created by
Kyle M Hall (khall)
on 2020-06-12 13:36:18 UTC
(
hide
)
Description:
Bug 19185: Add selenium tests for installation and onboarding process
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-06-12 13:36:18 UTC
Size:
6.51 KB
patch
obsolete
>From d1da058b3f922240fd9f5017a151a1e9a0f8941e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 4 May 2018 14:52:44 -0300 >Subject: [PATCH] Bug 19185: Add selenium tests for installation and onboarding > process > >== Test plan == >1. Apply the patches (including bug 19821) >2. restart_all >3. prove -Mt::lib::Bootstrap t/db_dependent/selenium/00-installation.t >4. result: Config entry 'database_test' does not exist at > /home/vagrant/kohaclone/t/lib/Bootstrap.pm line 18 >5. Edit $KOHA_CONF, add a database_test entry identical to database > You should have: > <database>koha_kohadev</database> > <database_test>koha_kohadev</database_test> >6. restart_all >7. prove -Mt::lib::Bootstrap t/db_dependent/selenium/00-installation.t >8. result: Entries 'database_test' and 'database' have the same value in your > config at /home/vagrant/kohaclone/t/lib/Bootstrap.pm line 20. >9. Edit $KOHA_CONF, edit database_test with koha_test as DB name >10. restart_all >11. prove -Mt::lib::Bootstrap t/db_dependent/selenium/00-installation.t >12. result: Access denied for user 'koha_kohadev'@'localhost' > to database 'koha_test' >13. Connect to the DBMS >14. Example for koha_testing_docker > docker exec -it koha_db_1 bash > mysql -u root --password=password >15. GRANT ALL PRIVILEGES ON `koha_test`.* TO 'koha_kohadev'; >16. prove -Mt::lib::Bootstrap t/db_dependent/selenium/00-installation.t >17. result: All tests successful. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/db_dependent/selenium/00-installation.t | 148 ++++++++++++++++++++++ > 1 file changed, 148 insertions(+) > create mode 100644 t/db_dependent/selenium/00-installation.t > >diff --git a/t/db_dependent/selenium/00-installation.t b/t/db_dependent/selenium/00-installation.t >new file mode 100644 >index 0000000000..990b6982a8 >--- /dev/null >+++ b/t/db_dependent/selenium/00-installation.t >@@ -0,0 +1,148 @@ >+#!/usr/bin/perl >+ >+# 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 Test::More tests => 2; >+ >+use t::lib::Selenium; >+use C4::Context; >+ >+my $superlibrarian = { >+ surname => 'Super', >+ firstname => 'Librarian', >+ cardnumber => '143749305', >+ userid => 'SuperL', >+ password => 'aA1bB2cC3dD4' >+}; >+my $languages = { >+ en => 'en', >+ ar => 'ar-Arab', >+ es => 'es-ES', >+ fr => 'fr-FR', >+ it => 'it-IT', >+ pt_BR => 'pt-BR', >+ tr => 'tr-TR', >+ zh_TW => 'zh-Hans-TW' >+}; >+ >+SKIP: { >+ eval { require Selenium::Remote::Driver; }; >+ skip "Selenium::Remote::Driver is needed for selenium tests.", 2 if $@; >+ >+ my $s = t::lib::Selenium->new; >+ >+ my $driver = $s->driver; >+ my $base_url = $s->base_url; >+ my $db_user = C4::Context->config('user'); >+ my $db_pass = C4::Context->config('pass'); >+ >+ $driver->get($base_url."mainpage.pl"); >+ >+ my $lang = "en"; # The idea here is to loop on all languages >+ >+ # Welcome to the Koha web installer >+ $s->fill_form({userid => $db_user, password => $db_pass }); >+ $s->submit_form; >+ >+ # Choose your language >+ $s->fill_form({ language => $languages->{$lang} }); >+ $s->submit_form; >+ >+ # Check Perl dependencies >+ $s->submit_form; >+ >+ # Database settings >+ $s->submit_form; >+ >+ # Database settings >+ # Connection established >+ $s->driver->find_element('//div[@class="alert alert-success"]'); >+ $s->submit_form; >+ >+ # Set up database >+ $s->submit_form; >+ >+ # Success >+ # Database tables created >+ $s->driver->find_element('//div[@class="alert alert-success"]'); >+ $s->submit_form; >+ >+ # Install basic configuration settings >+ $s->submit_form; >+ >+ # Select your MARC flavor >+ $s->fill_form({ marcflavour => 'MARC21' }); >+ $s->submit_form; >+ >+ # Selecting default settings >+ # Do not check otherwise no onboarding >+ #my @checkboxes = $driver->find_elements('//input[@type="checkbox" and not(@checked="checked")]'); >+ #for my $c ( @checkboxes ) { >+ # $c->click; >+ #} >+ $s->submit_form; >+ >+ # Default data loaded >+ $s->submit_form; >+ >+ #$s->submit_form; >+ $s->click( { href => '/installer/onboarding.pl', main => 'installer-step3' } ); >+ >+ # Create a library >+ $s->fill_form({ branchcode => 'CPL', branchname => 'Centerville' }); >+ $s->submit_form; >+ >+ # Library created! >+ $s->driver->find_element('//div[@class="alert alert-success"]'); >+ # Create a patron category >+ $s->fill_form({ categorycode => 'S', description => 'Staff', enrolmentperiod => 12 }); >+ $s->submit_form; >+ >+ # Patron category created! >+ $s->driver->find_element('//div[@class="alert alert-success"]'); >+ # Create Koha administrator patron >+ $s->fill_form({ %$superlibrarian, password2 => $superlibrarian->{password} }); >+ $s->submit_form; >+ >+ #Administrator account created! >+ $s->driver->find_element('//div[@class="alert alert-success"]'); >+ # Create a new item type >+ $s->fill_form({ itemtype => 'BK', description => 'Book' }); >+ $s->submit_form; >+ >+ # New item type created! >+ $s->driver->find_element('//div[@class="alert alert-success"]'); >+ # Create a new circulation rule >+ # Keep default values >+ $s->submit_form; >+ >+ # Get the interface in the correct language >+ C4::Context->set_preference('language', $languages->{$lang} ); >+ C4::Context->set_preference('opaclanguages', $languages->{$lang} ); >+ >+ $s->click( { href => '/mainpage.pl', main => 'onboarding-step5' } ); >+ >+ $s->fill_form({ userid => $superlibrarian->{userid}, password => $superlibrarian->{password} }); >+ >+ like( $s->driver->get_title, qr(Log in to Koha), 'After the onboarding process the user should have landed in the login form page'); >+ $s->submit_form; >+ >+ is( $s->driver->get_title, 'Koha staff client', 'The credentials we created should work'); >+ >+ $driver->quit(); >+}; >-- >2.24.1 (Apple Git-126)
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 19185
:
66508
|
68830
|
75088
|
75089
|
75090
|
81913
|
81914
|
81915
|
103406
|
103407
|
103408
|
103416
|
105796
|
105797
|
105798
|
105799
|
120273
|
126646
|
126647
|
126648
|
126649
|
126650
|
126651
|
126652
|
126819
|
126901
|
126918
|
126984