bemade_fsm: First functional test written for creating equipment linked to a client. Ref #11.

This commit is contained in:
Marc Durepos 2023-06-15 17:00:41 -04:00
parent 53b75e35a4
commit 2d7b76a44e
2 changed files with 18 additions and 15 deletions

View file

@ -5,15 +5,16 @@ import tour from 'web_tour.tour';
tour.register('task_equipment_tour', { tour.register('task_equipment_tour', {
test: true, test: true,
url: '/web', url: '/web',
}, [tour.stepUtils.showAppsMenuItem(), { }, /* Create a new "Test Equipment" and link it to "Test Partner Company" */
[tour.stepUtils.showAppsMenuItem(), {
content: 'Navigate to the Service menu', content: 'Navigate to the Service menu',
trigger: '.o_app[data-menu-xmlid="industry_fsm.fsm_menu_root"]', trigger: '.o_app[data-menu-xmlid="industry_fsm.fsm_menu_root"]',
}, { }, {
content: 'Navigate to the Clients submenu', content: 'Navigate to the Clients submenu',
trigger: '.o_app[data-menu-xmlid="bemade_fsm.menu_service_client"]', trigger: 'button.dropdown-toggle[data-menu-xmlid="bemade_fsm.menu_service_client"]',
}, { }, {
content: 'Navigate to the Equipment menu', content: 'Navigate to the Equipment menu',
trigger: '.o_app[data-menu-xmlid="bemade_fsm.menu_service_client_equipment"]', trigger: '.dropdown-item[data-menu-xmlid="bemade_fsm.menu_service_client_equipment"]',
}, { }, {
content: 'Click the create button', content: 'Click the create button',
trigger: '.o_list_button_add', trigger: '.o_list_button_add',
@ -28,11 +29,14 @@ tour.register('task_equipment_tour', {
run: 'text Test Tag Name', run: 'text Test Tag Name',
}, { }, {
content: 'Set the partner', content: 'Set the partner',
trigger: 'input[id="o_field_input_303"]', trigger: 'div[name="partner_location_id"] div div input',
run: 'text Test Partner Company', run: 'text Test Partner Company',
}, { }, {
content: 'Click the partner in the dropdown', content: 'Click the partner in the dropdown',
trigger: 'li a.dropdown-item:contains(Test Partner Company)', trigger: 'li a.dropdown-item:contains(Test Partner Company)',
}, {
content: 'Save',
trigger: 'button.o_form_button_save',
} }
// Fill in the required fields, including creating a new Client Location and PID Tag // Fill in the required fields, including creating a new Client Location and PID Tag
// Navigate to the client location, then to the client, making sure that the equipment and client location links appear // Navigate to the client location, then to the client, making sure that the equipment and client location links appear

View file

@ -1,5 +1,5 @@
from odoo.tests.common import TransactionCase from odoo.tests.common import TransactionCase
from odoo import Command
class FSMManagerUserTransactionCase(TransactionCase): class FSMManagerUserTransactionCase(TransactionCase):
@ -15,15 +15,15 @@ class FSMManagerUserTransactionCase(TransactionCase):
user_group_sales_user = cls.env.ref('sales_team.group_sale_salesman') user_group_sales_user = cls.env.ref('sales_team.group_sale_salesman')
user_product_customer = cls.env.ref('customer_product_code.group_product_customer_code_user') user_product_customer = cls.env.ref('customer_product_code.group_product_customer_code_user')
group_ids = [user_group_employee, group_ids = [user_group_employee.id,
user_group_project_user, user_group_project_user.id,
user_group_project_manager, user_group_project_manager.id,
user_group_fsm_user, user_group_fsm_user.id,
user_group_fsm_manager, user_group_fsm_manager.id,
user_group_sales_user, user_group_sales_user.id,
user_group_sales_manager, ] user_group_sales_manager.id, ]
if user_product_customer: if user_product_customer:
group_ids.append(user_product_customer) group_ids.append(user_product_customer.id)
# Test user with project access rights for the various tests # Test user with project access rights for the various tests
Users = cls.env['res.users'].with_context({'no_reset_password': True}) Users = cls.env['res.users'].with_context({'no_reset_password': True})
@ -33,6 +33,5 @@ class FSMManagerUserTransactionCase(TransactionCase):
'password': 'misterpm', 'password': 'misterpm',
'email': 'mrpm@testco.com', 'email': 'mrpm@testco.com',
'signature': 'Mr. PM', 'signature': 'Mr. PM',
'groups_id': [(6, 0, [user_group_employee.id, user_group_project_user.id, user_group_project_manager.id, 'groups_id': [Command.set(group_ids)],
user_group_sales_user.id])],
}) })