bemade_fsm: Added and modified some tests for #11.

This commit is contained in:
Marc Durepos 2023-06-15 16:18:36 -04:00
parent 641342d5c0
commit 7e334d54ea
5 changed files with 49 additions and 15 deletions

View file

@ -46,6 +46,7 @@
'assets': {
'web.assets_tests': [
'bemade_fsm/static/tests/tours/task_template_tour.js',
'bemade_fsm/static/tests/tours/task_equipment_tour.js',
],
},
'installable': True,

View file

@ -1,7 +1,39 @@
/** @odoo-module **/
// Navigate to the Service > Clients > Equipment menu
// Click the Create button
import tour from 'web_tour.tour';
tour.register('task_equipment_tour', {
test: true,
url: '/web',
}, [tour.stepUtils.showAppsMenuItem(), {
content: 'Navigate to the Service menu',
trigger: '.o_app[data-menu-xmlid="industry_fsm.fsm_menu_root"]',
}, {
content: 'Navigate to the Clients submenu',
trigger: '.o_app[data-menu-xmlid="bemade_fsm.menu_service_client"]',
}, {
content: 'Navigate to the Equipment menu',
trigger: '.o_app[data-menu-xmlid="bemade_fsm.menu_service_client_equipment"]',
}, {
content: 'Click the create button',
trigger: '.o_list_button_add',
extra_trigger: 'li.breadcrumb-item.active:has(span:contains(Equipment))',
}, {
content: 'Add a tag',
trigger: 'input[name="pid_tag"]',
run: 'text TestPIDTag',
}, {
content: 'Set the name',
trigger: 'input[name="name"]',
run: 'text Test Tag Name',
}, {
content: 'Set the partner',
trigger: 'input[id="o_field_input_303"]',
run: 'text Test Partner Company',
}, {
content: 'Click the partner in the dropdown',
trigger: 'li a.dropdown-item:contains(Test Partner Company)',
}
// 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
@ -12,3 +44,4 @@
// Open the location and add a new Equipment to its equipment list
// Create a task in the test project
])

View file

@ -10,7 +10,7 @@ tour.register('task_template_tour', {
trigger: '.o_app[data-menu-xmlid="project.menu_main_pm"]',
}, {
content: 'Open the task templates list view.',
trigger: '.o_nav_entry[data-menu-xmlid="bemade_fsm.task_template_menu"]',
trigger: '.o_nav_entry[data-menu-xmlid="bemade_fsm.project_task_template_menu"]',
}, {
content: 'Open the existing task template.',
trigger: '.o_data_cell:contains("Template 1"):parent()',

View file

@ -1,8 +1,4 @@
from odoo.tests.common import TransactionCase, HttpCase, tagged
from odoo.tools import mute_logger
from odoo.exceptions import MissingError
from odoo import Command
from psycopg2.errors import ForeignKeyViolation
from odoo.tests.common import TransactionCase
class FSMManagerUserTransactionCase(TransactionCase):

View file

@ -1,8 +1,4 @@
from odoo.tests.common import HttpCase, tagged
from odoo.tools import mute_logger
from odoo.exceptions import MissingError
from odoo import Command
from psycopg2.errors import ForeignKeyViolation
from .test_bemade_fsm_common import FSMManagerUserTransactionCase
class TestEquipmentCommon(FSMManagerUserTransactionCase):
@ -17,8 +13,8 @@ class TestEquipmentCommon(FSMManagerUserTransactionCase):
'company_type': 'company',
'street': '123 Street St.',
'city': 'Montreal',
'state_id': cls.env['res.country.state'].search([('name','ilike','Quebec%')]),
'country_id': cls.env['res.country'].search([('name','=','Canada')])
'state_id': cls.env['res.country.state'].search([('name','ilike','Quebec%')]).id,
'country_id': cls.env['res.country'].search([('name','=','Canada')]).id
})
cls.partner_contact = cls.env['res.partner'].create({
@ -29,4 +25,12 @@ class TestEquipmentCommon(FSMManagerUserTransactionCase):
cls.equipment = cls.env['bemade_fsm.equipment'].create({
'name': 'Test Equipment 1',
})
})
@tagged('-at_install', 'post_install')
class TestEquipmentTour(HttpCase, TestEquipmentCommon):
def test_equipment_tour(self):
self.start_tour('/web', 'task_equipment_tour',
login=self.user.login, )