Test Agendaretiro
Test Agendaretiro
Test Agendaretiro
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
class TestAgendaretiro():
def setup_method(self, method):
self.driver = webdriver.Chrome("C:/Users/rolan/Downloads/chromedriver")
self.vars = {}
def test_agendaretiro(self):
self.driver.get("http://127.0.0.1:8000/")
self.driver.set_window_size(1357, 715)
self.driver.find_element(By.CSS_SELECTOR, ".mb-1").click()
self.driver.find_element(By.ID, "username").click()
self.driver.find_element(By.ID, "username").send_keys("Planificador")
self.driver.find_element(By.ID, "password").send_keys("Plan2021.")
self.driver.find_element(By.CSS_SELECTOR, ".btn").click()
self.driver.find_element(By.CSS_SELECTOR, ".list-group-item:nth-child(4) .mb-
1").click()
self.driver.find_element(By.LINK_TEXT, "Agendar Retiros").click()
self.driver.find_element(By.ID, "fecha").click()
self.driver.find_element(By.ID, "fecha").send_keys("2021-11-01")
self.driver.find_element(By.ID, "horaIni").click()
self.driver.find_element(By.ID, "horaIni").send_keys("17:20")
self.driver.find_element(By.ID, "horaFin").click()
self.driver.find_element(By.ID, "horaFin").send_keys("18:20")
self.driver.find_element(By.CSS_SELECTOR, "form > .mt-3").click()
self.driver.find_element(By.ID, "agendar").click()
self.driver.find_element(By.CSS_SELECTOR, ".btn:nth-child(5)").click()
time.sleep(10)
self.driver.find_element(By.ID, "ov").click()
self.driver.find_element(By.ID, "ov").send_keys("OV244251")
self.driver.find_element(By.ID, "linea").click()
self.driver.find_element(By.ID, "linea").send_keys("1")
self.driver.find_element(By.CSS_SELECTOR, ".modal-body > form").click()
self.driver.find_element(By.ID, "adicionar").click()
time.sleep(10)
self.driver.find_element(By.CSS_SELECTOR, "tbody th:nth-child(1)").click()
text = self.driver.find_element_by_css_selector(
"tbody th:nth-child(1)").text
try:
assert text == "OV244251"
time.sleep(2)
self.driver.close()
print('Prueba exitosa')
except AssertionError:
time.sleep(2)
self.driver.close()
print('Prueba erronea')
test = TestAgendaretiro()
test.setup_method(1)
test.test_agendaretiro()