The selenium test for this bug report will test the following Administrative module functionality: * Add item type * Add circulation rule * Modify frameworks * Add library * Add authorised values * Add patron category * Add patron attribute type * Add Z39.50 target server * Add item circulation alert * Add city
Created attachment 66788 [details] [review] Bug 19243 - Selenium test for testing administrative tasks This selenium test checks the following Administrative module functionality: * Add item type * Add circulation rule * Modify frameworks * Add library * Add authorised values * Add patron category * Add patron attribute type * Add Z39.50 target server * Add item circulation alert * Add city Test plan (this test plan includes how to install Selenium as well as how to run this test, for the benefit of people who have not got Selenium installed on their machines): 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 into the file: deb http://packages.linuxmint.com debian import 4. sudo apt-get update 5. sudo apt-get install firefox 6. sudo apt-get install xvfb 7. Set the SELENIUM_PATH vartiable: 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 Note: This will start up the selenium server. Everytime you want to shutdown this terminal window and want to restart Selenium just run the step 9 command to restart the Selenium server 10. Open a new terminal window and write in: git clone https://github.com/gempesaw/Selenium-Remote-Driver --branch build/master --single-branch --depth 1 11. cd Selenium-Remote-Driver 12. perl Makefile.PL 13. make 14. make test 15. sudo make install 16. Now everything is installed and you can set up for running the selenium tests 17. Drop and recreate the Koha database and restart memcached 18. Go through the web installer installing all sample data and onboarding tool 19. Create a superlibrarian user with the username koha and password koha 20. If your usual port configuration for the intranet and OPAC is 8081 and 8080 respectively then set the staffClientBaseURL and OPACBaseURL system preferences to localhost:8080 and localhost:80 respectively 21. sudo koha-shell <instancename> 22. perl t/db_dependent/selenium/administration_tasks.t 23. The test should pass. Note: The time_diff comments in the test output showing what the test is doing Note: If you have issues with installing Selenium and Selenium::Remote::Driver please write a comment on the bug report and I will be more than happy to create a screencapture video showing all the steps Note: Warns in front of the $driver->get_title() function have been implemented because during troubleshooting they were found to be an effective solution for stopping the test from failing due to not being able to find an element on the page. If anyone can suggest an alternative to using these warns please do Sponsored-By: Catalyst IT
Created attachment 67433 [details] [review] Bug 19243 - Followup moving common Selenium functions into a seperate module In this patch a module t/lib/Selenium.pm has been created and it contains the auth, patron_auth, patron_opac_auth, cleaup, time_difffunctions which are common to other Selenium text scripts. Also a function to wait for an element to be found before it is interacted with was created and it is called pause_driver At present this pause_driver function throws an error in the test output saying that it cannot find an element and then it fails. Test plan (this test plan includes how to install Selenium as well as how to run this test, for the benefit of people who have not got Selenium installed on their machines): 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 into the file: deb http://packages.linuxmint.com debian import 4. sudo apt-get update 5. sudo apt-get install firefox 6. sudo apt-get install xvfb 7. Set the SELENIUM_PATH vartiable: 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 Note: This will start up the selenium server. Everytime you want to shutdown this terminal window and want to restart Selenium just run the step 9 command to restart the Selenium server 10. Open a new terminal window and write in: git clone https://github.com/gempesaw/Selenium-Remote-Driver --branch build/master --single-branch --depth 1 11. cd Selenium-Remote-Driver 12. perl Makefile.PL 13. make 14. make test 15. sudo make install 16. Now everything is installed and you can set up for running the selenium tests 17. Drop and recreate the Koha database and restart memcached 18. Go through the web installer installing all sample data and onboarding tool 19. Create a superlibrarian user with the username koha and password koha 20. If your usual port configuration for the intranet and OPAC is 8081 and 8080 respectively then set the staffClientBaseURL and OPACBaseURL system preferences to localhost:8080 and localhost:80 respectively 21. sudo koha-shell <instancename> 22. perl t/db_dependent/selenium/administration_tasks.t 23. The test should pass. Note: The time_diff comments in the test output showing what the test is doing Note: If you have issues with installing Selenium and Selenium::Remote::Driver please write a comment on the bug report and I will be more than happy to create a screencapture video showing all the steps Note: Warns in front of the $driver->get_title() function have been implemented because during troubleshooting they were found to be an effective solution for stopping the test from failing due to not being able to find an element on the page. If anyone can suggest an alternative to using these warns please do Sponsored-By: Catalyst IT
Hi Jonathan I have moved out the common Selenium functions (auth, patron_auth, patron_opac_auth, fill_form, cleanup) and have placed them in t/lib/Selenium.pm. Running the tests after doing that I found that they passed successfully. I will continue working on this tommorow but I have not been able to get the wait_until function working correctly after a lot of troubleshooting ( you can see it in t::lib::Selenium.pm)
Hi Jonathan Sorry I forgot to attach the newly updated patch containing t/lib/Selenium.pm. This Perl module contains the Selenium functions common across all the the Selenium tests for example auth. I have tried to attach the new patch to the bug report a few minutes ago and I am getting a SSL certificate verify failed error, so I am in the process of troubleshooting now.
Created attachment 67492 [details] [review] Bug 19243 - Selenium test for testing administrative tasks
Created attachment 67493 [details] [review] Bug 19243 - Selenium test for testing administrative tasks This selenium test checks the following Administrative module functionality: * Add item type * Add circulation rule * Modify frameworks * Add library * Add authorised values * Add patron category * Add patron attribute type * Add Z39.50 target server * Add item circulation alert * Add city Test plan (this test plan includes how to install Selenium as well as how to run this test, for the benefit of people who have not got Selenium installed on their machines): 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 into the file: deb http://packages.linuxmint.com debian import 4. sudo apt-get update 5. sudo apt-get install firefox 6. sudo apt-get install xvfb 7. Set the SELENIUM_PATH vartiable: 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 Note: This will start up the selenium server. Everytime you want to shutdown this terminal window and want to restart Selenium just run the step 9 command to restart the Selenium server 10. Open a new terminal window and write in: git clone https://github.com/gempesaw/Selenium-Remote-Driver --branch build/master --single-branch --depth 1 11. cd Selenium-Remote-Driver 12. perl Makefile.PL 13. make 14. make test 15. sudo make install 16. Now everything is installed and you can set up for running the selenium tests 17. Drop and recreate the Koha database and restart memcached 18. Go through the web installer installing all sample data and onboarding tool 19. Create a superlibrarian user with the username koha and password koha 20. If your usual port configuration for the intranet and OPAC is 8081 and 8080 respectively then set the staffClientBaseURL and OPACBaseURL system preferences to localhost:8080 and localhost:80 respectively 21. sudo koha-shell <instancename> 22. perl t/db_dependent/selenium/administration_tasks.t 23. The test should pass. Note: The time_diff comments in the test output showing what the test is doing Note: If you have issues with installing Selenium and Selenium::Remote::Driver please write a comment on the bug report and I will be more than happy to create a screencapture video showing all the steps Note: Warns in front of the $driver->get_title() function have been implemented because during troubleshooting they were found to be an effective solution for stopping the test from failing due to not being able to find an element on the page. If anyone can suggest an alternative to using these warns please do Sponsored-By: Catalyst IT
Created attachment 67494 [details] [review] Bug 19243 - Selenium test for testing administrative tasks This selenium test checks the following Administrative module functionality: * Add item type * Add circulation rule * Modify frameworks * Add library * Add authorised values * Add patron category * Add patron attribute type * Add Z39.50 target server * Add item circulation alert * Add city Test plan (this test plan includes how to install Selenium as well as how to run this test, for the benefit of people who have not got Selenium installed on their machines): 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 into the file: deb http://packages.linuxmint.com debian import 4. sudo apt-get update 5. sudo apt-get install firefox 6. sudo apt-get install xvfb 7. Set the SELENIUM_PATH vartiable: 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 Note: This will start up the selenium server. Everytime you want to shutdown this terminal window and want to restart Selenium just run the step 9 command to restart the Selenium server 10. Open a new terminal window and write in: git clone https://github.com/gempesaw/Selenium-Remote-Driver --branch build/master --single-branch --depth 1 11. cd Selenium-Remote-Driver 12. perl Makefile.PL 13. make 14. make test 15. sudo make install 16. Now everything is installed and you can set up for running the selenium tests 17. Drop and recreate the Koha database and restart memcached 18. Go through the web installer installing all sample data and onboarding tool 19. Create a superlibrarian user with the username koha and password koha 20. If your usual port configuration for the intranet and OPAC is 8081 and 8080 respectively then set the staffClientBaseURL and OPACBaseURL system preferences to localhost:8080 and localhost:80 respectively 21. sudo koha-shell <instancename> 22. perl t/db_dependent/selenium/administration_tasks.t 23. The test should pass. Note: The time_diff comments in the test output showing what the test is doing Note: If you have issues with installing Selenium and Selenium::Remote::Driver please write a comment on the bug report and I will be more than happy to create a screencapture video showing all the steps Note: Warns in front of the $driver->get_title() function have been implemented because during troubleshooting they were found to be an effective solution for stopping the test from failing due to not being able to find an element on the page. If anyone can suggest an alternative to using these warns please do Sponsored-By: Catalyst IT
Created attachment 67495 [details] [review] Bug 19243 - Followup moving common Selenium functions into a seperate module In this patch a module t/lib/Selenium.pm has been created and it contains the auth, patron_auth, patron_opac_auth, cleaup, time_difffunctions which are common to other Selenium text scripts. Also a function to wait for an element to be found before it is interacted with was created and it is called pause_driver At present this pause_driver function throws an error in the test output saying that it cannot find an element and then it fails. Test plan (this test plan includes how to install Selenium as well as how to run this test, for the benefit of people who have not got Selenium installed on their machines): 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 into the file: deb http://packages.linuxmint.com debian import 4. sudo apt-get update 5. sudo apt-get install firefox 6. sudo apt-get install xvfb 7. Set the SELENIUM_PATH vartiable: 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 Note: This will start up the selenium server. Everytime you want to shutdown this terminal window and want to restart Selenium just run the step 9 command to restart the Selenium server 10. Open a new terminal window and write in: git clone https://github.com/gempesaw/Selenium-Remote-Driver --branch build/master --single-branch --depth 1 11. cd Selenium-Remote-Driver 12. perl Makefile.PL 13. make 14. make test 15. sudo make install 16. Now everything is installed and you can set up for running the selenium tests 17. Drop and recreate the Koha database and restart memcached 18. Go through the web installer installing all sample data and onboarding tool 19. Create a superlibrarian user with the username koha and password koha 20. If your usual port configuration for the intranet and OPAC is 8081 and 8080 respectively then set the staffClientBaseURL and OPACBaseURL system preferences to localhost:8080 and localhost:80 respectively 21. sudo koha-shell <instancename> 22. perl t/db_dependent/selenium/administration_tasks.t 23. The test should pass. Note: The time_diff comments in the test output showing what the test is doing Note: If you have issues with installing Selenium and Selenium::Remote::Driver please write a comment on the bug report and I will be more than happy to create a screencapture video showing all the steps Note: Warns in front of the $driver->get_title() function have been implemented because during troubleshooting they were found to be an effective solution for stopping the test from failing due to not being able to find an element on the page. If anyone can suggest an alternative to using these warns please do Sponsored-By: Catalyst IT
Created attachment 67496 [details] [review] Bug 19243 - Followup patch with xpaths changed to id's Sponsored-By: Catalyst IT
Created attachment 67497 [details] [review] Bug 19243 - Followup patch with xpaths changed to id's Sponsored-By: Catalyst IT
Quick note, to not forget: Steps 10-15 should be sudo cpanm -i Selenium::Remote::Driver
Created attachment 68123 [details] [review] Bug 19243 - Selenium test for testing administrative tasks This selenium test checks the following Administrative module functionality: * Add item type * Add circulation rule * Modify frameworks * Add library * Add authorised values * Add patron category * Add patron attribute type * Add Z39.50 target server * Add item circulation alert * Add city Test plan (this test plan includes how to install Selenium as well as how to run this test, for the benefit of people who have not got Selenium installed on their machines): 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 into the file: deb http://packages.linuxmint.com debian import 4. sudo apt-get update 5. sudo apt-get install firefox 6. sudo apt-get install xvfb 7. Set the SELENIUM_PATH vartiable: 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 Note: This will start up the selenium server. Everytime you want to shutdown this terminal window and want to restart Selenium just run the step 9 command to restart the Selenium server 10. Open a new terminal window and write in: sudo cpanm -i Selenium::Remote::Driver 11. Now everything is installed and you can set up for running the selenium tests 12. Drop and recreate the Koha database and restart memcached 13. Go through the web installer installing all sample data and onboarding tool 14. Create a superlibrarian user with the username koha and password koha 15. If your usual port configuration for the intranet and OPAC is 8081 and 8080 respectively then set the staffClientBaseURL and OPACBaseURL system preferences to localhost:8080 and localhost:80 respectively 16. sudo koha-shell <instancename> 17. perl t/db_dependent/selenium/administration_tasks.t 18. The test should pass. Note: The time_diff comments in the test output showing what the test is doing Note: If you have issues with installing Selenium and Selenium::Remote::Driver please write a comment on the bug report and I will be more than happy to create a screencapture video showing all the steps Note: Warns in front of the $driver->get_title() function have been implemented because during troubleshooting they were found to be an effective solution for stopping the test from failing due to not being able to find an element on the page. If anyone can suggest an alternative to using these warns please do Sponsored-By: Catalyst IT
Created attachment 68124 [details] [review] Bug 19243 - Followup moving common Selenium functions into a seperate module In this patch a module t/lib/Selenium.pm has been created and it contains the auth, patron_auth, patron_opac_auth, cleaup, time_difffunctions which are common to other Selenium text scripts. Also a function to wait for an element to be found before it is interacted with was created and it is called pause_driver At present this pause_driver function throws an error in the test output saying that it cannot find an element and then it fails. Test plan (this test plan includes how to install Selenium as well as how to run this test, for the benefit of people who have not got Selenium installed on their machines): 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 into the file: deb http://packages.linuxmint.com debian import 4. sudo apt-get update 5. sudo apt-get install firefox 6. sudo apt-get install xvfb 7. Set the SELENIUM_PATH vartiable: 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 Note: This will start up the selenium server. Everytime you want to shutdown this terminal window and want to restart Selenium just run the step 9 command to restart the Selenium server 10. Open a new terminal window and write in: sudo cpanm -i Selenium::Remote::Driver 11. Now everything is installed and you can set up for running the selenium tests 12. Drop and recreate the Koha database and restart memcached 13. Go through the web installer installing all sample data and onboarding tool 14. Create a superlibrarian user with the username koha and password koha 15. If your usual port configuration for the intranet and OPAC is 8081 and 8080 respectively then set the staffClientBaseURL and OPACBaseURL system preferences to localhost:8080 and localhost:80 respectively 16. sudo koha-shell <instancename> 17. perl t/db_dependent/selenium/administration_tasks.t 18. The test should pass. Note: The time_diff comments in the test output showing what the test is doing Note: If you have issues with installing Selenium and Selenium::Remote::Driver please write a comment on the bug report and I will be more than happy to create a screencapture video showing all the steps Note: Warns in front of the $driver->get_title() function have been implemented because during troubleshooting they were found to be an effective solution for stopping the test from failing due to not being able to find an element on the page. If anyone can suggest an alternative to using these warns please do Sponsored-By: Catalyst IT
Created attachment 68125 [details] [review] Bug 19243 - Followup patch with xpaths changed to id's Sponsored-By: Catalyst IT
Alex, some remarks: 1. take a look at basic_workflow.t, there are some changes you did not take into account (19337) 2. Tests must create the data they need and delete them. Here you are using the FA framework and modify it. That means the tests will fail if executed twice. 3. The cleanup method is wrong, it should not be a method as the different selenium test files will have different a cleanup. 4. t::lib::Selenium::pause_driver does not work as you would like?
(In reply to Jonathan Druart from comment #15) > 4. t::lib::Selenium::pause_driver does not work as you would like? Where is t::lib::Selenium{anything}? It's not in master.
Created attachment 68832 [details] [review] Bug 19243: Patch t/lib/Selenium to use ENV and fix login.
Created attachment 68833 [details] [review] Bug 19243: Change to use ENV and fix passwords
(In reply to Jonathan Druart from comment #15) > Alex, some remarks: > 1. take a look at basic_workflow.t, there are some changes you did not take > into account (19337) > 2. Tests must create the data they need and delete them. Here you are using > the FA framework and modify it. That means the tests will fail if executed > twice. > 3. The cleanup method is wrong, it should not be a method as the different > selenium test files will have different a cleanup. > 4. t::lib::Selenium::pause_driver does not work as you would like? I didn't look to see if the code actually address points 2-4. I believe my patches deal with 1. I'm going to set this to Failed QA, even though the tests ran successfully.
Created attachment 69757 [details] [review] Bug 19243: Add selenium tests for the administration module This is just a start.
Hi Alex, I have tried to make your work moving forward in order to unlock all the other bug reports linked to this one. I would like you to take a look at the changes I made on bug 19802 and this one. Basically I have refactored the existing code and added new methods to help us in writing selenium tests easily. You will notice that I did not need to change Koha code (which is wanted). This patch does not contain all the tests you wrote previously, it would be good to know if you manage to rewrite them easily without impacting Koha template code. Let me know if you face any difficulties or if you have questions. Cheers, Jonathan
Created attachment 69939 [details] [review] Bug 19243 - Amended Selenium test to add the creation of patron category and authorised values Sponsored-By: Catalyst IT
Hi Jonathan I have just attached a patch which tests the creation of an authorised value and a patron category. The difficulties I faced with adding these were that a modal box is displayed when you delete authorised values. Trying to confirm the deletion with the modal box is problematic and I have not been able to find a solution for that yet. Additionally in the creation of patron categories you must select a value from a dropdown box, I am still trying to find a solution for this. I will be away from my computer for the next 3.5 weeks whilst travelling in Egypt and Jordan and will be able to return to this in mid Jan along with other Koha development work I am working on.
Created attachment 70160 [details] [review] Bug 19243: fix urls - do not use /cgi-bin/koha
Created attachment 70161 [details] [review] Bug 19243: Fix for bug 19860
Created attachment 70162 [details] [review] Bug 19243: Temporary comment failing test - see bug 19560 comment 30
Created attachment 70163 [details] [review] 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)
Created attachment 70164 [details] [review] Bug 19243: Fix tests for patron categories
(In reply to Alex Buckley from comment #23) > Hi Jonathan Hi Alex, > I have just attached a patch which tests the creation of an authorised value > and a patron category. > > The difficulties I faced with adding these were that a modal box is > displayed when you delete authorised values. Trying to confirm the deletion > with the modal box is problematic and I have not been able to find a > solution for that yet. > There were some issues in your patch. You must keep in mind than the tests have to pass on other installations and your tests must not modify the DB (so you must cleanup). Take a look at the last 2 patches, they fix the different problems. To confirm a modal, you need to call $driver->accept_alert; > Additionally in the creation of patron categories you must select a value > from a dropdown box, I am still trying to find a solution for this. You just need to specify the id of the select and the value of the option you want to select. > I will be away from my computer for the next 3.5 weeks whilst travelling in > Egypt and Jordan and will be able to return to this in mid Jan along with > other Koha development work I am working on. Enjoy your holidays then :) I am going to open another bug report for the pages we do not test in these patches and let this one moving on.
Created attachment 70268 [details] [review] Bug 19243: The "delete library" is now a button with id
Created attachment 70269 [details] [review] 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)
Created attachment 70270 [details] [review] Bug 19243: Fix tests for patron categories
These patches will serve as examples for other selenium tests. I am skipping QA as we need these tests to catch possible regressions.
Patches pushed to master for 18.05.