summaryrefslogtreecommitdiff
path: root/addons/survey/static/tests/tours/survey_session_manage_test.js
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/survey/static/tests/tours/survey_session_manage_test.js
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/survey/static/tests/tours/survey_session_manage_test.js')
-rw-r--r--addons/survey/static/tests/tours/survey_session_manage_test.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/addons/survey/static/tests/tours/survey_session_manage_test.js b/addons/survey/static/tests/tours/survey_session_manage_test.js
new file mode 100644
index 00000000..dfd7f538
--- /dev/null
+++ b/addons/survey/static/tests/tours/survey_session_manage_test.js
@@ -0,0 +1,37 @@
+odoo.define('survey.session_manage_test', function (require) {
+"use strict";
+
+var SessionManager = require('survey.session_manage');
+/**
+ * Small override for test/tour purposes.
+ */
+SessionManager.include({
+ /**
+ * - Trigger the fetch of answer results immediately at the start.
+ * (Instead of wasting 2 seconds waiting after the start).
+ * - Set the fade in/out time to 1 ms to avoid unnecessary delays.
+ * - Avoid refreshing the results every 2 seconds
+ */
+ start: function () {
+ var self = this;
+ return this._super.apply(this, arguments)
+ .then(this._refreshResults.bind(this))
+ .then(function () {
+ self.fadeInOutTime = 1;
+ clearInterval(self.resultsRefreshInterval);
+ });
+ },
+
+ /**
+ * Force the timer to "now" to avoid introducing potential test breaking
+ * timely variables (rpc/small server delay/...) if the start_question_time flickers.
+ */
+ _startTimer: function () {
+ this.$el.data('timer', moment.utc());
+ return this._super.apply(this, arguments);
+ }
+});
+
+return SessionManager;
+
+});