Uptaded testing

This commit is contained in:
fbsanchez 2022-02-16 10:33:02 +01:00
parent 934be2eaf4
commit 734f623c80
1 changed files with 28 additions and 18 deletions

View File

@ -1,16 +1,20 @@
#!/usr/bin/env python #!/usr/bin/env python3
# Script to install the Pandora FMS Console. # Script to install the Pandora FMS Console.
import os import os
import sys
from pyvirtualdisplay import Display from pyvirtualdisplay import Display
from selenium import webdriver from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
# Are we running headless? # Are we running headless?
if ('DISPLAY' not in os.environ): if ('DISPLAY' not in os.environ):
display = Display(visible=0, size=(1920, 1080)) display = Display(visible=0, size=(1920, 1080))
display.start() display.start()
# Go to the installation page.
browser = webdriver.Firefox(timeout=15) browser = webdriver.Firefox(timeout=15)
try:
# Go to the installation page.
browser.implicitly_wait(5) browser.implicitly_wait(5)
browser.get('http://localhost/pandora_console/install.php') browser.get('http://localhost/pandora_console/install.php')
assert("Pandora FMS - Installation Wizard" in browser.title) assert("Pandora FMS - Installation Wizard" in browser.title)
@ -25,11 +29,17 @@ browser.find_element_by_name("pass").send_keys("pandora")
browser.find_element_by_xpath("//*[@id='step4']").click() browser.find_element_by_xpath("//*[@id='step4']").click()
# Complete the installation. # Complete the installation.
browser.implicitly_wait(300) # The installation is going to take a long time. browser.implicitly_wait(900) # The installation is going to take a long time.
browser.find_element_by_xpath("//*[@id='step5']").click() browser.find_element_by_xpath("//*[@id='step5']").click()
browser.implicitly_wait(5) browser.implicitly_wait(5)
assert("Installation complete" in browser.page_source) assert("Installation complete" in browser.page_source)
browser.find_element_by_name("rn_file").click() browser.find_element_by_name("rn_file").click()
except AssertionError as error:
print("Error " + str(error) + ":\n" + browser.page_source)
sys.exit(1)
except NoSuchElementException as error:
print("Error " + str(error) + ":\n" + browser.page_source)
sys.exit(1)
# Clean-up # Clean-up
browser.quit() browser.quit()