Skip to content

Commit

Permalink
EGCETSII#43-fix: add selenium log spacings
Browse files Browse the repository at this point in the history
  • Loading branch information
JSnow11 committed Jan 9, 2022
1 parent ad962f1 commit d61ca41
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions decide/administration/seleniumT.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,24 @@
import time
import random

'''Para poder ejecutar este test, se debe crear un superusuario
'''
README:
Para poder ejecutar este test, se debe crear un superusuario
con el siguiente comando:
./manage.py createsuperuser
con datos:
Username: admin
username: admin
password: qwerty
y hacer bypass de la restriccion de contraseña
Entrar en http://localhost:8000/administration/users
iniciar sesión con el usuario admin
y si hubiera más usuarios creados, hay que eliminarlos
antes de realizar los tests
'''


Expand Down Expand Up @@ -178,7 +182,7 @@ def delete_user(driver, cont):
return cont


#VOTING TESTS
# VOTING TESTS
def create_voting(driver, cont):
try:
print("Test Create Voting")
Expand All @@ -191,7 +195,7 @@ def create_voting(driver, cont):
driver.find_element(
By.XPATH, '/html/body/div[2]/div[3]/div/form/div[1]/div/div/div[1]/div/input').send_keys("Nueva votacion")
driver.find_element(
By.XPATH, '/html/body/div[2]/div[3]/div/form/div[1]/div/div/div[2]/div/input').send_keys("descripcion")
By.XPATH, '/html/body/div[2]/div[3]/div/form/div[1]/div/div/div[2]/div/input').send_keys("descripcion")
driver.find_element(
By.XPATH, '/html/body/div[2]/div[3]/div/form/div[5]/div/button[2]').click()
time.sleep(2)
Expand Down Expand Up @@ -222,6 +226,7 @@ def create_voting(driver, cont):
cont = cont + 1
return cont


def update_voting(driver, cont):
try:
print("Test Update Voting")
Expand Down Expand Up @@ -258,6 +263,7 @@ def update_voting(driver, cont):
cont = cont + 1
return cont


def delete_voting(driver, cont):
try:
print("Test Delete Voting")
Expand All @@ -277,6 +283,7 @@ def delete_voting(driver, cont):
cont = cont + 1
return cont


def start_voting(driver, cont):
try:
print("Test Start Voting")
Expand All @@ -296,6 +303,7 @@ def start_voting(driver, cont):
cont = cont + 1
return cont


def stop_voting(driver, cont):
try:
print("Test Stop Voting")
Expand All @@ -315,6 +323,7 @@ def stop_voting(driver, cont):
cont = cont + 1
return cont


def tally_voting(driver, cont):
try:
print("Test Tally Voting")
Expand Down Expand Up @@ -342,6 +351,7 @@ def tally_voting(driver, cont):
driver = webdriver.Chrome(options=options)

# USER TESTS
print("USER TESTS START \n")
cont = incorrect_log_in(driver, cont)
cont = log_in(driver, cont)
cont = create_user(driver, cont)
Expand All @@ -356,10 +366,10 @@ def tally_voting(driver, cont):
cont = delete_user(driver, cont)
cont = log_out(driver, cont)
print("Se han realizado los test de User")
print("Se han encontrado: " + str(cont) + " errores ")

print("Se han encontrado: " + str(cont) + " errores \n\n")

#VOTING TESTS
# VOTING TESTS
print("VOTING TESTS START \n")
cont2 = 0
cont2 = log_in(driver, cont2)
cont2 = create_voting(driver, cont2)
Expand All @@ -372,4 +382,4 @@ def tally_voting(driver, cont):
time.sleep(3)
cont2 = delete_voting(driver, cont2)
print("Se han realizado los test de Votings")
print("Se han encontrado: " + str(cont2) + " errores ")
print("Se han encontrado: " + str(cont2) + " errores \n\n")

0 comments on commit d61ca41

Please sign in to comment.