From edf917664f000b4708a1a355cfcf54c0ab79babd Mon Sep 17 00:00:00 2001 From: Marc Durepos Date: Thu, 15 Jun 2023 19:34:40 -0400 Subject: [PATCH] bemade_fsm: Completed integration test tour for adding equipment to a client. Closes #11. --- static/tests/tours/task_equipment_tour.js | 116 +++++++++++++--------- tests/test_equipment.py | 1 + views/menus.xml | 2 +- 3 files changed, 72 insertions(+), 47 deletions(-) diff --git a/static/tests/tours/task_equipment_tour.js b/static/tests/tours/task_equipment_tour.js index bf2fa16..4599fb5 100644 --- a/static/tests/tours/task_equipment_tour.js +++ b/static/tests/tours/task_equipment_tour.js @@ -1,51 +1,75 @@ /** @odoo-module **/ import tour from 'web_tour.tour'; - +const TEST_COMPANY = "Test Partner Company"; +const TEST_EQPT1 = "Test Equipment 1"; +const TEST_EQPT2 = "Test Equipment 2"; tour.register('task_equipment_tour', { - test: true, - url: '/web', -}, /* Create a new "Test Equipment" and link it to "Test Partner Company" */ + test: true, + url: '/web', + }, /* Create a new "Test Equipment" and link it to "Test Partner Company" */ [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: 'button.dropdown-toggle[data-menu-xmlid="bemade_fsm.menu_service_client"]', -}, { - content: 'Navigate to the Equipment menu', - trigger: '.dropdown-item[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: 'div[name="partner_location_id"] div div input', - run: 'text Test Partner Company', -}, { - content: 'Click the partner in the dropdown', - 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 -// Navigate to the client location, then to the client, making sure that the equipment and client location links appear - -// Now make another one, but from the Partner interface -// Navigate to Service > Clients > Clients -// Search for and open the test client -// On the "Locations" tab, add a location -// 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 + content: 'Navigate to the Service menu', + trigger: '.o_app[data-menu-xmlid="industry_fsm.fsm_menu_root"]', + }, { + content: 'Navigate to the Clients submenu', + trigger: 'button.dropdown-toggle[data-menu-xmlid="bemade_fsm.menu_service_client"]', + }, { + content: 'Navigate to the Equipment menu', + trigger: '.dropdown-item[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_EQPT2}`, + }, { + content: 'Set the partner', + trigger: 'div[name="partner_location_id"] div div input', + run: 'text Test Partner Company', + }, { + content: 'Click the partner in the dropdown', + trigger: `li a.dropdown-item:contains(${TEST_COMPANY})`, + }, { + content: 'Save equipment', + trigger: 'button.o_form_button_save', + }, { + /* Navigate to the client and make sure that there are two equipments saved (one from the Python test case) */ + content: 'Navigate to the Clients submenu', + trigger: 'button.dropdown-toggle[data-menu-xmlid="bemade_fsm.menu_service_client"]', + }, { + content: 'Click on the clients submenu', + trigger: '.dropdown-item[data-menu-xmlid="bemade_fsm.menu_service_client_clients"]', + }, { + content: 'Search for the Test Partner Company', + trigger: 'input.o_searchview_input', + extra_trigger: 'li.breadcrumb-item.active:has(span:contains(Customers))', + run: `text ${TEST_COMPANY}` + }, { + content: 'Validate Search', + trigger: '.o_menu_item.o_selection_focus', + run: 'click', + }, { + content: 'Open the test client.', + trigger: `div.o_kanban_record:has(span:contains(${TEST_COMPANY}))`, + }, { + content: 'Click the Field Service tab.', + trigger: 'a.nav-link:contains(Field Service)', + extra_trigger: `h1 span.o_field_partner_autocomplete[name="name"]:contains(${TEST_COMPANY})`, + }, { + content: 'Make sure we have a first test equipment', + /*trigger: `div[name="equipment_ids"]:has(td:contains(${TEST_EQPT1}))`,*/ + trigger: `td:contains(${TEST_EQPT1})`, + run: function() {}, + }, { + content: 'Make sure we have a second test equipment', + trigger: `div[name="equipment_ids"]:has(td:contains(${TEST_EQPT2}))`, + run: function() {}, + } + ]) \ No newline at end of file diff --git a/tests/test_equipment.py b/tests/test_equipment.py index 6ed9116..2ca0485 100644 --- a/tests/test_equipment.py +++ b/tests/test_equipment.py @@ -25,6 +25,7 @@ class TestEquipmentCommon(FSMManagerUserTransactionCase): cls.equipment = cls.env['bemade_fsm.equipment'].create({ 'name': 'Test Equipment 1', + 'partner_location_id': cls.partner_company.id, }) diff --git a/views/menus.xml b/views/menus.xml index 76c5464..d5dce9e 100644 --- a/views/menus.xml +++ b/views/menus.xml @@ -18,7 +18,7 @@ groups="industry_fsm.group_fsm_user"/>