toaster: tests Rename test settings to python compliant name and fix import
PATCH 1/2 toaster: tests Rename test settings to python compliant name and fix import
Use underscore instead of dash in the file name for the test settings. Also fix the import of the settings module.
Signed-off-by Michael Wood <[email protected]>
--- bitbake/lib/toaster/tests/builds/README | 2 +- bitbake/lib/toaster/toastermain/settings-test.py | 41 ------------------------ bitbake/lib/toaster/toastermain/settings_test.py | 41 ++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 42 deletions(-) delete mode 100644 bitbake/lib/toaster/toastermain/settings-test.py create mode 100644 bitbake/lib/toaster/toastermain/settings_test.py
bitbake/lib/toaster/tests/builds/README +1 -1
@@ -7,7 +7,7 @@ The simplest way to run the tests are the following commands: $ . oe-init-build-env $ cd bitbake/lib/toaster/ # path my vary but this is into toaster's directory -$ DJANGO_SETTINGS_MODULE='toastermain.settings-test' ./manage.py test tests.builds +$ DJANGO_SETTINGS_MODULE='toastermain.settings_test' ./manage.py test tests.builds Optional environment variables: - TOASTER_DIR (where toaster keeps it's artifacts)
bitbake/lib/toaster/toastermain/settings-test.py deleted +0 -41
41 lines not on this page · raw message
bitbake/lib/toaster/toastermain/settings_test.py new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 2/2 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 <[email protected]>
--- .../toaster/tests/browser/test_all_builds_page.py | 15 ++++++----- .../tests/browser/test_builddashboard_page.py | 31 +++++++++++----------- .../tests/browser/test_project_config_page.py | 5 +++- 3 files changed, 27 insertions(+), 24 deletions(-)
bitbake/lib/toaster/tests/browser/test_all_builds_page.py +8 -7
@@ -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')
bitbake/lib/toaster/tests/browser/test_builddashboard_page.py +15 -16
@@ -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 = [
bitbake/lib/toaster/tests/browser/test_project_config_page.py +4 -1
@@ -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":
Signature · 1 line
2.7.4