Merge branch 'develop' of https://github.com/pandorafms/pandorafms into develop

This commit is contained in:
Daniel Maya 2016-06-15 11:11:37 +02:00
commit c93e39e1ff
4 changed files with 40 additions and 5 deletions

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from include.common_classes_60 import PandoraWebDriverTestCase
from include.common_functions_60 import login, click_menu_element
from include.common_functions_60 import login, click_menu_element, detect_and_pass_all_wizards
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
@ -17,6 +17,7 @@ class PAN1(PandoraWebDriverTestCase):
def test_pan1(self):
driver = self.driver
login(driver,"admin","pandora",self.base_url)
detect_and_pass_all_wizards(driver)
click_menu_element(driver,"General Setup")
self.assertEqual("IP list with API access", driver.find_element_by_id("table2-15-0").text)

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from include.common_classes_60 import PandoraWebDriverTestCase
from include.common_functions_60 import login, click_menu_element
from include.common_functions_60 import login, click_menu_element, detect_and_pass_all_wizards
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
@ -12,11 +12,12 @@ import unittest, time, re
class PAN2(PandoraWebDriverTestCase):
test_name = u'PAN_2'
test_description = u'Creation two agents and delete this agents using bulk operation'
tickets_associated = []
tickets_associated = [3831]
def test_pan2(self):
driver = self.driver
login(driver,"admin","pandora",self.base_url)
detect_and_pass_all_wizards(driver)
click_menu_element(driver,"Agent detail")
driver.find_element_by_id("submit-crt").click()
driver.find_element_by_id("text-agente").click()

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from include.common_classes_60 import PandoraWebDriverTestCase
from include.common_functions_60 import login, click_menu_element, refresh_N_times_until_find_element
from include.common_functions_60 import login, click_menu_element, refresh_N_times_until_find_element, detect_and_pass_all_wizards
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
@ -18,6 +18,7 @@ class PAN3(PandoraWebDriverTestCase):
def test_pan3(self):
driver = self.driver
login(driver,"admin","pandora",self.base_url)
detect_and_pass_all_wizards(driver)
click_menu_element(driver,"Agent detail")
driver.find_element_by_id("submit-crt").click()
driver.find_element_by_id("text-agente").click()

View File

@ -29,7 +29,7 @@ def get_menu_element(driver,menu_item_text):
def click_menu_element(driver,menu_item_text):
return driver.execute_script("arguments[0].click();", get_menu_element(driver,menu_item_text))
def refresh_N_times_until_find_element(driver,n,element_text,how=By.ID,refresh_time=5):
def refresh_N_times_until_find_element(driver,n,element_text,how=By.ID,refresh_time=10):
from selenium.common.exceptions import TimeoutException
i = 1
@ -58,3 +58,35 @@ def create_user(driver,userid,userpwd,email=None):
driver.find_element_by_name("email").send_keys(email)
driver.find_element_by_id("submit-crtbutton").click()
def is_element_present(driver, how, what):
from selenium.common.exceptions import NoSuchElementException
try: driver.find_element(by=how, value=what)
except NoSuchElementException: return False
return True
def detect_and_pass_pandorin(driver):
if is_element_present(driver,By.NAME,'clippy_is_annoying'):
driver.find_element_by_id('checkbox-clippy_is_annoying').click()
driver.find_element_by_class_name('introjs-skipbutton').click()
alert = driver.switch_to_alert()
alert.accept()
def detect_and_pass_initial_wizard(driver):
#We need to distinguish between the REQUIRED wizard
if is_element_present(driver,By.ID,'login_id_dialog'):
driver.find_element_by_id('text-email').clear()
driver.find_element_by_id('text-email').send_keys("test@pandora.com")
driver.find_element_by_id('submit-id_dialog_button').click()
def detect_and_pass_newsletter_wizard(driver):
if is_element_present(driver,By.ID,'login_accept_register'):
driver.find_element_by_id('submit-finish_dialog_button').click()
driver.find_element_by_id('submit-yes_registration').click()
def detect_and_pass_all_wizards(driver):
detect_and_pass_pandorin(driver)
detect_and_pass_initial_wizard(driver)
detect_and_pass_newsletter_wizard(driver)