diff --git a/horizon/static/horizon/tests/tables.js b/horizon/static/horizon/tests/tables.js
index 2f1f09902d..271b7c6960 100644
--- a/horizon/static/horizon/tests/tables.js
+++ b/horizon/static/horizon/tests/tables.js
@@ -27,25 +27,33 @@ test("Footer count update", function () {
var table_count = table.find("span.table_count");
var rows = tbody.find('tr');
+ // The following function returns the first set of consecutive numbers.
+ // This is allows you to match an inner numeric value regardless of
+ // the language and regardless of placement within the phrase.
+ // If you want to match '4' for your numeric value, the following are ok:
+ // "there are 4 lights", "4 lights there are", "lights there are 4" but
+ // not "there are 14 lights".
+ var get_consec_nums = function(str) { return (str.match(/\d+/) || [""])[0]; };
+
horizon.datatables.update_footer_count(table);
- notEqual(table_count.text().indexOf('4 items'), -1, "Initial count is correct");
+ equal(get_consec_nums(table_count.text()), '4', "Initial count is correct");
// hide rows
rows.first().hide();
rows.first().next().hide();
horizon.datatables.update_footer_count(table);
- notEqual(table_count.text().indexOf('2 items'), -1, "Count correct after hiding two rows");
+ equal(get_consec_nums(table_count.text()), '2', "Count correct after hiding two rows");
// show a row
rows.first().next().show();
horizon.datatables.update_footer_count(table);
- notEqual(table_count.text().indexOf('3 items'), -1, "Count correct after showing one row");
+ equal(get_consec_nums(table_count.text()), '3', "Count correct after showing one row");
// add rows
$('
cat3
"').appendTo(tbody);
$('
cat4
"').appendTo(tbody);
horizon.datatables.update_footer_count(table);
- notEqual(table_count.text().indexOf('5 items'), -1, "Count correct after adding two rows");
+ equal(get_consec_nums(table_count.text()), '5', "Count correct after adding two rows");
});
test("Formset reenumerate rows", function () {
diff --git a/horizon/templates/auth/_login.html b/horizon/templates/auth/_login.html
index 3f611478f8..1b43114591 100644
--- a/horizon/templates/auth/_login.html
+++ b/horizon/templates/auth/_login.html
@@ -29,5 +29,5 @@
{% endblock %}
{% block modal-footer %}
-
+
{% endblock %}
diff --git a/openstack_dashboard/dashboards/identity/users/tests.py b/openstack_dashboard/dashboards/identity/users/tests.py
index 641ab36d66..5fca636fd5 100644
--- a/openstack_dashboard/dashboards/identity/users/tests.py
+++ b/openstack_dashboard/dashboards/identity/users/tests.py
@@ -611,16 +611,14 @@ class SeleniumTests(test.SeleniumAdminTestCase):
ignored_exceptions=[socket_timeout])
wait.until(lambda x: self.selenium.find_element_by_id("id_name"))
- body = self.selenium.find_element_by_tag_name("body")
- self.assertFalse("Passwords do not match" in body.text,
- "Error message should not be visible at loading time")
+ self.assertFalse(self._is_element_present("id_confirm_password_error"),
+ "Password error element shouldn't yet exist.")
self.selenium.find_element_by_id("id_name").send_keys("Test User")
self.selenium.find_element_by_id("id_password").send_keys("test")
self.selenium.find_element_by_id("id_confirm_password").send_keys("te")
self.selenium.find_element_by_id("id_email").send_keys("a@b.com")
- body = self.selenium.find_element_by_tag_name("body")
- self.assertTrue("Passwords do not match" in body.text,
- "Error message not found in body")
+ self.assertTrue(self._is_element_present("id_confirm_password_error"),
+ "Couldn't find password error element.")
@test.create_stubs({api.keystone: ('tenant_list',
'user_get',
@@ -638,12 +636,17 @@ class SeleniumTests(test.SeleniumAdminTestCase):
self.selenium.get("%s%s" % (self.live_server_url, USER_UPDATE_URL))
- body = self.selenium.find_element_by_tag_name("body")
- self.assertFalse("Passwords do not match" in body.text,
- "Error message should not be visible at loading time")
+ self.assertFalse(self._is_element_present("id_confirm_password_error"),
+ "Password error element shouldn't yet exist.")
self.selenium.find_element_by_id("id_password").send_keys("test")
self.selenium.find_element_by_id("id_confirm_password").send_keys("te")
self.selenium.find_element_by_id("id_email").clear()
- body = self.selenium.find_element_by_tag_name("body")
- self.assertTrue("Passwords do not match" in body.text,
- "Error message not found in body")
+ self.assertTrue(self._is_element_present("id_confirm_password_error"),
+ "Couldn't find password error element.")
+
+ def _is_element_present(self, element_id):
+ try:
+ self.selenium.find_element_by_id(element_id)
+ return True
+ except Exception:
+ return False
diff --git a/openstack_dashboard/test/tests/selenium_tests.py b/openstack_dashboard/test/tests/selenium_tests.py
index 90c1dc80cd..41932b4e37 100644
--- a/openstack_dashboard/test/tests/selenium_tests.py
+++ b/openstack_dashboard/test/tests/selenium_tests.py
@@ -18,5 +18,6 @@ from horizon.test import helpers as test
class BrowserTests(test.SeleniumTestCase):
def test_splash(self):
self.selenium.get(self.live_server_url)
- button = self.selenium.find_element_by_tag_name("button")
- self.assertEqual("Sign In", button.text)
+ button = self.selenium.find_element_by_id("loginBtn")
+ # Ensure button has something; must be language independent.
+ self.assertTrue(len(button.text) > 0)