diff options
Diffstat (limited to 'bitbake/lib/toaster/tests/browser/test_builddashboard_page.py')
-rw-r--r-- | bitbake/lib/toaster/tests/browser/test_builddashboard_page.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/bitbake/lib/toaster/tests/browser/test_builddashboard_page.py b/bitbake/lib/toaster/tests/browser/test_builddashboard_page.py index efcd89b346..d838ce363a 100644 --- a/bitbake/lib/toaster/tests/browser/test_builddashboard_page.py +++ b/bitbake/lib/toaster/tests/browser/test_builddashboard_page.py | |||
@@ -7,6 +7,7 @@ | |||
7 | # SPDX-License-Identifier: GPL-2.0-only | 7 | # SPDX-License-Identifier: GPL-2.0-only |
8 | # | 8 | # |
9 | 9 | ||
10 | import os | ||
10 | from django.urls import reverse | 11 | from django.urls import reverse |
11 | from django.utils import timezone | 12 | from django.utils import timezone |
12 | 13 | ||
@@ -15,11 +16,14 @@ from tests.browser.selenium_helpers import SeleniumTestCase | |||
15 | from orm.models import Project, Release, BitbakeVersion, Build, LogMessage | 16 | from orm.models import Project, Release, BitbakeVersion, Build, LogMessage |
16 | from orm.models import Layer, Layer_Version, Recipe, CustomImageRecipe, Variable | 17 | from orm.models import Layer, Layer_Version, Recipe, CustomImageRecipe, Variable |
17 | 18 | ||
19 | from selenium.webdriver.common.by import By | ||
20 | |||
18 | class TestBuildDashboardPage(SeleniumTestCase): | 21 | class TestBuildDashboardPage(SeleniumTestCase): |
19 | """ Tests for the build dashboard /build/X """ | 22 | """ Tests for the build dashboard /build/X """ |
20 | 23 | ||
21 | def setUp(self): | 24 | def setUp(self): |
22 | bbv = BitbakeVersion.objects.create(name='bbv1', giturl='/tmp/', | 25 | builldir = os.environ.get('BUILDDIR', './') |
26 | bbv = BitbakeVersion.objects.create(name='bbv1', giturl=f'{builldir}/', | ||
23 | branch='master', dirpath="") | 27 | branch='master', dirpath="") |
24 | release = Release.objects.create(name='release1', | 28 | release = Release.objects.create(name='release1', |
25 | bitbake_version=bbv) | 29 | bitbake_version=bbv) |
@@ -158,6 +162,7 @@ class TestBuildDashboardPage(SeleniumTestCase): | |||
158 | """ | 162 | """ |
159 | url = reverse('builddashboard', args=(build.id,)) | 163 | url = reverse('builddashboard', args=(build.id,)) |
160 | self.get(url) | 164 | self.get(url) |
165 | self.wait_until_visible('#global-nav', poll=3) | ||
161 | 166 | ||
162 | def _get_build_dashboard_errors(self, build): | 167 | def _get_build_dashboard_errors(self, build): |
163 | """ | 168 | """ |
@@ -183,7 +188,7 @@ class TestBuildDashboardPage(SeleniumTestCase): | |||
183 | 188 | ||
184 | found = False | 189 | found = False |
185 | for element in message_elements: | 190 | for element in message_elements: |
186 | log_message_text = element.find_element_by_tag_name('pre').text.strip() | 191 | log_message_text = element.find_element(By.TAG_NAME, 'pre').text.strip() |
187 | text_matches = (log_message_text == expected_text) | 192 | text_matches = (log_message_text == expected_text) |
188 | 193 | ||
189 | log_message_pk = element.get_attribute('data-log-message-id') | 194 | log_message_pk = element.get_attribute('data-log-message-id') |
@@ -213,7 +218,7 @@ class TestBuildDashboardPage(SeleniumTestCase): | |||
213 | the WebElement modal match the list of text values in expected | 218 | the WebElement modal match the list of text values in expected |
214 | """ | 219 | """ |
215 | # labels containing the radio buttons we're testing for | 220 | # labels containing the radio buttons we're testing for |
216 | labels = modal.find_elements_by_css_selector(".radio") | 221 | labels = modal.find_elements(By.CSS_SELECTOR,".radio") |
217 | 222 | ||
218 | labels_text = [lab.text for lab in labels] | 223 | labels_text = [lab.text for lab in labels] |
219 | self.assertEqual(len(labels_text), len(expected)) | 224 | self.assertEqual(len(labels_text), len(expected)) |
@@ -248,7 +253,7 @@ class TestBuildDashboardPage(SeleniumTestCase): | |||
248 | selector = '[data-role="edit-custom-image-trigger"]' | 253 | selector = '[data-role="edit-custom-image-trigger"]' |
249 | self.click(selector) | 254 | self.click(selector) |
250 | 255 | ||
251 | modal = self.driver.find_element_by_id('edit-custom-image-modal') | 256 | modal = self.driver.find_element(By.ID, 'edit-custom-image-modal') |
252 | self.wait_until_visible("#edit-custom-image-modal") | 257 | self.wait_until_visible("#edit-custom-image-modal") |
253 | 258 | ||
254 | # recipes we expect to see in the edit custom image modal | 259 | # recipes we expect to see in the edit custom image modal |
@@ -270,7 +275,7 @@ class TestBuildDashboardPage(SeleniumTestCase): | |||
270 | selector = '[data-role="new-custom-image-trigger"]' | 275 | selector = '[data-role="new-custom-image-trigger"]' |
271 | self.click(selector) | 276 | self.click(selector) |
272 | 277 | ||
273 | modal = self.driver.find_element_by_id('new-custom-image-modal') | 278 | modal = self.driver.find_element(By.ID,'new-custom-image-modal') |
274 | self.wait_until_visible("#new-custom-image-modal") | 279 | self.wait_until_visible("#new-custom-image-modal") |
275 | 280 | ||
276 | # recipes we expect to see in the new custom image modal | 281 | # recipes we expect to see in the new custom image modal |