From 934f2087fa1907d30347013c2017a84ccf439cad Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 2 Feb 2022 10:19:24 +0100 Subject: [PATCH] dump html if python installation fails --- tests/install_console.py | 41 ++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/tests/install_console.py b/tests/install_console.py index 3b4dad910c..80bd0fabe1 100755 --- a/tests/install_console.py +++ b/tests/install_console.py @@ -3,33 +3,38 @@ import os from pyvirtualdisplay import Display from selenium import webdriver +from exceptions import AssertionError # Are we running headless? if ('DISPLAY' not in os.environ): display = Display(visible=0, size=(1920, 1080)) display.start() -# Go to the installation page. -browser = webdriver.Firefox(timeout=15) -browser.implicitly_wait(5) -browser.get('http://localhost/pandora_console/install.php') -assert("Pandora FMS - Installation Wizard" in browser.title) +try: + # Go to the installation page. + browser = webdriver.Firefox(timeout=15) + browser.implicitly_wait(5) + browser.get('http://localhost/pandora_console/install.php') + assert("Pandora FMS - Installation Wizard" in browser.title) -# Accept the license agreement. -browser.find_element_by_xpath("//*[@id='step11']").click() -browser.find_element_by_xpath("//*[@id='btn_accept']").click() + # Accept the license agreement. + browser.find_element_by_xpath("//*[@id='step11']").click() + browser.find_element_by_xpath("//*[@id='btn_accept']").click() -# Fill-in the configuration form. -browser.find_element_by_xpath("//*[@id='step3']").click() -browser.find_element_by_name("pass").send_keys("pandora") -browser.find_element_by_xpath("//*[@id='step4']").click() + # Fill-in the configuration form. + browser.find_element_by_xpath("//*[@id='step3']").click() + browser.find_element_by_name("pass").send_keys("pandora") + browser.find_element_by_xpath("//*[@id='step4']").click() + + # Complete the installation. + browser.implicitly_wait(300) # The installation is going to take a long time. + browser.find_element_by_xpath("//*[@id='step5']").click() + browser.implicitly_wait(5) + assert("Installation complete" in browser.page_source) + browser.find_element_by_name("rn_file").click() +except AssertionError: + print(browser.page_source) -# Complete the installation. -browser.implicitly_wait(300) # The installation is going to take a long time. -browser.find_element_by_xpath("//*[@id='step5']").click() -browser.implicitly_wait(5) -assert("Installation complete" in browser.page_source) -browser.find_element_by_name("rn_file").click() # Clean-up browser.quit()