More fixes to the testing scripts.

This commit is contained in:
Ramon Novoa 2016-09-21 09:12:10 +02:00
parent 3953e760b1
commit ac11cfdf2c
6 changed files with 27 additions and 16 deletions

View File

@ -4,6 +4,4 @@ services:
- docker
script:
- docker run --name pandorafms -h pandorafms -dt -v "$TRAVIS_BUILD_DIR:/tmp/pandorafms" -p 127.0.0.1:8080:80 pandorafms/pandorafms-base tail -f /var/log/messages
- docker exec -t pandorafms /tmp/pandorafms/tests/test.sh
- python $TRAVIS_BUILD_DIR/tests/run_console_tests.py
- docker run --rm -t -v "$TRAVIS_BUILD_DIR:/tmp/pandorafms" pandorafms/pandorafms-base /tmp/pandorafms/tests/test.sh

View File

@ -2,7 +2,6 @@
from unittest2 import TestResult, TestCase
from common_functions_60 import *
from datetime import datetime
from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
@ -49,15 +48,11 @@ class PandoraWebDriverTestCase(TestCase):
#Start VM in Sauce Labs
#cls.driver = webdriver.Remote(command_executor='http://'+cls.sauce_username+':'+cls.sauce_access_key+'@ondemand.saucelabs.com:80/wd/hub',desired_capabilities=cls.desired_cap)
#cls.sauce_labs_job_id = cls.driver.session_id
cls.display = Display(visible=0, size=(800, 600))
cls.display.start()
cls.driver = webdriver.Firefox()
cls.base_url = "http://127.0.0.1/"
@classmethod
def tearDownClass(cls):
if cls.is_development == False:
cls.display.stop()
cls.driver.quit()
def setUp(self):

View File

@ -48,6 +48,7 @@ def login(driver,user="admin",passwd="pandora",pandora_url=None):
print "Pandora url is "+pandora_url
driver.get(pandora_url+"/pandora_console/index.php")
driver.add_cookie({'name': 'clippy_is_annoying', 'value': 1})
driver.find_element_by_id("nick").clear()
driver.find_element_by_id("nick").send_keys(user)
driver.find_element_by_id("pass").clear()
@ -109,11 +110,12 @@ def detect_and_pass_newsletter_wizard(driver):
def detect_and_pass_all_wizards(driver):
driver.implicitly_wait(2) #Optimisation workaround for skipping wizards quickly
detect_and_pass_pandorin(driver)
detect_and_pass_initial_wizard(driver)
detect_and_pass_newsletter_wizard(driver)
driver.implicitly_wait(30)
#driver.implicitly_wait(2) #Optimisation workaround for skipping wizards quickly
#detect_and_pass_pandorin(driver)
#detect_and_pass_initial_wizard(driver)
#detect_and_pass_newsletter_wizard(driver)
#driver.implicitly_wait(30)
return
def activate_home_screen(driver,mode):

View File

@ -6,7 +6,7 @@ from selenium import webdriver
# Are we running headless?
if ('DISPLAY' not in os.environ):
display = Display(visible=0, size=(800, 600))
display = Display(visible=0, size=(1920, 1080))
display.start()
# Go to the installation page.

View File

@ -2,7 +2,7 @@
from unittest2 import *
from console.include.common_functions_60 import *
from console.include.common_classes_60 import *
#from sauceclient import SauceClient
from pyvirtualdisplay import Display
from os import environ, getenv
import subprocess, time, sys
@ -10,6 +10,11 @@ def get_test_file(test_list):
#return [test[0].split(' ')[0].split('.')[0].split('<')[1] for test in test_list]
return [test[0].test_name for test in test_list]
# Are we running headless?
if ('DISPLAY' not in os.environ):
display = Display(visible=0, size=(800, 600))
display.start()
#Run Enterprise tests
is_enterprise = '1' == getenv('ENTERPRISE', False)
@ -37,7 +42,8 @@ tests.run(c)
# next
#Update Saouce Labs jobs
if ('DISPLAY' not in os.environ):
display.stop()
print "Tests failed: %s" % c.failures
print "Tests succeeded: %s" % c.success

View File

@ -51,4 +51,14 @@ check "Starting the Pandora FMS Server" $?
service pandora_agent_daemon start
check "Starting the Pandora FMS Agent" $?
# Disable the initial wizards.
echo "UPDATE tconfig SET value='1' WHERE token='initial_wizard'" | mysql -u root -ppandora -Dpandora
echo "UPDATE tconfig SET value='1' WHERE token='instance_registered'" | mysql -u root -ppandora -Dpandora
echo "INSERT INTO tconfig (token, value) VALUES ('skip_login_help_dialog', '1')" | mysql -u root -ppandora -Dpandora
echo "UPDATE tusuario SET middlename='1'" | mysql -u root -ppandora -Dpandora
# Run console tests.
cd /tmp/pandorafms/tests && chmod +x run_console_tests.py && ./run_console_tests.py
check "Running tests for the Pandora FMS Console" $?
exit 0