Skip to content

Commit

Permalink
update documentation and selenium tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kejebo committed Apr 26, 2024
1 parent ae10e45 commit 46546d6
Show file tree
Hide file tree
Showing 5 changed files with 213 additions and 11 deletions.
41 changes: 41 additions & 0 deletions docs/source/general_usage/laboratory_view.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -506,30 +517,60 @@ 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:

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

70 changes: 61 additions & 9 deletions fixtures/selenium/edit_shelfobject_equipment_view.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]",
"is_staff": false,
"is_active": true,
"date_joined": "2018-07-09T19:45:29Z",
"groups": [],
"user_permissions": []
}
},
{
"model": "laboratory.organizationstructure",
Expand All @@ -113,7 +131,7 @@
"position": 0,
"level": 0,
"rol": [1, 2, 3, 4],
"users": [1]
"users": [1,4]
}
},
{
Expand Down Expand Up @@ -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
]
}
}

]
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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")
Original file line number Diff line number Diff line change
@@ -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")
1 change: 1 addition & 0 deletions src/organilab_test/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 46546d6

Please sign in to comment.