OpenStack in a snap!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.5 KiB

#!/usr/bin/env python
This is a basic test of Horizon functionality. We verify that:
1) Horizon is running, and we can hit the landing page.
2) We can login successfully.
This is based on code generated by the Selinum Web IDE.
import os
import socket
import unittest
import xvfbwrapper
from selenium import webdriver
from import By
HORIZON_IP = os.environ.get("HORIZON_IP", "")
class TestHorizonlogin(unittest.TestCase):
def setUp(self):
self.display = xvfbwrapper.Xvfb(width=1280, height=720)
self.driver = webdriver.PhantomJS()
def tearDown(self):
def test_horizonlogin(self):
# Login to horizon!
self.driver.find_element(By.ID, "id_username").click()
self.driver.find_element(By.ID, "id_username").send_keys("admin")
self.driver.find_element(By.ID, "id_password").send_keys("keystone")
self.driver.find_element(By.CSS_SELECTOR, "#loginBtn > span").click()
# Verify that we can click something on the dashboard -- e.g.,
# we're still not sitting at the login screen.
self.driver.find_element(By.LINK_TEXT, "Images").click()
if __name__ == '__main__':
# Run our tests, ignorning deprecation warnings and warnings about
# unclosed sockets. (TODO: setup a selenium server so that we can
# move from PhantomJS, which is deprecated, to to Selenium headless.)