diff options
author | Michael Wood <michael.g.wood@intel.com> | 2016-06-13 14:32:16 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-15 08:35:07 +0100 |
commit | 7e54da0581faaafa9bfb13680ad6618c4c8f9831 (patch) | |
tree | 47de124e5baf7bf49de35c69c28775f467e185bf /bitbake/lib/toaster | |
parent | 234a625f40523032cc2fcd762558627fd9ef112a (diff) | |
download | poky-7e54da0581faaafa9bfb13680ad6618c4c8f9831.tar.gz |
bitbake: 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.
(Bitbake rev: 5f80dac65f419825bd81a734273a2465d5a01bab)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
3 files changed, 27 insertions, 24 deletions
diff --git a/bitbake/lib/toaster/tests/browser/test_all_builds_page.py b/bitbake/lib/toaster/tests/browser/test_all_builds_page.py index e4223f482a..5ea6532536 100644 --- a/bitbake/lib/toaster/tests/browser/test_all_builds_page.py +++ b/bitbake/lib/toaster/tests/browser/test_all_builds_page.py | |||
@@ -27,6 +27,7 @@ from tests.browser.selenium_helpers import SeleniumTestCase | |||
27 | 27 | ||
28 | from orm.models import BitbakeVersion, Release, Project, Build, Target | 28 | from orm.models import BitbakeVersion, Release, Project, Build, Target |
29 | 29 | ||
30 | |||
30 | class TestAllBuildsPage(SeleniumTestCase): | 31 | class TestAllBuildsPage(SeleniumTestCase): |
31 | """ Tests for all builds page /builds/ """ | 32 | """ Tests for all builds page /builds/ """ |
32 | 33 | ||
@@ -95,17 +96,17 @@ class TestAllBuildsPage(SeleniumTestCase): | |||
95 | url = reverse('all-builds') | 96 | url = reverse('all-builds') |
96 | self.get(url) | 97 | self.get(url) |
97 | 98 | ||
98 | # shouldn't see a run again button for command-line builds | 99 | # shouldn't see a rebuild button for command-line builds |
99 | selector = 'div[data-latest-build-result="%s"] button' % default_build.id | 100 | selector = 'div[data-latest-build-result="%s"] a.run-again-btn' % default_build.id |
100 | run_again_button = self.find_all(selector) | 101 | run_again_button = self.find_all(selector) |
101 | self.assertEqual(len(run_again_button), 0, | 102 | self.assertEqual(len(run_again_button), 0, |
102 | 'should not see a run again button for cli builds') | 103 | 'should not see a rebuild button for cli builds') |
103 | 104 | ||
104 | # should see a run again button for non-command-line builds | 105 | # should see a rebuild button for non-command-line builds |
105 | selector = 'div[data-latest-build-result="%s"] button' % build1.id | 106 | selector = 'div[data-latest-build-result="%s"] a.run-again-btn' % build1.id |
106 | run_again_button = self.find_all(selector) | 107 | run_again_button = self.find_all(selector) |
107 | self.assertEqual(len(run_again_button), 1, | 108 | self.assertEqual(len(run_again_button), 1, |
108 | 'should see a run again button for non-cli builds') | 109 | 'should see a rebuild button for non-cli builds') |
109 | 110 | ||
110 | def test_tooltips_on_project_name(self): | 111 | def test_tooltips_on_project_name(self): |
111 | """ | 112 | """ |
@@ -124,7 +125,7 @@ class TestAllBuildsPage(SeleniumTestCase): | |||
124 | # get the project name cells from the table | 125 | # get the project name cells from the table |
125 | cells = self.find_all('#allbuildstable td[class="project"]') | 126 | cells = self.find_all('#allbuildstable td[class="project"]') |
126 | 127 | ||
127 | selector = 'i.get-help' | 128 | selector = 'span.get-help' |
128 | 129 | ||
129 | for cell in cells: | 130 | for cell in cells: |
130 | content = cell.get_attribute('innerHTML') | 131 | content = cell.get_attribute('innerHTML') |
diff --git a/bitbake/lib/toaster/tests/browser/test_builddashboard_page.py b/bitbake/lib/toaster/tests/browser/test_builddashboard_page.py index 0d39abb050..cdb0616235 100644 --- a/bitbake/lib/toaster/tests/browser/test_builddashboard_page.py +++ b/bitbake/lib/toaster/tests/browser/test_builddashboard_page.py | |||
@@ -140,7 +140,7 @@ class TestBuildDashboardPage(SeleniumTestCase): | |||
140 | dashboard for the Build object build | 140 | dashboard for the Build object build |
141 | """ | 141 | """ |
142 | self._get_build_dashboard(build) | 142 | self._get_build_dashboard(build) |
143 | return self.find_all('#errors div.alert-error') | 143 | return self.find_all('#errors div.alert-danger') |
144 | 144 | ||
145 | def _check_for_log_message(self, build, log_message): | 145 | def _check_for_log_message(self, build, log_message): |
146 | """ | 146 | """ |
@@ -179,23 +179,15 @@ class TestBuildDashboardPage(SeleniumTestCase): | |||
179 | the WebElement modal match the list of text values in expected | 179 | the WebElement modal match the list of text values in expected |
180 | """ | 180 | """ |
181 | # labels containing the radio buttons we're testing for | 181 | # labels containing the radio buttons we're testing for |
182 | labels = modal.find_elements_by_tag_name('label') | 182 | labels = modal.find_elements_by_css_selector(".radio") |
183 | |||
184 | # because the label content has the structure | ||
185 | # label text | ||
186 | # <input...> | ||
187 | # we have to regex on its innerHTML, as we can't just retrieve the | ||
188 | # "label text" on its own via the Selenium API | ||
189 | labels_text = sorted(map( | ||
190 | lambda label: label.get_attribute('innerHTML'), labels | ||
191 | )) | ||
192 | |||
193 | expected = sorted(expected) | ||
194 | 183 | ||
184 | labels_text = [lab.text for lab in labels] | ||
195 | self.assertEqual(len(labels_text), len(expected)) | 185 | self.assertEqual(len(labels_text), len(expected)) |
196 | 186 | ||
197 | for idx, label_text in enumerate(labels_text): | 187 | for expected_text in expected: |
198 | self.assertRegexpMatches(label_text, expected[idx]) | 188 | self.assertTrue(expected_text in labels_text, |
189 | "Could not find %s in %s" % (expected_text, | ||
190 | labels_text)) | ||
199 | 191 | ||
200 | def test_exceptions_show_as_errors(self): | 192 | def test_exceptions_show_as_errors(self): |
201 | """ | 193 | """ |
@@ -217,7 +209,13 @@ class TestBuildDashboardPage(SeleniumTestCase): | |||
217 | the user choose one of them to edit | 209 | the user choose one of them to edit |
218 | """ | 210 | """ |
219 | self._get_build_dashboard(self.build1) | 211 | self._get_build_dashboard(self.build1) |
212 | |||
213 | # click the "edit custom image" button, which populates the modal | ||
214 | selector = '[data-role="edit-custom-image-trigger"]' | ||
215 | self.click(selector) | ||
216 | |||
220 | modal = self.driver.find_element_by_id('edit-custom-image-modal') | 217 | modal = self.driver.find_element_by_id('edit-custom-image-modal') |
218 | self.wait_until_visible("#edit-custom-image-modal") | ||
221 | 219 | ||
222 | # recipes we expect to see in the edit custom image modal | 220 | # recipes we expect to see in the edit custom image modal |
223 | expected_recipes = [ | 221 | expected_recipes = [ |
@@ -235,10 +233,11 @@ class TestBuildDashboardPage(SeleniumTestCase): | |||
235 | self._get_build_dashboard(self.build1) | 233 | self._get_build_dashboard(self.build1) |
236 | 234 | ||
237 | # click the "new custom image" button, which populates the modal | 235 | # click the "new custom image" button, which populates the modal |
238 | selector = '[data-role="new-custom-image-trigger"] button' | 236 | selector = '[data-role="new-custom-image-trigger"]' |
239 | self.click(selector) | 237 | self.click(selector) |
240 | 238 | ||
241 | modal = self.driver.find_element_by_id('new-custom-image-modal') | 239 | modal = self.driver.find_element_by_id('new-custom-image-modal') |
240 | self.wait_until_visible("#new-custom-image-modal") | ||
242 | 241 | ||
243 | # recipes we expect to see in the new custom image modal | 242 | # recipes we expect to see in the new custom image modal |
244 | expected_recipes = [ | 243 | expected_recipes = [ |
diff --git a/bitbake/lib/toaster/tests/browser/test_project_config_page.py b/bitbake/lib/toaster/tests/browser/test_project_config_page.py index ede53b6456..7fc1252182 100644 --- a/bitbake/lib/toaster/tests/browser/test_project_config_page.py +++ b/bitbake/lib/toaster/tests/browser/test_project_config_page.py | |||
@@ -99,7 +99,10 @@ class TestProjectConfigsPage(SeleniumTestCase): | |||
99 | 99 | ||
100 | self.wait_until_visible('#new-imagefs_types') | 100 | self.wait_until_visible('#new-imagefs_types') |
101 | 101 | ||
102 | checkboxes = self.driver.find_elements_by_xpath("//input[@class='fs-checkbox-fstypes']") | 102 | checkboxes_selector = '.fs-checkbox-fstypes' |
103 | |||
104 | self.wait_until_visible(checkboxes_selector) | ||
105 | checkboxes = self.find_all(checkboxes_selector) | ||
103 | 106 | ||
104 | for checkbox in checkboxes: | 107 | for checkbox in checkboxes: |
105 | if checkbox.get_attribute("value") == "cpio": | 108 | if checkbox.get_attribute("value") == "cpio": |