pandorafms/tests/install_console.py

38 lines
1.2 KiB
Python
Raw Normal View History

2016-05-19 16:27:41 +02:00
#!/usr/bin/env python
# Script to install the Pandora FMS Console.
import os
from pyvirtualdisplay import Display
from selenium import webdriver
# Are we running headless?
if ('DISPLAY' not in os.environ):
2016-09-21 09:12:10 +02:00
display = Display(visible=0, size=(1920, 1080))
2016-05-19 16:27:41 +02:00
display.start()
# Go to the installation page.
browser = webdriver.Firefox()
browser.implicitly_wait(5)
browser.get('http://localhost/pandora_console/install.php')
assert("Pandora FMS - Installation Wizard" in browser.title)
# Accept the license agreement.
2017-03-07 12:07:48 +01:00
browser.find_element_by_xpath("//*[@id='step11']").click()
browser.find_element_by_xpath("//*[@id='btn_accept']").click()
2016-05-19 16:27:41 +02:00
# Fill-in the configuration form.
2017-03-07 12:07:48 +01:00
browser.find_element_by_xpath("//*[@id='step3']").click()
2016-05-19 16:27:41 +02:00
browser.find_element_by_name("pass").send_keys("pandora")
2017-03-07 12:07:48 +01:00
browser.find_element_by_xpath("//*[@id='step4']").click()
2016-05-19 16:27:41 +02:00
# Complete the installation.
browser.implicitly_wait(300) # The installation is going to take a long time.
2017-03-07 12:07:48 +01:00
browser.find_element_by_xpath("//*[@id='step5']").click()
2016-05-19 16:27:41 +02:00
browser.implicitly_wait(5)
assert("Installation complete" in browser.page_source)
browser.find_element_by_name("rn_file").click()
2016-05-19 16:27:41 +02:00
# Clean-up
browser.quit()
if ('DISPLAY' not in os.environ):
display.stop()