Added behaviour to pass the wizards

This commit is contained in:
axl89 2016-06-14 18:35:01 +02:00
parent 5e6080c354
commit d8bedfbaf7
4 changed files with 30 additions and 1 deletions

View File

@ -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

@ -17,6 +17,7 @@ class PAN2(PandoraWebDriverTestCase):
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

@ -64,3 +64,29 @@ def is_element_present(driver, how, what):
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)