-
Notifications
You must be signed in to change notification settings - Fork 23k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] hr_expense: replace JS test by tour
In /pull/138387, a new feature was added where clicking on an expense line in an expense sheet will highlight the receipts of that line in the attachment viewer if any. A JS test was included for this feature that mocked the fetching of the sheet's attachment. Since this changed in the backend in /pull/142029, the feature no longer worked but the test never broke since it was mocking the backend. This commit adds a tour to prevent that from happening again. closes #155417 Signed-off-by: Habib Ayob (ayh) <ayh@odoo.com>
- Loading branch information
Showing
4 changed files
with
108 additions
and
109 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
addons/hr_expense/static/src/js/tours/show_expense_receipt_tour.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** @odoo-module **/ | ||
|
||
import { registry } from "@web/core/registry"; | ||
import { stepUtils } from "@web_tour/tour_service/tour_utils"; | ||
|
||
registry.category("web_tour.tours").add('show_expense_receipt_tour', { | ||
test: true, | ||
url: '/web', | ||
steps: () => [ | ||
...stepUtils.goToAppSteps('hr_expense.menu_hr_expense_root', "Go to the Expenses app"), | ||
{ | ||
content: "Go to Expense Reports", | ||
trigger: '.dropdown-item[data-menu-xmlid="hr_expense.menu_hr_expense_report"]', | ||
position:'bottom', | ||
}, | ||
{ | ||
content: "Go to a report", | ||
trigger: '.o_data_row .o_data_cell[name="payment_state"]', | ||
}, | ||
{ | ||
content: "Click on an expense line 2", | ||
trigger: '.o_data_row .o_data_cell[data-tooltip="expense_2"]', | ||
}, | ||
{ | ||
content: "Check attachment", | ||
trigger: ".o_attachment_preview .o-mail-Attachment-imgContainer .img[src*='test_file_2.png']", | ||
}, | ||
{ | ||
content: "Click on an expense line 3", | ||
trigger: '.o_data_row .o_data_cell[data-tooltip="expense_3"]', | ||
}, | ||
{ | ||
content: "Check attachment", | ||
trigger: ".o_attachment_preview .o-mail-Attachment-imgContainer .img[src*='test_file_3.png']", | ||
}, | ||
{ | ||
content: "Click on an expense line 1", | ||
trigger: '.o_data_row .o_data_cell[data-tooltip="expense_1"]', | ||
}, | ||
{ | ||
content: "Check attachment", | ||
trigger: ".o_attachment_preview .o-mail-Attachment-imgContainer .img[src*='test_file_1.png']", | ||
}, | ||
], | ||
}); |
109 changes: 0 additions & 109 deletions
109
addons/hr_expense/static/tests/views/expense_line_widget.test.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
from odoo import Command | ||
from odoo.addons.hr_expense.tests.common import TestExpenseCommon | ||
from odoo.tests import tagged, HttpCase | ||
|
||
|
||
@tagged('-at_install', 'post_install') | ||
class TestUi(TestExpenseCommon, HttpCase): | ||
browser_size = "1920,1080" | ||
|
||
def test_show_expense_receipt_on_expense_line_click(self): | ||
expense_1, expense_2, expense_3 = self.env['hr.expense'].create([ | ||
{ | ||
'name': 'expense_1', | ||
'employee_id': self.expense_employee.id, | ||
'product_id': self.product_c.id, | ||
'total_amount': 1000, | ||
}, | ||
{ | ||
'name': 'expense_2', | ||
'employee_id': self.expense_employee.id, | ||
'product_id': self.product_c.id, | ||
'total_amount': 999, | ||
}, | ||
{ | ||
'name': 'expense_3', | ||
'employee_id': self.expense_employee.id, | ||
'product_id': self.product_c.id, | ||
'total_amount': 998, | ||
}, | ||
]) | ||
attachment_1, attachment_2, attachment_3 = self.env['ir.attachment'].create([ | ||
{ | ||
'name': "test_file_1.png", | ||
'raw': b"R0lGODdhAQABAIAAAP///////ywAAAAAAQABAAACAkQBADs=1", | ||
'res_id': expense_1.id, | ||
'res_model': 'hr.expense', | ||
}, | ||
{ | ||
'name': "test_file_2.png", | ||
'raw': b"R0lGODdhAQABAIAAAP///////ywAAAAAAQABAAACAkQBADs=2", | ||
'res_id': expense_2.id, | ||
'res_model': 'hr.expense', | ||
}, | ||
{ | ||
'name': "test_file_3.png", | ||
'raw': b"R0lGODdhAQABAIAAAP///////ywAAAAAAQABAAACAkQBADs=3", | ||
'res_id': expense_3.id, | ||
'res_model': 'hr.expense', | ||
}, | ||
]) | ||
|
||
expense_1.message_main_attachment_id = attachment_1 | ||
expense_2.message_main_attachment_id = attachment_2 | ||
expense_3.message_main_attachment_id = attachment_3 | ||
|
||
self.env['hr.expense.sheet'].create({ | ||
'employee_id': self.expense_employee.id, | ||
'name': 'test sheet', | ||
'expense_line_ids': [Command.set([expense_1.id, expense_2.id, expense_3.id])], | ||
}) | ||
|
||
self.start_tour('/web', 'show_expense_receipt_tour', login=self.env.user.login) |