From 7e334d54eacc819e0eb248040a3464bb57202a5c Mon Sep 17 00:00:00 2001 From: Marc Durepos Date: Thu, 15 Jun 2023 16:18:36 -0400 Subject: [PATCH] bemade_fsm: Added and modified some tests for #11. --- __manifest__.py | 1 + static/tests/tours/task_equipment_tour.js | 37 +++++++++++++++++++++-- static/tests/tours/task_template_tour.js | 2 +- tests/test_bemade_fsm_common.py | 6 +--- tests/test_equipment.py | 18 ++++++----- 5 files changed, 49 insertions(+), 15 deletions(-) diff --git a/__manifest__.py b/__manifest__.py index 3c9b327..3632f50 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -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, diff --git a/static/tests/tours/task_equipment_tour.js b/static/tests/tours/task_equipment_tour.js index 8abdd1d..e36b2cd 100644 --- a/static/tests/tours/task_equipment_tour.js +++ b/static/tests/tours/task_equipment_tour.js @@ -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 +]) \ No newline at end of file diff --git a/static/tests/tours/task_template_tour.js b/static/tests/tours/task_template_tour.js index 549803d..3573a45 100644 --- a/static/tests/tours/task_template_tour.js +++ b/static/tests/tours/task_template_tour.js @@ -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()', diff --git a/tests/test_bemade_fsm_common.py b/tests/test_bemade_fsm_common.py index 1d74b7a..ecd334a 100644 --- a/tests/test_bemade_fsm_common.py +++ b/tests/test_bemade_fsm_common.py @@ -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): diff --git a/tests/test_equipment.py b/tests/test_equipment.py index 0920878..6ed9116 100644 --- a/tests/test_equipment.py +++ b/tests/test_equipment.py @@ -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', - }) \ No newline at end of file + }) + + +@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, )