https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32010

--- Comment #7 from Jonathan Druart <[email protected]> ---
In my understanding there is a missing wait_for_ajax call at after we click

The test:
279         $driver->find_element('//*[@id="pin_code"]')->clear;
280         $driver->find_element('//*[@id="pin_code"]')->send_keys($pin_code);
281         $driver->find_element('//*[@id="register-2FA"]')->click;
282         is( $driver->get_alert_text,
283             "Two-factor authentication correctly configured. You will be
redirected to the login screen."
284         );
285         $driver->accept_alert;

But wait_for_ajax is waiting for the return of success, and the alert is there.
The code:
250                 $.ajax({
251                     data: data,
252                     type: 'POST',
253                     url:
'/api/v1/auth/two-factor/registration/verification',
254                     success: function (data) {
255                         alert(_("Two-factor authentication correctly
configured. You will be redirected to the login screen."));
256                         window.location = "/cgi-bin/koha/mainpage.pl";
257                     },
258                     error: function (data) {
259                         const error = data.responseJSON.error;
260                         if ( error == 'Invalid pin' ) {
261                             $("#errors").html(_("Invalid PIN
code")).show();
262                         } else {
263                             alert(error);
264                         }
265                     },
266                 });

So either we remove the test, or adjust the code to make the alert appears
after the ajax call is done (which may make the code not very nice).

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to