Bug 23102 - 404 errors on page causes SCI user to be logged out
Summary: 404 errors on page causes SCI user to be logged out
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Self checkout (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Nick Clemens (kidclamp)
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on: 18387
Blocks:
  Show dependency treegraph
 
Reported: 2019-06-12 11:41 UTC by Nick Clemens (kidclamp)
Modified: 2024-07-25 11:11 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.06,23.05.12
Circulation function:


Attachments
Bug 23102 - 404 errors on page causes SCI user to be logged out (1.36 KB, patch)
2019-06-12 11:44 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 23102: 404 errors on page causes SCI user to be logged out (1.36 KB, patch)
2020-01-18 20:27 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 23102: Add fieldset to login for selenium usage (1.27 KB, patch)
2020-02-14 16:44 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 23102: Selenium test (2.32 KB, patch)
2020-02-14 16:44 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 23102: 404 errors on page causes SCI user to be logged out (1.36 KB, patch)
2023-03-20 18:22 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 23102: Selenium test (2.41 KB, patch)
2023-03-20 18:22 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 23102: Selenium test (2.41 KB, patch)
2023-03-20 18:23 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 23102: Selenium test (2.43 KB, patch)
2023-03-20 18:23 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 23102: Fix tests (1.22 KB, patch)
2023-03-23 10:42 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 23102: Selenium test (2.71 KB, patch)
2023-03-27 13:24 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 23102: 404 errors on page causes SCI user to be logged out (1.36 KB, patch)
2023-03-27 13:24 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 23102: Selenium test (2.76 KB, patch)
2023-08-22 13:24 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 23102: 404 errors on page causes SCI user to be logged out (1.44 KB, patch)
2023-08-22 13:24 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 23102: Selenium test (2.76 KB, patch)
2024-03-18 16:35 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 23102: 404 errors on page causes SCI user to be logged out (1.77 KB, patch)
2024-03-18 16:35 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 23102: 404 errors on page causes SCI user to be logged out (1.84 KB, patch)
2024-04-10 09:51 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 23102: Selenium test (2.76 KB, patch)
2024-04-10 09:51 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 23102: 404 errors on page causes SCI user to be logged out (1.84 KB, patch)
2024-04-10 09:51 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 23102: No mock in selenium (1.67 KB, patch)
2024-04-12 09:50 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2019-06-12 11:41:49 UTC Comment hidden (obsolete)
Comment 1 Nick Clemens (kidclamp) 2019-06-12 11:44:56 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2019-06-20 01:28:35 UTC
(In reply to Nick Clemens from comment #1)
> Created attachment 90528 [details] [review] [review]
> Bug 23102 - 404 errors on page causes SCI user to be logged out
> 
> To test:
>  1 - Have something on the SCO page that won't load

Can you be more specific?
Comment 3 Nick Clemens (kidclamp) 2019-06-24 19:47:52 UTC
(In reply to Jonathan Druart from comment #2)
> (In reply to Nick Clemens from comment #1)
> > Created attachment 90528 [details] [review] [review] [review]
> > Bug 23102 - 404 errors on page causes SCI user to be logged out
> > 
> > To test:
> >  1 - Have something on the SCO page that won't load
> 
> Can you be more specific?

Add to SCOUserJS:
</script>
<img src="http://localhost:8080/silk/famfamfam.png"/>
<script>

You need to ask for something local that will return the Koha 404 page

This happens all the time in 18.11, related to new SCSS changes that were not fully backported, we ask for the wrong icons - see bug 23198
Comment 4 Jonathan Druart 2019-06-25 22:47:40 UTC
It would be great to have a regression selenium test here, do not you think?
Comment 5 Owen Leonard 2020-01-18 20:27:04 UTC Comment hidden (obsolete)
Comment 6 Owen Leonard 2020-01-18 20:27:29 UTC
(In reply to Jonathan Druart from comment #4)
> It would be great to have a regression selenium test here, do not you think?

This works for me, but should it be 'Failed QA' because of the missing test?
Comment 7 Marcel de Rooy 2020-01-24 07:00:56 UTC
(In reply to Owen Leonard from comment #6)
> (In reply to Jonathan Druart from comment #4)
> > It would be great to have a regression selenium test here, do not you think?
> 
> This works for me, but should it be 'Failed QA' because of the missing test?

Changing status. Please correct if you want to sign off on this patch and add your signoff line.
Comment 8 Nick Clemens (kidclamp) 2020-02-14 16:44:36 UTC
Created attachment 98977 [details] [review]
Bug 23102: Add fieldset to login for selenium usage
Comment 9 Nick Clemens (kidclamp) 2020-02-14 16:44:39 UTC
Created attachment 98978 [details] [review]
Bug 23102: Selenium test
Comment 10 Nick Clemens (kidclamp) 2020-02-14 16:45:18 UTC
The behaviour does still recur and can be fixed by this patch, however, I can't make the selenium tests fail
Comment 11 Jonathan Druart 2020-02-17 10:06:47 UTC
(In reply to Nick Clemens from comment #10)
> The behaviour does still recur and can be fixed by this patch, however, I
> can't make the selenium tests fail

What are you using in the pref? Using what you used in the tests I am not able to recreate the problem.
Comment 12 Martin Renvoize (ashimema) 2020-09-21 12:58:10 UTC
This is an evil bug.. very easy to hit at upgrades and have absolutely no idea what's triggering the behaviour.
Comment 13 Nick Clemens (kidclamp) 2021-04-26 15:02:36 UTC
We still face this problem, while it is difficult to recreate in testing, in production this happens and the code is simple and self explanatory
Comment 14 Hayley Pelham 2021-12-21 22:56:22 UTC
Patch doesn't apply
Comment 15 Nick Clemens (kidclamp) 2023-03-20 18:22:22 UTC
Created attachment 148423 [details] [review]
Bug 23102: 404 errors on page causes SCI user to be logged out

To test:
 1 - Have something on the SCO page that won't load
 2 - Add the self_checkin_module and self_checkout_module permissions to the AutoSelfCheck user
 3 - Access the selfcheckout module https://yoursite.org/cgi-bin/koha/sco/sco-main.pl
 4 - Sign in
 5 - Click 'Finish'
 6 - Yes to print a receipt
 7 - You are asked to sign in again
 8 - Repeat with the SCI module
 9 - Apply patch
10 - Repeat, but this time the slip can be printed
Comment 16 Nick Clemens (kidclamp) 2023-03-20 18:22:24 UTC
Created attachment 148424 [details] [review]
Bug 23102: Selenium test
Comment 17 Nick Clemens (kidclamp) 2023-03-20 18:23:27 UTC
Created attachment 148425 [details] [review]
Bug 23102: Selenium test
Comment 18 Nick Clemens (kidclamp) 2023-03-20 18:23:50 UTC
Created attachment 148426 [details] [review]
Bug 23102: Selenium test
Comment 19 Nick Clemens (kidclamp) 2023-03-20 18:25:22 UTC
Rebased, it now works - tests fail with out the patch, they succeed with the patch
Comment 20 Jonathan Druart 2023-03-23 10:42:35 UTC
Created attachment 148601 [details] [review]
Bug 23102: Fix tests

#   Failed test 'No tests run for subtest "SCI can load error pages"'
 #   at t/db_dependent/selenium/regressions.t line 86.
 Too many forms are displayed. Cannot submit. at /kohadevbox/koha/t/lib/Selenium.pm line 140.
Comment 21 Jonathan Druart 2023-03-23 10:42:55 UTC
The tests were failing, I fixed them. But now they are passing with and without the fix. Can you have another look please?
Comment 22 Nick Clemens (kidclamp) 2023-03-27 13:24:39 UTC
Created attachment 148767 [details] [review]
Bug 23102: Selenium test
Comment 23 Nick Clemens (kidclamp) 2023-03-27 13:24:41 UTC
Created attachment 148768 [details] [review]
Bug 23102: 404 errors on page causes SCI user to be logged out

To test:
 1 - Have something on the SCO page that won't load
 2 - Add the self_checkin_module and self_checkout_module permissions to the AutoSelfCheck user
 3 - Access the selfcheckout module https://yoursite.org/cgi-bin/koha/sco/sco-main.pl
 4 - Sign in
 5 - Click 'Finish'
 6 - Yes to print a receipt
 7 - You are asked to sign in again
 8 - Repeat with the SCI module
 9 - Apply patch
10 - Repeat, but this time the slip can be printed
Comment 24 Nick Clemens (kidclamp) 2023-03-27 13:25:42 UTC
(In reply to Jonathan Druart from comment #21)
> The tests were failing, I fixed them. But now they are passing with and
> without the fix. Can you have another look please?

Yes, the problem was that the page does load, but you are kicked out after - so we need to load, submit, then see we are logged out
Comment 25 Magnus Enger 2023-05-05 12:48:27 UTC
I can't reproduce the problem in ktd. I put this: 

</script>
<img src="http://localhost:8080/silk/famfamfam.png"/>
<script>

in SCOUserJS, restarted all the things and logged into SCO, then clicked "Finished", "Print receipt and end session" and could print the receipt without getting logged out.
Comment 26 Nick Clemens (kidclamp) 2023-06-26 17:25:57 UTC
(In reply to Magnus Enger from comment #25)
> I can't reproduce the problem in ktd. I put this: 
> 
> </script>
> <img src="http://localhost:8080/silk/famfamfam.png"/>
> <script>
> 
> in SCOUserJS, restarted all the things and logged into SCO, then clicked
> "Finished", "Print receipt and end session" and could print the receipt
> without getting logged out.

Yes, it seems we 'fixed' this problem, but if we fix bug 33881 it will reintroduce this issue
Comment 27 David Cook 2023-07-10 00:41:06 UTC
I'm short on time at the moment, but if someone signs this off, and I could look at QAing it perhaps next week...
Comment 28 Magnus Enger 2023-08-22 07:04:59 UTC
(In reply to Nick Clemens from comment #26)

> Yes, it seems we 'fixed' this problem, but if we fix bug 33881 it will
> reintroduce this issue

Does the test plan still make sense, or is there something else to look out for?
Comment 29 Nick Clemens (kidclamp) 2023-08-22 13:24:40 UTC
Created attachment 154691 [details] [review]
Bug 23102: Selenium test
Comment 30 Nick Clemens (kidclamp) 2023-08-22 13:24:43 UTC
Created attachment 154692 [details] [review]
Bug 23102: 404 errors on page causes SCI user to be logged out

To test:
 1 - Have something on the SCO page that won't load
 2 - Add the self_checkin_module and self_checkout_module permissions to the AutoSelfCheck user
 3 - Access the selfcheckout module https://yoursite.org/cgi-bin/koha/sco/sco-main.pl
 4 - Sign in using a patron
 5 - Enter an unkown barcode, I used "DONTMATTER"
 6 - If not logged out, click to 'Return to account summary'
 7 - You are asked to sign in again
 8 - Repeat with the SCI module
 9 - Apply patch
10 - Repeat, but this time you can return to account
Comment 31 Nick Clemens (kidclamp) 2023-08-22 13:25:03 UTC
(In reply to Magnus Enger from comment #28)
> Does the test plan still make sense, or is there something else to look out
> for?

Updated
Comment 32 David Cook 2023-09-06 00:20:32 UTC
I'm getting an error when I try running the selenium test.

root@kohadevbox:koha(bug_23102)$ prove t/db_dependent/selenium/regressions.t
t/db_dependent/selenium/regressions.t ..
    #   Failed test at t/db_dependent/selenium/regressions.t line 87.
Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 125.
    #                   'Log in to your account › Koha online catalog'
    #     doesn't match '(?^u:Self check-in)'
    # Looks like you failed 1 test of 1.
t/db_dependent/selenium/regressions.t .. 1/9
#   Failed test 'SCI can load error pages'
#   at t/db_dependent/selenium/regressions.t line 92.
t/db_dependent/selenium/regressions.t .. 7/9 Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 156.
Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 156.
Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 156.
Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 156.
Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 156.
Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 156.
t/db_dependent/selenium/regressions.t .. 9/9 # Looks like you failed 1 test of 9.
t/db_dependent/selenium/regressions.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/9 subtests

Test Summary Report
-------------------
t/db_dependent/selenium/regressions.t (Wstat: 256 Tests: 9 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
Files=1, Tests=9, 51 wallclock secs ( 0.03 usr  0.01 sys +  3.94 cusr  0.58 csys =  4.56 CPU)
Result: FAIL
Comment 33 David Cook 2023-09-06 00:27:00 UTC
Test plan missing some steps like enabling "SelfCheckInModule" and how to "have something on the SCO page that won't load". I used "SelfCheckInMainUserBlock" with <img src="x"> for the self-checkin. 

I can't get the AutoSelfCheck user to log into the self checkin it seems? Is it supposed to be?

But I think the patch is working?
Comment 34 Nick Clemens (kidclamp) 2024-03-18 16:35:44 UTC
Created attachment 163358 [details] [review]
Bug 23102: Selenium test
Comment 35 Nick Clemens (kidclamp) 2024-03-18 16:35:47 UTC
Created attachment 163359 [details] [review]
Bug 23102: 404 errors on page causes SCI user to be logged out

To test:
 1 - Have something on the SCO page that won't load
     Add to SCOUserJS:
        </script>
        <img src="http://localhost:8080/silk/famfamfam.png"/>
        <script>
 2 - Enable the SCO and SCI system preferences:
     WebBasedSelfCheck: Enable
     SelfCheckInModuke: Enable
     AutoSelfCheckAllowed: Allow
     AutoSelfCheckID / AutoSelfCheckPass to a valid user with permissions
 3 - Add the self_checkin_module and self_checkout_module permissions to the AutoSelfCheck user
 4 - Access the selfcheckout module https://yoursite.org/cgi-bin/koha/sco/sco-main.pl
 5 - Sign in using a patron
 6 - Enter an unkown barcode, I used "DONTMATTER"
 7 - If not logged out, click to 'Return to account summary'
 8 - You are asked to sign in again
 9 - Repeat with the SCI module
10 - Apply patch
11 - Repeat, but this time you can return to account
Comment 36 Jonathan Druart 2024-03-20 09:14:38 UTC
Why are we loosing track of things during years? Should we buy a brain to share?
Comment 37 Martin Renvoize (ashimema) 2024-04-10 09:51:23 UTC
Created attachment 164591 [details] [review]
Bug 23102: 404 errors on page causes SCI user to be logged out

To test:
 1 - Have something on the SCO page that won't load
     Add to SCOUserJS:
        </script>
        <img src="http://localhost:8080/silk/famfamfam.png"/>
        <script>
 2 - Enable the SCO and SCI system preferences:
     WebBasedSelfCheck: Enable
     SelfCheckInModuke: Enable
     AutoSelfCheckAllowed: Allow
     AutoSelfCheckID / AutoSelfCheckPass to a valid user with permissions
 3 - Add the self_checkin_module and self_checkout_module permissions to the AutoSelfCheck user
 4 - Access the selfcheckout module https://yoursite.org/cgi-bin/koha/sco/sco-main.pl
 5 - Sign in using a patron
 6 - Enter an unkown barcode, I used "DONTMATTER"
 7 - If not logged out, click to 'Return to account summary'
 8 - You are asked to sign in again
 9 - Repeat with the SCI module
10 - Apply patch
11 - Repeat, but this time you can return to account

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 38 Martin Renvoize (ashimema) 2024-04-10 09:51:46 UTC
Created attachment 164592 [details] [review]
Bug 23102: Selenium test
Comment 39 Martin Renvoize (ashimema) 2024-04-10 09:51:49 UTC
Created attachment 164593 [details] [review]
Bug 23102: 404 errors on page causes SCI user to be logged out

To test:
 1 - Have something on the SCO page that won't load
     Add to SCOUserJS:
        </script>
        <img src="http://localhost:8080/silk/famfamfam.png"/>
        <script>
 2 - Enable the SCO and SCI system preferences:
     WebBasedSelfCheck: Enable
     SelfCheckInModuke: Enable
     AutoSelfCheckAllowed: Allow
     AutoSelfCheckID / AutoSelfCheckPass to a valid user with permissions
 3 - Add the self_checkin_module and self_checkout_module permissions to the AutoSelfCheck user
 4 - Access the selfcheckout module https://yoursite.org/cgi-bin/koha/sco/sco-main.pl
 5 - Sign in using a patron
 6 - Enter an unkown barcode, I used "DONTMATTER"
 7 - If not logged out, click to 'Return to account summary'
 8 - You are asked to sign in again
 9 - Repeat with the SCI module
10 - Apply patch
11 - Repeat, but this time you can return to account

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 40 Martin Renvoize (ashimema) 2024-04-10 09:52:37 UTC
Clear fix, well tested.. Passing QA
Comment 41 Katrin Fischer 2024-04-12 07:30:16 UTC
I am sorry, but the unit test is failing for me :(

Running tests (1)
	* Proving /kohadevbox/koha/t/db_dependent/selenium/regressions.t KO!

    #   Failed test at /kohadevbox/koha/t/db_dependent/selenium/regressions.t line 87.
 Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 125.
    #                   'An error has occurred › Koha online catalog'
    #     doesn't match '(?^u:Self check-in)'
     # Looks like you failed 1 test of 1.
 
#   Failed test 'SCI can load error pages'
#   at /kohadevbox/koha/t/db_dependent/selenium/regressions.t line 92.
 Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 156.
 Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 156.
 Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 156.
 Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 156.
 Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 156.
 Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 156.
 # Looks like you failed 1 test of 9.
 /kohadevbox/koha/t/db_dependent/selenium/regressions.t .. 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/9 subtests 

Test Summary Report
-------------------
/kohadevbox/koha/t/db_dependent/selenium/regressions.t (Wstat: 256 Tests: 9 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
Files=1, Tests=9, 38 wallclock secs ( 0.02 usr  0.01 sys +  2.99 cusr  0.52 csys =  3.54 CPU)
Result: FAIL
Comment 42 Nick Clemens (kidclamp) 2024-04-12 08:27:40 UTC
THis did initially fail - after a rest_all it worked fine
Comment 43 Nick Clemens (kidclamp) 2024-04-12 09:50:32 UTC
Created attachment 164819 [details] [review]
Bug 23102: No mock in selenium
Comment 44 Nick Clemens (kidclamp) 2024-04-24 13:59:04 UTC
I worked with Katrin on this one and got tests passing, it was pushed to main, updating here
Comment 45 Fridolin Somers 2024-05-23 12:46:17 UTC
Pushed to 23.11.x for 23.11.06
Comment 46 Lucas Gass (lukeg) 2024-05-28 18:08:56 UTC
Backported to 23.05.x for upcoming 23.05.12