From d8bedfbaf7e4629be06370f91b8d0c2143150d85 Mon Sep 17 00:00:00 2001 From: axl89 Date: Tue, 14 Jun 2016 18:35:01 +0200 Subject: [PATCH] Added behaviour to pass the wizards --- tests/console/PAN1.py | 1 + tests/console/PAN2.py | 1 + tests/console/PAN3.py | 3 ++- tests/console/include/common_functions_60.py | 26 ++++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/console/PAN1.py b/tests/console/PAN1.py index e8a7424926..a8873f7c05 100644 --- a/tests/console/PAN1.py +++ b/tests/console/PAN1.py @@ -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) diff --git a/tests/console/PAN2.py b/tests/console/PAN2.py index f9abb45bb4..593d5f176d 100644 --- a/tests/console/PAN2.py +++ b/tests/console/PAN2.py @@ -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() diff --git a/tests/console/PAN3.py b/tests/console/PAN3.py index add7882b9a..a8446be6d7 100644 --- a/tests/console/PAN3.py +++ b/tests/console/PAN3.py @@ -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() diff --git a/tests/console/include/common_functions_60.py b/tests/console/include/common_functions_60.py index 3376980580..f58a143e8e 100644 --- a/tests/console/include/common_functions_60.py +++ b/tests/console/include/common_functions_60.py @@ -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)