summaryrefslogtreecommitdiff
path: root/addons/im_support/static/tests
diff options
context:
space:
mode:
Diffstat (limited to 'addons/im_support/static/tests')
-rw-r--r--addons/im_support/static/tests/helpers/test_utils.js4
-rw-r--r--addons/im_support/static/tests/systray_no_support_tests.js7
-rw-r--r--addons/im_support/static/tests/systray_tests.js43
3 files changed, 24 insertions, 30 deletions
diff --git a/addons/im_support/static/tests/helpers/test_utils.js b/addons/im_support/static/tests/helpers/test_utils.js
index 3347c43029f..e0a5bdfd73a 100644
--- a/addons/im_support/static/tests/helpers/test_utils.js
+++ b/addons/im_support/static/tests/helpers/test_utils.js
@@ -58,7 +58,7 @@ function addMockSupportEnvironment(widget, params) {
}
return result;
};
- testUtils.addMockEnvironment(widget, params);
+ testUtils.mock.addMockEnvironment(widget, params);
var widgetDestroy = widget.destroy;
widget.destroy = function () {
supportSession.rpc = originalRPC;
@@ -69,7 +69,7 @@ function addMockSupportEnvironment(widget, params) {
// 'im_support.poll_timeout', to simulate a pending longpolling connection to
// the Support server, such that the initSupport initiates a poll connection
if (params.enableSupportPoll) {
- testUtils.intercept(widget, 'call_service', function (ev) {
+ testUtils.mock.intercept(widget, 'call_service', function (ev) {
if (ev.data.service === 'local_storage') {
if (ev.data.method === 'getItem' && ev.data.args[0] === 'im_support.poll_timeout') {
ev.data.callback(Date.now() + (60 * 1000));
diff --git a/addons/im_support/static/tests/systray_no_support_tests.js b/addons/im_support/static/tests/systray_no_support_tests.js
index 89cb5b0389d..f835c0e55b7 100644
--- a/addons/im_support/static/tests/systray_no_support_tests.js
+++ b/addons/im_support/static/tests/systray_no_support_tests.js
@@ -38,15 +38,14 @@ QUnit.test('messaging menu does not display the Support channel if not available
assert.expect(1);
var messagingMenu = new MessagingMenu();
- testUtils.addMockEnvironment(messagingMenu, {
+ testUtils.mock.addMockEnvironment(messagingMenu, {
data: this.data,
services: this.services,
});
messagingMenu.appendTo($('#qunit-fixture'));
- messagingMenu.$('.dropdown-toggle').click();
- assert.strictEqual(messagingMenu.$('.o_mail_systray_dropdown_bottom .o_mail_preview[data-preview-id=SupportChannel]').length,
- 0, "should not display the Support channel");
+ testUtils.dom.click(messagingMenu.$('.dropdown-toggle'));
+ assert.containsNone(messagingMenu, '.o_mail_systray_dropdown_bottom .o_mail_preview[data-preview-id=SupportChannel]', "should not display the Support channel");
messagingMenu.destroy();
});
diff --git a/addons/im_support/static/tests/systray_tests.js b/addons/im_support/static/tests/systray_tests.js
index 3bf05417d7e..9f50ce1d29c 100644
--- a/addons/im_support/static/tests/systray_tests.js
+++ b/addons/im_support/static/tests/systray_tests.js
@@ -40,9 +40,8 @@ QUnit.test('messaging menu displays the Support channel', function (assert) {
});
messagingMenu.appendTo($('#qunit-fixture'));
- messagingMenu.$('.dropdown-toggle').click();
- assert.strictEqual(messagingMenu.$('.o_mail_systray_dropdown_bottom .o_mail_preview[data-preview-id=SupportChannel]').length,
- 1, "should display the Support channel");
+ testUtils.dom.click(messagingMenu.$('.dropdown-toggle'));
+ assert.containsOnce(messagingMenu, '.o_mail_systray_dropdown_bottom .o_mail_preview[data-preview-id=SupportChannel]', "should display the Support channel");
messagingMenu.destroy();
});
@@ -74,11 +73,10 @@ QUnit.test('clicking on Support channel: channel not available', function (asser
});
messagingMenu.appendTo($('#qunit-fixture'));
- messagingMenu.$('.dropdown-toggle').click();
- assert.strictEqual(messagingMenu.$('.o_mail_systray_dropdown_bottom .o_mail_preview[data-preview-id=SupportChannel]').length,
- 1, "should display the Support channel");
+ testUtils.dom.click(messagingMenu.$('.dropdown-toggle'));
+ assert.containsOnce(messagingMenu, '.o_mail_systray_dropdown_bottom .o_mail_preview[data-preview-id=SupportChannel]');
- messagingMenu.$('.o_mail_preview[data-preview-id=SupportChannel]').click();
+ testUtils.dom.click(messagingMenu.$('.o_mail_preview[data-preview-id=SupportChannel]'));
assert.strictEqual($('.o_thread_window').length, 1,
"should have open a chat window");
assert.strictEqual($('.o_thread_window .o_thread_window_title').text().trim(), 'Support (offline)',
@@ -119,11 +117,10 @@ QUnit.test('clicking on Support channel: channel available', function (assert) {
});
messagingMenu.appendTo($('#qunit-fixture'));
- messagingMenu.$('.dropdown-toggle').click();
- assert.strictEqual(messagingMenu.$('.o_mail_systray_dropdown_bottom .o_mail_preview[data-preview-id=SupportChannel]').length,
- 1, "should display the Support channel");
+ testUtils.dom.click(messagingMenu.$('.dropdown-toggle'));
+ assert.containsOnce(messagingMenu, '.o_mail_systray_dropdown_bottom .o_mail_preview[data-preview-id=SupportChannel]');
- messagingMenu.$('.o_mail_preview[data-preview-id=SupportChannel]').click();
+ testUtils.dom.click(messagingMenu.$('.o_mail_preview[data-preview-id=SupportChannel]'));
assert.strictEqual($('.o_thread_window').length, 1,
"should have open a chat window");
assert.strictEqual($('.o_thread_window .o_thread_window_title').text().trim(), 'Support',
@@ -164,11 +161,10 @@ QUnit.test('post messages in Support channel', function (assert) {
});
messagingMenu.appendTo($('#qunit-fixture'));
- messagingMenu.$('.dropdown-toggle').click();
- assert.strictEqual(messagingMenu.$('.o_mail_systray_dropdown_bottom .o_mail_preview[data-preview-id=SupportChannel]').length,
- 1, "should display the Support channel");
+ testUtils.dom.click(messagingMenu.$('.dropdown-toggle'));
+ assert.containsOnce(messagingMenu, '.o_mail_systray_dropdown_bottom .o_mail_preview[data-preview-id=SupportChannel]');
- messagingMenu.$('.o_mail_preview[data-preview-id=SupportChannel]').click();
+ testUtils.dom.click(messagingMenu.$('.o_mail_preview[data-preview-id=SupportChannel]'));
assert.strictEqual($('.o_thread_window .o_composer_input').length, 1,
"should have a composer");
@@ -208,25 +204,24 @@ QUnit.test('fold Support channel', function (assert) {
services: this.services,
session: this.supportParams,
});
- testUtils.intercept(messagingMenu, 'call_service', function (ev) {
+ testUtils.mock.intercept(messagingMenu, 'call_service', function (ev) {
if (ev.data.service === 'local_storage') {
assert.step('LocalStorage: ' + ev.data.method + ' ' + ev.data.args);
}
}, true);
messagingMenu.appendTo($('#qunit-fixture'));
- messagingMenu.$('.dropdown-toggle').click();
- assert.strictEqual(messagingMenu.$('.o_mail_systray_dropdown_bottom .o_mail_preview[data-preview-id=SupportChannel]').length,
- 1, "should display the Support channel");
+ testUtils.dom.click(messagingMenu.$('.dropdown-toggle'));
+ assert.containsOnce(messagingMenu, '.o_mail_systray_dropdown_bottom .o_mail_preview[data-preview-id=SupportChannel]');
- messagingMenu.$('.o_mail_preview[data-preview-id=SupportChannel]').click();
+ testUtils.dom.click(messagingMenu.$('.o_mail_preview[data-preview-id=SupportChannel]'));
assert.strictEqual($('.o_thread_window').length, 1,
"should have open a chat window");
// fold, re-open and close channel
- $('.o_thread_window .o_thread_window_title').click();
- $('.o_thread_window .o_thread_window_title').click();
- $('.o_thread_window .o_thread_window_close').click();
+ testUtils.dom.click($('.o_thread_window .o_thread_window_title'));
+ testUtils.dom.click($('.o_thread_window .o_thread_window_title'));
+ testUtils.dom.click($('.o_thread_window .o_thread_window_close'));
assert.verifySteps([
'/mail/init_messaging',
@@ -322,7 +317,7 @@ QUnit.test('receive messages in the Support channel', function (assert) {
"there should be a new message in the thread");
assert.strictEqual($('.o_thread_window .o_thread_message .o_thread_author ').text().trim(),
'An operator', "should correctly display the author");
- assert.strictEqual($('.o_thread_window .o_thread_message .o_thread_message_avatar').attr('data-src'),
+ assert.hasAttrValue($('.o_thread_window .o_thread_message .o_thread_message_avatar'), 'data-src',
'/mail/static/src/img/odoo_o.png', "should have correct avatar");
assert.strictEqual($('.o_thread_window .o_thread_message .o_thread_message_content ').text().trim(),
'A message', "message is correct");