diff options
| author | dmonzonis <mod@odoo.com> | 2020-05-07 07:09:43 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-05-27 12:47:16 +0000 |
| commit | 936d206559035627b07a25e7a0f807ad43d39f54 (patch) | |
| tree | 23b7d64a07f15a26b630383e70bc472fef1bbb70 /addons/test_mail_full | |
| parent | 5b20117495b908bde3877c02db3ada7249eb7993 (diff) | |
[IMP] mail_bot: improve OdooBot workflow
This commit attempts to improve the workflow of the OdooBot onboarding
tutorial, as well as the answer given by the bot while idle.
These changes come from watching how users interact with OdooBot. To
improve the user's experience, the following changes have been made:
1. Move the attachment to the end of the tour, as it is where most
people just close the bot.
2. Remove the quotation marks around commands that OdooBot tells the
user to type, like "/" or ":)", as some users try to actually type
the quotation marks too. Instead, use a light grey background around
the command that the user should type.
3. Some users ask OdooBot questions, but the responses they get are
useless. To solve this, use a message linking to the documentation or the
videos when:
- The user gives wrong answers twice for the same stage of the tour
- The user talks again when the tour is completed
- There's a question mark in the answer
To achieve this a "failed" state field is added on user model, allowing to
distinguish state in the bot workflow from state of answers (failed / not
failed).
Task ID: 2233014
PR #49661
Diffstat (limited to 'addons/test_mail_full')
| -rw-r--r-- | addons/test_mail_full/tests/test_odoobot.py | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/addons/test_mail_full/tests/test_odoobot.py b/addons/test_mail_full/tests/test_odoobot.py index 2e4dc55490a..ddd6015b7e1 100644 --- a/addons/test_mail_full/tests/test_odoobot.py +++ b/addons/test_mail_full/tests/test_odoobot.py @@ -58,6 +58,19 @@ class TestOdoobot(TestMailCommon, TestRecipients): channel = self.env['mail.channel'].with_user(self.user_employee).init_odoobot() kwargs['body'] = 'tagada 😊' + last_message = self.assertNextMessage( + channel.message_post(**kwargs), + sender=self.odoobot, + answer=("help",) + ) + channel.execute_command(command="help") + self.assertNextMessage( + last_message, # no message will be post with command help, use last odoobot message instead + sender=self.odoobot, + answer=("@OdooBot",) + ) + kwargs['body'] = '' + kwargs['partner_ids'] = [self.env['ir.model.data'].xmlid_to_res_id("base.partner_root")] self.assertNextMessage( channel.message_post(**kwargs), sender=self.odoobot, @@ -70,20 +83,12 @@ class TestOdoobot(TestMailCommon, TestRecipients): 'res_model': 'mail.compose.message', }) kwargs['attachment_ids'] = [attachment.id] - last_message = self.assertNextMessage( - channel.message_post(**kwargs), - sender=self.odoobot, - answer=("help",) - ) - kwargs['attachment_ids'] = [] + # For the end of the flow, we only test that the state changed, but not to which + # one since it depends on the intalled apps, which can add more steps (like livechat) + channel.message_post(**kwargs) + self.assertNotEqual(self.user_employee.odoobot_state, 'onboarding_attachement') - channel.execute_command(command="help") - self.assertNextMessage( - last_message, # no message will be post with command help, use last odoobot message instead - sender=self.odoobot, - answer=("@OdooBot",) - ) - # we dont test the end of the flow since it will depends of the installed apps (livechat) + # Test miscellaneous messages self.user_employee.odoobot_state = "idle" kwargs['partner_ids'] = [] kwargs['body'] = "I love you" @@ -98,6 +103,12 @@ class TestOdoobot(TestMailCommon, TestRecipients): sender=self.odoobot, answer=("I have feelings",) ) + kwargs['body'] = "help me" + self.assertNextMessage( + channel.message_post(**kwargs), + sender=self.odoobot, + answer=("If you need help",) + ) @mute_logger('odoo.addons.mail.models.mail_mail') def test_odoobot_no_default_answer(self): |
