From abc83c40b5fc2ffd32967b2b84bc0f66d03bd250 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Thu, 14 May 2020 11:10:57 +0800 Subject: [PATCH] MDL-68464 enrol_manual: Comment out buggy behat line This is commented out because auto-hidden toasts currently call `hide()` and trigger the `bs.toast.hide` event immediately, and _then_ apply the autohide delay. Since we automatically add M.util.pending_js calls when we _start_ to hide, and resolve them when the hide _finishes_, this means that we do: - addToast called - trigger `bs.toast.show` event - add to pending_js - [pending_js queue not empty - behat waits] - message is shown in UI - `hide()` called - trigger `bs.toast.hide` event - add to pending_js - [pending_js queue not empty - behat waits] - start autohide delay - [pending_js queue not empty - behat waits] - [pending_js queue not empty - behat waits] - [pending_js queue not empty - behat waits] - [pending_js queue not empty - behat waits] - end autohide delay - remove message (no longer present in DOM) - trigger `bs.toast.hidden` event - resolve pending_js - [pending_js queue empty - behat stops waiting] - Behat runs next step: And I should see "1 enrolled users" -- Step fails beacuse the message has been shown, and has then been removed The conversation should have been: - addToast called - trigger `bs.toast.show` event - add to pending_js - [pending_js queue not empty - behat waits] - message is shown in UI - start autohide delay - trigger `bs.toast.shown` event - resolve pending_js - [pending_js queue empty - behat stops waiting] - Behat runs next step: And I should see "1 enrolled users" -- Step passes - autohide delay ends and calls `hide()` - trigger bs.toast.hide event - add to pending_js - [behat waits] - end autohide delay - remove message (no longer present in DOM) - trigger `bs.toast.hidden` event - resolve pending_js - [pending_js queue empty - behat stops waiting] - Behat run continues See MDL-67386 for futher information. --- enrol/manual/tests/behat/quickenrolment.feature | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/enrol/manual/tests/behat/quickenrolment.feature b/enrol/manual/tests/behat/quickenrolment.feature index f2f3f6cc139..6d4494fe960 100644 --- a/enrol/manual/tests/behat/quickenrolment.feature +++ b/enrol/manual/tests/behat/quickenrolment.feature @@ -124,7 +124,9 @@ Feature: Teacher can search and enrol users one by one into the course And I should see "Student 001" And I click on "Enrol users" "button" in the "Enrol users" "dialogue" Then I should see "Active" in the "Student 001" "table_row" - And I should see "1 enrolled users" + # The following line is commented out as auto-hidden toasts fire events in the wrong place. + # TODO Uncomment this when we upgrade Bootstrap. This issue is fixed in v4.4.0 - see MDL-67386. + #And I should see "1 enrolled users" @javascript Scenario: Searching for a non-existing user