From cabb20c2c3b38ad0a6b81263f7a1c0ab7b300b67 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Wed, 4 Mar 2020 15:53:12 +0100
Subject: [PATCH] Bug 24801: Display all the categories - Selenium fix

To make sure we are going to be able to click on the "Delete" button of
our newly created category PATRON_CAT, we are displaying them all.

Test plan:
Create several patron categories that will fill the first page:

use t::lib::TestBuilder;
my $builder = t::lib::TestBuilder->new;
for my $i ( 1..20 ) {
    $builder->build_object({ class => 'Koha::Patron::Categories', value => { description => "cat_$i" } });
}

Execute the selenium tests.
---
 t/db_dependent/selenium/administration_tasks.t | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/t/db_dependent/selenium/administration_tasks.t b/t/db_dependent/selenium/administration_tasks.t
index 241f1393b9..fb02627394 100644
--- a/t/db_dependent/selenium/administration_tasks.t
+++ b/t/db_dependent/selenium/administration_tasks.t
@@ -186,6 +186,9 @@ SKIP: {
         $s->fill_form( { categorycode => $category_code, description => 'Test category', enrolmentperiod => 12, category_type => 'A' } );
         $s->submit_form;
 
+        # Select "Show all" in the datatable "Show x entries" dropdown list to make sure our category is not hidden
+        $driver->find_element('//select[@name="patron_categories_length"]/option[@value="-1"]')->click;
+
         $s->click(
             {
                 href => '/admin/categories.pl?op=delete_confirm&categorycode=' . $category_code,
-- 
2.20.1