aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-06-13 14:32:16 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-14 11:08:59 +0100
commit5f80dac65f419825bd81a734273a2465d5a01bab (patch)
treea6e81f76c27027bf729a3f7e8a9540f05c14137b
parent0bdfcafdd1e2ebc10dc0cd343c8bb77f09a71c90 (diff)
downloadbitbake-5f80dac65f419825bd81a734273a2465d5a01bab.tar.gz
toaster: tests browser Fix selenium tests after bootstrap3 breakage
Fix a number of selectors which have changed after the port to bootstrap3. Also fix the modal wait_until_visible and returning of the text for the radio buttons in the modals for edit custom image and new custom image on the build dashboard. Signed-off-by: Michael Wood <michael.g.wood@intel.com>
-rw-r--r--lib/toaster/tests/browser/test_all_builds_page.py15
-rw-r--r--lib/toaster/tests/browser/test_builddashboard_page.py31
-rw-r--r--lib/toaster/tests/browser/test_project_config_page.py5
3 files changed, 27 insertions, 24 deletions
diff --git a/lib/toaster/tests/browser/test_all_builds_page.py b/lib/toaster/tests/browser/test_all_builds_page.py
index e4223f482..5ea653253 100644
--- a/lib/toaster/tests/browser/test_all_builds_page.py
+++ b/lib/toaster/tests/browser/test_all_builds_page.py
@@ -27,6 +27,7 @@ from tests.browser.selenium_helpers import SeleniumTestCase
from orm.models import BitbakeVersion, Release, Project, Build, Target
+
class TestAllBuildsPage(SeleniumTestCase):
""" Tests for all builds page /builds/ """
@@ -95,17 +96,17 @@ class TestAllBuildsPage(SeleniumTestCase):
url = reverse('all-builds')
self.get(url)
- # shouldn't see a run again button for command-line builds
- selector = 'div[data-latest-build-result="%s"] button' % default_build.id
+ # shouldn't see a rebuild button for command-line builds
+ selector = 'div[data-latest-build-result="%s"] a.run-again-btn' % default_build.id
run_again_button = self.find_all(selector)
self.assertEqual(len(run_again_button), 0,
- 'should not see a run again button for cli builds')
+ 'should not see a rebuild button for cli builds')
- # should see a run again button for non-command-line builds
- selector = 'div[data-latest-build-result="%s"] button' % build1.id
+ # should see a rebuild button for non-command-line builds
+ selector = 'div[data-latest-build-result="%s"] a.run-again-btn' % build1.id
run_again_button = self.find_all(selector)
self.assertEqual(len(run_again_button), 1,
- 'should see a run again button for non-cli builds')
+ 'should see a rebuild button for non-cli builds')
def test_tooltips_on_project_name(self):
"""
@@ -124,7 +125,7 @@ class TestAllBuildsPage(SeleniumTestCase):
# get the project name cells from the table
cells = self.find_all('#allbuildstable td[class="project"]')
- selector = 'i.get-help'
+ selector = 'span.get-help'
for cell in cells:
content = cell.get_attribute('innerHTML')
diff --git a/lib/toaster/tests/browser/test_builddashboard_page.py b/lib/toaster/tests/browser/test_builddashboard_page.py
index 0d39abb05..cdb061623 100644
--- a/lib/toaster/tests/browser/test_builddashboard_page.py
+++ b/lib/toaster/tests/browser/test_builddashboard_page.py
@@ -140,7 +140,7 @@ class TestBuildDashboardPage(SeleniumTestCase):
dashboard for the Build object build
"""
self._get_build_dashboard(build)
- return self.find_all('#errors div.alert-error')
+ return self.find_all('#errors div.alert-danger')
def _check_for_log_message(self, build, log_message):
"""
@@ -179,23 +179,15 @@ class TestBuildDashboardPage(SeleniumTestCase):
the WebElement modal match the list of text values in expected
"""
# labels containing the radio buttons we're testing for
- labels = modal.find_elements_by_tag_name('label')
-
- # because the label content has the structure
- # label text
- # <input...>
- # we have to regex on its innerHTML, as we can't just retrieve the
- # "label text" on its own via the Selenium API
- labels_text = sorted(map(
- lambda label: label.get_attribute('innerHTML'), labels
- ))
-
- expected = sorted(expected)
+ labels = modal.find_elements_by_css_selector(".radio")
+ labels_text = [lab.text for lab in labels]
self.assertEqual(len(labels_text), len(expected))
- for idx, label_text in enumerate(labels_text):
- self.assertRegexpMatches(label_text, expected[idx])
+ for expected_text in expected:
+ self.assertTrue(expected_text in labels_text,
+ "Could not find %s in %s" % (expected_text,
+ labels_text))
def test_exceptions_show_as_errors(self):
"""
@@ -217,7 +209,13 @@ class TestBuildDashboardPage(SeleniumTestCase):
the user choose one of them to edit
"""
self._get_build_dashboard(self.build1)
+
+ # click the "edit custom image" button, which populates the modal
+ selector = '[data-role="edit-custom-image-trigger"]'
+ self.click(selector)
+
modal = self.driver.find_element_by_id('edit-custom-image-modal')
+ self.wait_until_visible("#edit-custom-image-modal")
# recipes we expect to see in the edit custom image modal
expected_recipes = [
@@ -235,10 +233,11 @@ class TestBuildDashboardPage(SeleniumTestCase):
self._get_build_dashboard(self.build1)
# click the "new custom image" button, which populates the modal
- selector = '[data-role="new-custom-image-trigger"] button'
+ selector = '[data-role="new-custom-image-trigger"]'
self.click(selector)
modal = self.driver.find_element_by_id('new-custom-image-modal')
+ self.wait_until_visible("#new-custom-image-modal")
# recipes we expect to see in the new custom image modal
expected_recipes = [
diff --git a/lib/toaster/tests/browser/test_project_config_page.py b/lib/toaster/tests/browser/test_project_config_page.py
index ede53b645..7fc125218 100644
--- a/lib/toaster/tests/browser/test_project_config_page.py
+++ b/lib/toaster/tests/browser/test_project_config_page.py
@@ -99,7 +99,10 @@ class TestProjectConfigsPage(SeleniumTestCase):
self.wait_until_visible('#new-imagefs_types')
- checkboxes = self.driver.find_elements_by_xpath("//input[@class='fs-checkbox-fstypes']")
+ checkboxes_selector = '.fs-checkbox-fstypes'
+
+ self.wait_until_visible(checkboxes_selector)
+ checkboxes = self.find_all(checkboxes_selector)
for checkbox in checkboxes:
if checkbox.get_attribute("value") == "cpio":