From eed52d64bba0ffec608ee780ce71cfb6483e66ed Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Fri, 30 Sep 2016 10:19:09 +0800 Subject: [PATCH 1/2] MDL-56210 behat: Ensure behat waits for dependancy manager --- lib/form/form.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/form/form.js b/lib/form/form.js index 43e209c394a..ef65209a2be 100644 --- a/lib/form/form.js +++ b/lib/form/form.js @@ -23,6 +23,9 @@ if (typeof M.form.dependencyManager === 'undefined') { this._hides = {}; this._dirty = {}; + // Let behat know that JS is pending. + M.util.js_pending('mform-dependency-manager-' + this.get('form').get('id')); + // Setup event handlers. Y.Object.each(this.get('dependencies'), function(value, i) { var elements = this.elementsByName(i); @@ -56,6 +59,9 @@ if (typeof M.form.dependencyManager === 'undefined') { }, this); this.updateAllDependencies(); + + // Let behat know that JS is complete. + M.util.js_complete('mform-dependency-manager-' + this.get('form').get('id')); }, /** @@ -588,6 +594,12 @@ M.form.initFormDependencies = function(Y, formid, dependencies) { */ M.form.updateFormState = function(formid) { if (formid in M.form.dependencyManagers) { + // Let behat know that JS is pending. + M.util.js_pending('mform-dependency-manager-' + formid); + M.form.dependencyManagers[formid].updateAllDependencies(); + + // Let behat know that JS is complete. + M.util.js_complete('mform-dependency-manager-' + formid); } }; From 24c2dcada50ecccc9240c1017a79437696637470 Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Mon, 3 Oct 2016 13:03:51 +0800 Subject: [PATCH 2/2] MDl-56210 behat: Ensure page is loaded, before checking button --- mod/lti/tests/behat/addtool.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/mod/lti/tests/behat/addtool.feature b/mod/lti/tests/behat/addtool.feature index 0703fe66b1b..4e7ed1da77e 100644 --- a/mod/lti/tests/behat/addtool.feature +++ b/mod/lti/tests/behat/addtool.feature @@ -32,6 +32,7 @@ Feature: Add tools And I turn editing mode on And I add a "Teaching Tool 1" to section "1" # For tool that does not support Content-Item message type, the Select content button must be disabled. + And I wait until the page is ready And the "Select content" "button" should be disabled And I set the field "Activity name" to "Test tool activity 1" And I click on "Show more..." "link"