Bugzilla – Attachment 161873 Details for
Bug 36025
Extended attributes clause added to patron search query even when there are no searchable attributes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36025 Selenium test for the query parameters
Bug-36025-Selenium-test-for-the-query-parameters.patch (text/plain), 2.80 KB, created by
Andreas Jonsson
on 2024-02-08 01:35:08 UTC
(
hide
)
Description:
Bug 36025 Selenium test for the query parameters
Filename:
MIME Type:
Creator:
Andreas Jonsson
Created:
2024-02-08 01:35:08 UTC
Size:
2.80 KB
patch
obsolete
>From 3a79a6064d9c24dd92faadfaff540651d241fd3f Mon Sep 17 00:00:00 2001 >From: Andreas Jonsson <andreas.jonsson@kreablo.se> >Date: Thu, 8 Feb 2024 01:02:51 +0000 >Subject: [PATCH] Bug 36025 Selenium test for the query parameters > >The test verifies that there is no clause for extended >attributes in the patron search query when no patron >attribute is searchable by default. >--- > t/db_dependent/selenium/patrons_search.t | 43 +++++++++++++++++++++++- > 1 file changed, 42 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/selenium/patrons_search.t b/t/db_dependent/selenium/patrons_search.t >index 928e64f36f..11b493674e 100755 >--- a/t/db_dependent/selenium/patrons_search.t >+++ b/t/db_dependent/selenium/patrons_search.t >@@ -61,7 +61,7 @@ my $builder = t::lib::TestBuilder->new; > my $schema = Koha::Database->schema; > > subtest 'Search patrons' => sub { >- plan tests => 27; >+ plan tests => 28; > > if ( Koha::Patrons->search({surname => {-like => "test_patron_%"}})->count ) { > BAIL_OUT("Cannot run this test, data we need to create already exist in the DB"); >@@ -427,6 +427,47 @@ subtest 'Search patrons' => sub { > $dob_search_filter->clear; > }; > >+ subtest 'no clause for extended_attributes when none are default searchable' => sub { >+ $attribute_type_searchable->update({searched_by_default => 0}); >+ >+ $driver->get( $base_url . "/members/members-home.pl" ); >+ >+ $driver->execute_script(<<'EOF', 'capture_ajax_data'); >+jQuery( document ).on( "ajaxSend", function( event, request, settings ) { >+ jQuery('#patron_search_form').after('<div id="capture_ajax_data_was_executed"></div>'); >+ var url = new URL(window.location.origin + settings.url); >+ var parts = url.search.substring(1).split('&'); >+ var q; >+ for (var i = 0 ; i < parts.length ; i++) { >+ var p = parts[i].split('='); >+ if (p[0] === 'q') { >+ q = JSON.parse(decodeURIComponent(p[1])); >+ break; >+ } >+ } >+ >+ for (var i = 0; i < q.length; i++) { >+ var q0 = q[i]['-and']; >+ for (var j = 0; q0 && j < q0.length; j++) { >+ for (var k = 0; k < q0[j].length; k++) { >+ if (q0[j][k].hasOwnProperty('extended_attributes.code')) { >+ jQuery('#patron_search_form').after('<div id="had_extended_attributes_clause"></div>'); >+ } >+ } >+ } >+ } >+} ); >+EOF >+ $s->fill_form( { search_patron_filter => 'test_patron' } ); >+ $s->submit_form; >+ sleep $DT_delay && $s->wait_for_ajax; >+ my $e1 = $driver->find_elements('capture_ajax_data_was_executed', 'id'); >+ is(scalar(@$e1), 1, 'the capture script was executed'); >+ my $e2 = $driver->find_elements('had_extended_attributes_clause', 'id'); >+ is(scalar(@$e2), 0, 'there were no extended attributes on the search clause'); >+ >+ }; >+ > $driver->quit(); > }; > >-- >2.39.2
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 36025
:
161873
|
161874
|
161914
|
161915
|
175917
|
175918
|
175952
|
176747
|
176748
|
176823
|
176824
|
178037
|
178038
|
178039
|
178081
|
178082
|
178083