Bug 19243 - Selenium test for testing the administration module functionality - part 1
Summary: Selenium test for testing the administration module functionality - part 1
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Alex Buckley
QA Contact: Testopia
URL:
Keywords:
Depends on: 19802 19914
Blocks: 18974 19182 19183 19184 19189 19359 19384 19880 19181 19185
  Show dependency treegraph
 
Reported: 2017-09-02 05:38 UTC by Alex Buckley
Modified: 2019-10-14 19:56 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 19243 - Selenium test for testing administrative tasks (19.37 KB, patch)
2017-09-02 05:39 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 19243 - Followup moving common Selenium functions into a seperate module (19.21 KB, patch)
2017-09-29 02:38 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 19243 - Selenium test for testing administrative tasks (17.00 KB, patch)
2017-10-01 21:39 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 19243 - Selenium test for testing administrative tasks (17.00 KB, patch)
2017-10-01 21:43 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 19243 - Selenium test for testing administrative tasks (19.37 KB, patch)
2017-10-02 03:08 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 19243 - Followup moving common Selenium functions into a seperate module (19.85 KB, patch)
2017-10-02 03:09 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 19243 - Followup patch with xpaths changed to id's (50.75 KB, patch)
2017-10-02 03:14 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 19243 - Followup patch with xpaths changed to id's (50.77 KB, patch)
2017-10-02 03:27 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 19243 - Selenium test for testing administrative tasks (19.21 KB, patch)
2017-10-14 03:51 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 19243 - Followup moving common Selenium functions into a seperate module (19.68 KB, patch)
2017-10-14 03:52 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 19243 - Followup patch with xpaths changed to id's (50.77 KB, patch)
2017-10-14 03:52 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 19243: Patch t/lib/Selenium to use ENV and fix login. (1.31 KB, patch)
2017-10-30 05:00 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 19243: Change to use ENV and fix passwords (1.54 KB, patch)
2017-10-30 05:00 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 19243: Add selenium tests for the administration module (8.17 KB, patch)
2017-12-12 22:18 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19243 - Amended Selenium test to add the creation of patron category and authorised values (2.63 KB, patch)
2017-12-20 03:30 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 19243: fix urls - do not use /cgi-bin/koha (2.32 KB, patch)
2017-12-26 19:25 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19243: Fix for bug 19860 (2.62 KB, patch)
2017-12-26 19:25 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19243: Temporary comment failing test - see bug 19560 comment 30 (1.19 KB, patch)
2017-12-26 19:25 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19243: Fix tests for AV (4.36 KB, patch)
2017-12-26 19:25 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19243: Fix tests for patron categories (2.80 KB, patch)
2017-12-26 19:25 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19243: The "delete library" is now a button with id (930 bytes, patch)
2018-01-04 13:31 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19243: Fix tests for AV (4.36 KB, patch)
2018-01-04 13:31 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19243: Fix tests for patron categories (2.80 KB, patch)
2018-01-04 13:31 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Buckley 2017-09-02 05:38:25 UTC
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
Comment 1 Alex Buckley 2017-09-02 05:39:24 UTC
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
Comment 2 Alex Buckley 2017-09-29 02:38:36 UTC
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
Comment 3 Alex Buckley 2017-09-29 08:47:12 UTC
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)
Comment 4 Alex Buckley 2017-10-01 19:45:42 UTC
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.
Comment 5 Alex Buckley 2017-10-01 21:39:44 UTC
Created attachment 67492 [details] [review]
Bug 19243 - Selenium test for testing administrative tasks
Comment 6 Alex Buckley 2017-10-01 21:43:22 UTC
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
Comment 7 Alex Buckley 2017-10-02 03:08:33 UTC
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
Comment 8 Alex Buckley 2017-10-02 03:09:05 UTC
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
Comment 9 Alex Buckley 2017-10-02 03:14:15 UTC
Created attachment 67496 [details] [review]
Bug 19243 - Followup patch with xpaths changed to id's

Sponsored-By: Catalyst IT
Comment 10 Alex Buckley 2017-10-02 03:27:50 UTC
Created attachment 67497 [details] [review]
Bug 19243 - Followup patch with xpaths changed to id's

Sponsored-By: Catalyst IT
Comment 11 Jonathan Druart 2017-10-02 12:48:49 UTC
Quick note, to not forget:
Steps 10-15 should be
  sudo cpanm -i Selenium::Remote::Driver
Comment 12 Alex Buckley 2017-10-14 03:51:45 UTC
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
Comment 13 Alex Buckley 2017-10-14 03:52:04 UTC
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
Comment 14 Alex Buckley 2017-10-14 03:52:23 UTC
Created attachment 68125 [details] [review]
Bug 19243 - Followup patch with xpaths changed to id's

Sponsored-By: Catalyst IT
Comment 15 Jonathan Druart 2017-10-16 14:28:28 UTC
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?
Comment 16 Mark Tompsett 2017-10-30 04:38:13 UTC Comment hidden (obsolete)
Comment 17 Mark Tompsett 2017-10-30 05:00:41 UTC
Created attachment 68832 [details] [review]
Bug 19243: Patch t/lib/Selenium to use ENV and fix login.
Comment 18 Mark Tompsett 2017-10-30 05:00:43 UTC
Created attachment 68833 [details] [review]
Bug 19243: Change to use ENV and fix passwords
Comment 19 Mark Tompsett 2017-10-30 05:02:27 UTC
(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.
Comment 20 Jonathan Druart 2017-12-12 22:18:29 UTC
Created attachment 69757 [details] [review]
Bug 19243: Add selenium tests for the administration module

This is just a start.
Comment 21 Jonathan Druart 2017-12-12 22:22:29 UTC
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
Comment 22 Alex Buckley 2017-12-20 03:30:40 UTC
Created attachment 69939 [details] [review]
Bug 19243 - Amended Selenium test to add the creation of patron category and authorised values

Sponsored-By: Catalyst IT
Comment 23 Alex Buckley 2017-12-20 04:16:09 UTC
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.
Comment 24 Jonathan Druart 2017-12-26 19:25:05 UTC
Created attachment 70160 [details] [review]
Bug 19243: fix urls - do not use /cgi-bin/koha
Comment 25 Jonathan Druart 2017-12-26 19:25:15 UTC
Created attachment 70161 [details] [review]
Bug 19243: Fix for bug 19860
Comment 26 Jonathan Druart 2017-12-26 19:25:22 UTC
Created attachment 70162 [details] [review]
Bug 19243: Temporary comment failing test - see bug 19560 comment 30
Comment 27 Jonathan Druart 2017-12-26 19:25:34 UTC
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)
Comment 28 Jonathan Druart 2017-12-26 19:25:42 UTC
Created attachment 70164 [details] [review]
Bug 19243: Fix tests for patron categories
Comment 29 Jonathan Druart 2017-12-26 19:29:56 UTC
(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.
Comment 30 Jonathan Druart 2018-01-04 13:31:45 UTC
Created attachment 70268 [details] [review]
Bug 19243: The "delete library" is now a button with id
Comment 31 Jonathan Druart 2018-01-04 13:31:50 UTC
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)
Comment 32 Jonathan Druart 2018-01-04 13:31:59 UTC
Created attachment 70270 [details] [review]
Bug 19243: Fix tests for patron categories
Comment 33 Jonathan Druart 2018-02-13 19:57:55 UTC
These patches will serve as examples for other selenium tests.
I am skipping QA as we need these tests to catch possible regressions.
Comment 34 Jonathan Druart 2018-02-13 19:58:31 UTC
Patches pushed to master for 18.05.