~ubuntu-branches/ubuntu/raring/horizon/raring

« back to all changes in this revision

Viewing changes to openstack_dashboard/tests.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-05-24 14:33:20 UTC
  • mfrom: (1.1.14)
  • Revision ID: package-import@ubuntu.com-20120524143320-i7eswfq6ecxlvh5a
Tags: 2012.2~f1-0ubuntu1
* New usptream release. 
* Prepare for quantal:
  - debian/patches/fix-coverage-binary-name.patch: Refreshed.
* Temporarily pass the testsuite.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import os
 
2
 
1
3
from django import test
2
 
from noseselenium.cases import SeleniumTestCaseMixin
3
 
 
4
 
 
5
 
class SeleniumTests(test.TestCase, SeleniumTestCaseMixin):
 
4
from django.utils import unittest
 
5
 
 
6
from selenium.webdriver.firefox.webdriver import WebDriver
 
7
 
 
8
 
 
9
@unittest.skipUnless(os.environ.get('WITH_SELENIUM', False),
 
10
                     "The WITH_SELENIUM env variable is not set.")
 
11
class SeleniumTests(test.LiveServerTestCase):
 
12
    @classmethod
 
13
    def setUpClass(cls):
 
14
        if os.environ.get('WITH_SELENIUM', False):
 
15
            cls.selenium = WebDriver()
 
16
        super(SeleniumTests, cls).setUpClass()
 
17
 
 
18
    @classmethod
 
19
    def tearDownClass(cls):
 
20
        super(SeleniumTests, cls).tearDownClass()
 
21
        if os.environ.get('WITH_SELENIUM', False):
 
22
            cls.selenium.quit()
 
23
 
6
24
    def test_splash(self):
7
 
        self.selenium.open("/")
8
 
        self.failUnless(self.selenium.is_text_present("User Name"))
 
25
        self.selenium.get(self.live_server_url)
 
26
        button = self.selenium.find_element_by_tag_name("button")
 
27
        self.assertEqual(button.text, "Sign In")
9
28
 
10
29
    def test_qunit(self):
11
 
        self.selenium.open("/qunit/")
12
 
        self.selenium.wait_for_page_to_load("2000")
13
 
        self.failUnless(self.selenium.is_text_present("0 failed"))
 
30
        self.selenium.get("%s%s" % (self.live_server_url, "/qunit/")),
 
31
        self.selenium.implicitly_wait("1000")
 
32
        failed = self.selenium.find_element_by_class_name("failed")
 
33
        self.assertEqual(int(failed.text), 0)