diff options
Diffstat (limited to 'lib/toaster/tests/browser/test_builddashboard_page.py')
-rw-r--r-- | lib/toaster/tests/browser/test_builddashboard_page.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/toaster/tests/browser/test_builddashboard_page.py b/lib/toaster/tests/browser/test_builddashboard_page.py index efcd89b34..d838ce363 100644 --- a/lib/toaster/tests/browser/test_builddashboard_page.py +++ b/lib/toaster/tests/browser/test_builddashboard_page.py @@ -7,6 +7,7 @@ # SPDX-License-Identifier: GPL-2.0-only # +import os from django.urls import reverse from django.utils import timezone @@ -15,11 +16,14 @@ from tests.browser.selenium_helpers import SeleniumTestCase from orm.models import Project, Release, BitbakeVersion, Build, LogMessage from orm.models import Layer, Layer_Version, Recipe, CustomImageRecipe, Variable +from selenium.webdriver.common.by import By + class TestBuildDashboardPage(SeleniumTestCase): """ Tests for the build dashboard /build/X """ def setUp(self): - bbv = BitbakeVersion.objects.create(name='bbv1', giturl='/tmp/', + builldir = os.environ.get('BUILDDIR', './') + bbv = BitbakeVersion.objects.create(name='bbv1', giturl=f'{builldir}/', branch='master', dirpath="") release = Release.objects.create(name='release1', bitbake_version=bbv) @@ -158,6 +162,7 @@ class TestBuildDashboardPage(SeleniumTestCase): """ url = reverse('builddashboard', args=(build.id,)) self.get(url) + self.wait_until_visible('#global-nav', poll=3) def _get_build_dashboard_errors(self, build): """ @@ -183,7 +188,7 @@ class TestBuildDashboardPage(SeleniumTestCase): found = False for element in message_elements: - log_message_text = element.find_element_by_tag_name('pre').text.strip() + log_message_text = element.find_element(By.TAG_NAME, 'pre').text.strip() text_matches = (log_message_text == expected_text) log_message_pk = element.get_attribute('data-log-message-id') @@ -213,7 +218,7 @@ 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_css_selector(".radio") + labels = modal.find_elements(By.CSS_SELECTOR,".radio") labels_text = [lab.text for lab in labels] self.assertEqual(len(labels_text), len(expected)) @@ -248,7 +253,7 @@ class TestBuildDashboardPage(SeleniumTestCase): selector = '[data-role="edit-custom-image-trigger"]' self.click(selector) - modal = self.driver.find_element_by_id('edit-custom-image-modal') + 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 @@ -270,7 +275,7 @@ class TestBuildDashboardPage(SeleniumTestCase): selector = '[data-role="new-custom-image-trigger"]' self.click(selector) - modal = self.driver.find_element_by_id('new-custom-image-modal') + 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 |