From 46546d675276971430ba7fa11b875eb8c080af8d Mon Sep 17 00:00:00 2001 From: Kejebo Date: Fri, 26 Apr 2024 17:01:18 -0600 Subject: [PATCH] update documentation and selenium tests --- docs/source/general_usage/laboratory_view.rst | 41 +++++++++ .../edit_shelfobject_equipment_view.json | 70 +++++++++++++-- .../shelfobject_equipment_guarantee.py | 22 ++++- .../shelfobject_equipment_training.py | 90 +++++++++++++++++++ src/organilab_test/tests/base.py | 1 + 5 files changed, 213 insertions(+), 11 deletions(-) create mode 100644 src/laboratory/tests/selenium_tests/laboratory_view/shelfobject_equipment_view/shelfobject_equipment_training.py diff --git a/docs/source/general_usage/laboratory_view.rst b/docs/source/general_usage/laboratory_view.rst index a2f3ee26..ead8fc9b 100644 --- a/docs/source/general_usage/laboratory_view.rst +++ b/docs/source/general_usage/laboratory_view.rst @@ -486,9 +486,17 @@ Este acción registrara los mantenimientos realizados al equipo con los siguient Crear mantenimiento ^^^^^^^^^^^^^^^^^^^^^^ +.. image:: ../_static/gif/add_shelfobject_equipment_maintenance.gif + :height: 380 + :width: 720 + Editar mantenimiento ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. image:: ../_static/gif/edit_shelfobject_equipment_maintenance.gif + :height: 380 + :width: 720 + Buscar mantenimientos ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Las bitácoras de mantenimiento se puede filtrar por la persona que los registro que el **Validador**, la fecha que @@ -498,6 +506,9 @@ permite efectuar la busqueda mediante rangos de fechas, proveedor y ultimo mante Eliminar mantenimiento ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. image:: ../_static/gif/delete_shelfobject_equipment_maintenance.gif + :height: 380 + :width: 720 Capacitaciones @@ -506,15 +517,27 @@ Capacitaciones Crear capacitación ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. image:: ../_static/gif/add_shelfobject_equipment_training.gif + :height: 380 + :width: 720 + Editar capacitación ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. image:: ../_static/gif/edit_shelfobject_equipment_training.gif + :height: 380 + :width: 720 + Buscar capacitación ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Eliminar capacitación ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. image:: ../_static/gif/delete_shelfobject_equipment_training.gif + :height: 380 + :width: 720 + Garantías ------------ Esta accion hace referencia a las garantía que posee el equipo: @@ -522,14 +545,32 @@ Esta accion hace referencia a las garantía que posee el equipo: Crear garantía ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. image:: ../_static/gif/add_shelfobject_equipment_guarantee.gif + :height: 380 + :width: 720 + Editar garantía ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. image:: ../_static/gif/edit_shelfobject_equipment_guarantee.gif + :height: 380 + :width: 720 + Buscar garantías ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. image:: ../_static/gif/search_shelfobject_equipment_guarantee.gif + :height: 380 + :width: 720 + +.. image:: ../_static/gif/search_user_shelfobject_equipment_guarantee.gif + :height: 380 + :width: 720 Eliminar garantía ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. image:: ../_static/gif/delete_shelfobject_equipment_guarantee.gif + :height: 380 + :width: 720 diff --git a/fixtures/selenium/edit_shelfobject_equipment_view.json b/fixtures/selenium/edit_shelfobject_equipment_view.json index 4b6a0526..54e7aebf 100644 --- a/fixtures/selenium/edit_shelfobject_equipment_view.json +++ b/fixtures/selenium/edit_shelfobject_equipment_view.json @@ -103,6 +103,24 @@ ] ] } + }, + { + "model": "auth.user", + "pk": 4, + "fields": { + "password": "adminpass", + "last_login": "2023-01-10T22:49:30.603Z", + "is_superuser": true, + "username": "Sora", + "first_name": "Sora", + "last_name": "Sanabria", + "email": "orgadmin@gmail.com", + "is_staff": false, + "is_active": true, + "date_joined": "2018-07-09T19:45:29Z", + "groups": [], + "user_permissions": [] + } }, { "model": "laboratory.organizationstructure", @@ -113,7 +131,7 @@ "position": 0, "level": 0, "rol": [1, 2, 3, 4], - "users": [1] + "users": [1,4] } }, { @@ -299,18 +317,52 @@ } }, { - "model": "laboratory.shelfobjectguarantee", - "pk": 2, + "model": "laboratory.shelfobjectguarantee", + "pk": 2, + "fields": { + "organization": 1, + "creation_date": "2024-04-25T22:48:16.075Z", + "last_update": "2024-04-25T22:48:16.075Z", + "created_by": 1, + "shelfobject": 1, + "guarantee_initial_date": "2024-04-25", + "guarantee_final_date": "2024-04-28", + "contract": null + } + }, + { + "model": "laboratory.shelfobjectguarantee", + "pk": 3, + "fields": { + "organization": 1, + "creation_date": "2024-04-25T22:48:16.075Z", + "last_update": "2024-04-25T22:48:16.075Z", + "created_by": 4, + "shelfobject": 1, + "guarantee_initial_date": "2024-04-20", + "guarantee_final_date": "2024-04-28", + "contract": null + } + }, + { + "model": "laboratory.shelfobjecttraining", + "pk": 1, "fields": { "organization": 1, - "creation_date": "2024-04-25T22:48:16.075Z", - "last_update": "2024-04-25T22:48:16.075Z", + "creation_date": "2024-04-26T17:18:20.868Z", + "last_update": "2024-04-26T17:18:20.868Z", "created_by": 1, "shelfobject": 1, - "guarantee_initial_date": "2024-04-25", - "guarantee_final_date": "2024-04-28", - "contract": null - + "training_initial_date": "2024-04-25", + "training_final_date": "2024-04-25", + "number_of_hours": 1, + "external_people_receive_training": "ninguna", + "observation": "Induccion a la empresa", + "place": "San jose", + "intern_people_receive_training": [ + 1 + ] } } + ] diff --git a/src/laboratory/tests/selenium_tests/laboratory_view/shelfobject_equipment_view/shelfobject_equipment_guarantee.py b/src/laboratory/tests/selenium_tests/laboratory_view/shelfobject_equipment_view/shelfobject_equipment_guarantee.py index 8c67a389..fdac2061 100644 --- a/src/laboratory/tests/selenium_tests/laboratory_view/shelfobject_equipment_view/shelfobject_equipment_guarantee.py +++ b/src/laboratory/tests/selenium_tests/laboratory_view/shelfobject_equipment_view/shelfobject_equipment_guarantee.py @@ -10,11 +10,9 @@ class ShelfObjectEquipmentGuarantee(ShelfObjectEquipmentSeleniumTest): def setUp(self): super().setUp() - self.init_path= [] def test_view_shelfobject_guarantee(self): - initial_date, initial_date_strftime = self.get_format_increase_decrease_date(now(), 1) path_list = [ {"path" :"/html/body/div[1]/div/div[3]/div/div/div[7]/div[1]/h1", @@ -71,3 +69,23 @@ def test_delete_shelfobject_guarantee(self): general_path_list = [self.path_base, path_list] self.create_gif_by_change_focus_tab(general_path_list, ["equipmenteditview"], "delete_shelfobject_equipment_guarantee") + + def test_search_user_shelfobject_guarantee(self): + + path_list = [ + {"path": "/html/body/div[1]/div/div[3]/div/div/div[7]/div[2]/div/div[2]/div/table/thead/tr[2]/th[4]/span/span[1]/span", "scroll":"window.scrollTo(0, document.body.scrollHeight)"}, + {"path": "/html/body/span/span/span[2]/ul/li[1]"}, + ] + general_path_list = [self.path_base, path_list] + self.create_gif_by_change_focus_tab(general_path_list, ["equipmenteditview"], + "search_user_shelfobject_equipment_guarantee") + + def test_search_shelfobject_guarantee(self): + + path_list = [ + {"path": "/html/body/div[1]/div/div[3]/div/div/div[7]/div[2]/div/div[1]/div[1]/div/label/input", "scroll":"window.scrollTo(0, document.body.scrollHeight)"}, + {"path": "/html/body/div[1]/div/div[3]/div/div/div[7]/div[2]/div/div[1]/div[1]/div/label/input", "extra_action":"setvalu", "value": "Sora"}, + ] + general_path_list = [self.path_base, path_list] + self.create_gif_by_change_focus_tab(general_path_list, ["equipmenteditview"], + "search_shelfobject_equipment_guarantee") diff --git a/src/laboratory/tests/selenium_tests/laboratory_view/shelfobject_equipment_view/shelfobject_equipment_training.py b/src/laboratory/tests/selenium_tests/laboratory_view/shelfobject_equipment_view/shelfobject_equipment_training.py new file mode 100644 index 00000000..95b84e5d --- /dev/null +++ b/src/laboratory/tests/selenium_tests/laboratory_view/shelfobject_equipment_view/shelfobject_equipment_training.py @@ -0,0 +1,90 @@ +from django.test import tag +from django.utils.timezone import now + +from laboratory.tests.selenium_tests.laboratory_view.shelfobject_equipment_view.base import \ + ShelfObjectEquipmentSeleniumTest + + +@tag('selenium') +class ShelfObjectEquipmentTraining(ShelfObjectEquipmentSeleniumTest): + + def setUp(self): + super().setUp() + self.init_path= [] + + + def test_view_shelfobject_training(self): + + path_list = [ + {"path" :"/html/body/div[1]/div/div[3]/div/div/div[6]/div[1]/h1", + "scroll":"window.scrollTo(0, 2000)"}, + ] + general_path_list = [self.path_base, path_list] + self.create_gif_by_change_focus_tab(general_path_list, ["equipmenteditview"], + "view_shelfobject_equipment_training") + + def test_add_shelfobject_training(self): + initial_date, initial_date_strftime = self.get_format_increase_decrease_date(now(), 0) + final_date, final_date_strftime = self.get_format_increase_decrease_date(now(), 1) + + path_list = [ + {"path": "/html/body/div[1]/div/div[3]/div/div/div[6]/div[1]/h1", + "scroll": "window.scrollTo(0, 2000)"}, + {"path": "/html/body/div[1]/div/div[3]/div/div/div[6]/div[2]/div/div[1]/div[2]/div/button[3]"}, + {"path": "/html/body/div[1]/div/div[3]/div/div/div[20]/div/div/div[2]/form/div[1]/div/div/input"}, + {"path": "//*[@data-day='%s']" % initial_date_strftime}, + {"path": "/html/body/div[1]/div/div[3]/div/div/div[20]/div/div/div[2]/form/div[2]/div/div/input"}, + {"path": "//*[@data-day='%s']" % final_date_strftime}, + {"path": "/html/body/div[1]/div/div[3]/div/div/div[20]/div/div/div[2]/form/div[3]/div/input", "extra_action":"setvalue", + "value": 1}, + {"path": "/html/body/div[1]/div/div[3]/div/div/div[20]/div/div/div[2]/form/div[4]/div/span"}, + {"path": "/html/body/div[1]/div/div[3]/div/div/div[20]/div/div/div[2]/form/span/span/span/ul/li[1]"}, + { + "path": "/html/body/div[1]/div/div[3]/div/div/div[20]/div/div/div[2]/form/div[5]/div/textarea", + "extra_action": "setvalue", + "value": "Luz Castro Lopez"}, + { + "path": "/html/body/div[1]/div/div[3]/div/div/div[20]/div/div/div[2]/form/div[6]/div/textarea", + "extra_action": "setvalue", + "value": "Llegar temprano"}, + { + "path": "/html/body/div[1]/div/div[3]/div/div/div[20]/div/div/div[2]/form/div[7]/div/input", + "extra_action": "setvalue", + "value": "Oficinas Centrales"}, + + {"path": "/html/body/div[1]/div/div[3]/div/div/div[20]/div/div/div[3]/button[2]"}, + + ] + general_path_list = [self.path_base, path_list] + self.create_gif_by_change_focus_tab(general_path_list, ["equipmenteditview"], + "add_shelfobject_equipment_training") + + def test_edit_shelfobject_training(self): + initial_date, initial_date_strftime = self.get_format_increase_decrease_date(now(), 1) + + path_list = [ + {"path": "/html/body/div[1]/div/div[3]/div/div/div[6]/div[1]/h1", + "scroll": "window.scrollTo(0, 2000)"}, + {"path": "/html/body/div[1]/div/div[3]/div/div/div[6]/div[2]/div/div[2]/div/table/tbody/tr/td[7]/div/i[1]"}, + {"path": "/html/body/div[1]/div/div[3]/div/div/div[21]/div/div/div[2]/form/div[2]/div/div/input"}, + {"path": "//*[@data-day='%s']" % initial_date_strftime}, + {"path": "/html/body/div[1]/div/div[3]/div/div/div[21]/div/div/div[2]/form/div[4]/div/span/span[1]/span/ul/li[1]/button"}, + {"path": "/html/body/div[1]/div/div[3]/div/div/div[21]/div/div/div[3]/button[2]", "scroll": "$('#update_training_modal').scrollTop(500);"}, + + ] + general_path_list = [self.path_base, path_list] + self.create_gif_by_change_focus_tab(general_path_list, ["equipmenteditview"], + "edit_shelfobject_equipment_training") + + def test_delete_shelfobject_training(self): + + path_list = [ + {"path": "/html/body/div[1]/div/div[3]/div/div/div[6]/div[1]/h1", + "scroll": "window.scrollTo(0, 2000)"}, + {"path": "/html/body/div[1]/div/div[3]/div/div/div[6]/div[2]/div/div[2]/div/table/tbody/tr/td[7]/div/i[2]"}, + {"path": "/html/body/div[1]/div/div[3]/div/div/div[22]/div/div/div[3]/button[2]"}, + + ] + general_path_list = [self.path_base, path_list] + self.create_gif_by_change_focus_tab(general_path_list, ["equipmenteditview"], + "delete_shelfobject_equipment_training") diff --git a/src/organilab_test/tests/base.py b/src/organilab_test/tests/base.py index bc2ca22c..0a59a561 100644 --- a/src/organilab_test/tests/base.py +++ b/src/organilab_test/tests/base.py @@ -331,6 +331,7 @@ def take_screenshot_list(self, path_list, folder_name, cursor=True, hover=True, self.create_screenshot(order=order) for obj in path_list: self.apply_utils(obj) + print(obj['path']) element = self.selenium.find_element(By.XPATH, obj['path']) order = self.create_screenshot(order=order) x, y = self.get_x_y_element(element)