From 81e9e91f7cde5f2bb332bb6c8455d8ce3eebd134 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Wed, 16 Aug 2017 18:53:19 +0000 Subject: [PATCH] Bug 18974 - Added selenium test for the Koha web installer and onboarding tool Test plan: 1. wget https://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.0.jar 2.vim /etc/apt/sources.list.d/firefox.list 3. Paste in: deb http://packages.linuxmint.com debian import 4. suod apt-get update 5. sudo apt-get install firefox 6. sudo apt-get install xvfb 7. SELENIUM_PATH=/home/vagrant/kohaclone/selenium-server-standalone-2.53.0.jar 8. Xvfb :1 -screen 0 1024x768x24 2>&1 >/dev/null & 9. DISPLAY=:1 java -jar $SELENIUM_PATH 10. In a new terminal restart memcached and drop and recreate the Koha database 11. sudo koha-shell kohadev 12. perl t/db_dependent/selenium/installkoha.t 13. Notice the db errors saying that database tables do not exist 14. Notice the CP test output messages stating what the test is doing --- t/db_dependent/selenium/installkoha.t | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/t/db_dependent/selenium/installkoha.t b/t/db_dependent/selenium/installkoha.t index 6496f93..4b3cb12 100644 --- a/t/db_dependent/selenium/installkoha.t +++ b/t/db_dependent/selenium/installkoha.t @@ -17,8 +17,8 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -#This selenium test is to testb authentication, by performing the following: create a category and patron (same as basic_workflow.t). Then the superlibrarian logs out and the created patron must log into the staff intranet and OPAC - +#This selenium test is to test the Koha web installer and onboarding tool. Before running the test make sure you have restarted memcached and have dropped and recreated the Koha database. +#Note: When running the test database errors will be displayed however just ignore those errors and the test output will be displayed below it # wget https://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.1.jar # Does not work with 3.4, did not test the ones between # sudo apt-get install xvfb firefox-esr # SELENIUM_PATH=/home/vagrant/selenium-server-standalone-2.53.1.jar @@ -45,7 +45,7 @@ use Time::HiRes qw(gettimeofday); use C4::Context; use C4::Biblio qw( AddBiblio ); # We shouldn't use it -use Test::More tests => 9; +use Test::More tests => 1; use MARC::Record; use MARC::Field; @@ -102,7 +102,8 @@ SKIP: { time_diff("Selected english language"); $driver->maximize_window(); - $driver->set_implicit_wait_timeout(30000); + $driver->pause(50000); + warn $driver->get_title(); #Check perl dependencies $driver->find_element_by_xpath('/html/body/div/div/div/form/p/input')->click(); time_diff("Continued through checking perl dependencies"); @@ -122,10 +123,10 @@ SKIP: { time_diff("Basic configs installed"); $driver->maximize_window(); - $driver->set_implicit_wait_timeout(30000); -#Select MARC flavour - warn $driver->is_displayed_by_xpath('/html/body/div/div/div/form/p[4]/input')->click(); - $driver->find_element_by_xpath('/html/body/div/div/div/form/p[4]/input')->click(); + $driver->pause(50000); +#Select MARC flavour + warn $driver->get_title(); + $driver->find_element('//input[@value="Continue to the next step"]')->click; time_diff("MARC21 installed"); #Install default settings @@ -138,6 +139,8 @@ SKIP: { time_diff("Start onboarding tool"); #Onboarding tool create a library + $driver->pause(50000); + warn $driver->get_title(); $driver->find_element_by_xpath('/html/body/div/div/div/form/fieldset/ol/li[1]/input')->send_keys("Test"); $driver->find_element_by_xpath('/html/body/div/div/div/form/fieldset/ol/li[2]/input')->send_keys("Test library"); $driver->find_element_by_xpath('/html/body/div/div/div/form/fieldset/input[3]')->click(); @@ -147,18 +150,19 @@ SKIP: { $driver->find_element_by_xpath('/html/body/div[1]/div/div/form/fieldset/ol/li[1]/input')->send_keys("PAT"); $driver->find_element_by_xpath('/html/body/div[1]/div/div/form/fieldset/ol/li[2]/input')->send_keys("Test patron category"); $driver->find_element_by_xpath('/html/body/div[1]/div/div/form/fieldset/ol/li[6]/fieldset/ol/li[3]/input')->send_keys('07/29/2020'); - $driver->find_element_by_xpath('/html/body/div[1]/div/div/form/fieldset/p')->click(); + $driver->find_element_by_xpath('/html/body/div[1]/div/div/form/fieldset/input[3]')->click; time_diff("Patron category created"); $driver->set_window_size(1000, 1000); $driver->maximize_window(); - $driver->set_implicit_wait_timeout(20000); #Onboarding tool Create Koha adminstrator patron - $driver->mouse_move_to_location(xoffset => 100, yoffset => 100); + $driver->pause(50000); + warn $driver->get_title(); $driver->find_element_by_xpath('/html/body/div/div/div/form/fieldset/ol[1]/li[1]/input')->send_keys("Smith"); $driver->find_element_by_xpath('/html/body/div/div/div/form/fieldset/ol[1]/li[2]/input')->send_keys("Mary"); - $driver->mouse_move_to_location(xoffset => 200, yoffset => 200); - $driver->maximize_window(); + + $driver->pause(50000); + warn $driver->get_title(); $driver->find_element_by_xpath('/html/body/div/div/div/form/fieldset/ol[2]/li[1]/input')->send_keys("10203"); $driver->find_element_by_xpath('/html/body/div/div/div/form/fieldset/ol[4]/li[1]/input')->send_keys("Mary"); $driver->find_element_by_xpath('/html/body/div/div/div/form/fieldset/ol[4]/li[2]/input')->send_keys("password"); -- 2.1.4