summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorAlassane Yattara <alassane.yattara@savoirfairelinux.com>2023-11-14 15:28:02 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-11-14 23:38:13 +0000
commit3375714aa4abb7dc884ba0e7739b638633c522a0 (patch)
treead7aef3719b134f98cc02bd163a03b60897ea357 /bitbake
parent0766f6cdc87b7ce6fb2bf95514602d5c29472940 (diff)
downloadpoky-3375714aa4abb7dc884ba0e7739b638633c522a0.tar.gz
bitbake: toaster/tests: Add UI TestCase to test search box on all build page
Test the search box in the builds table on the all builds page (Bitbake rev: 6ec40284e4fd173430cdc526716794b7da7d6523) Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/tests/browser/test_all_builds_page.py43
1 files changed, 34 insertions, 9 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 d4312bb35b..eb14f89db1 100644
--- a/bitbake/lib/toaster/tests/browser/test_all_builds_page.py
+++ b/bitbake/lib/toaster/tests/browser/test_all_builds_page.py
@@ -11,6 +11,7 @@ import re, time
11 11
12from django.urls import reverse 12from django.urls import reverse
13from django.utils import timezone 13from django.utils import timezone
14from selenium.webdriver.remote.webdriver import WebElement
14from tests.browser.selenium_helpers import SeleniumTestCase 15from tests.browser.selenium_helpers import SeleniumTestCase
15 16
16from orm.models import BitbakeVersion, Release, Project, Build, Target 17from orm.models import BitbakeVersion, Release, Project, Build, Target
@@ -102,6 +103,18 @@ class TestAllBuildsPage(SeleniumTestCase):
102 103
103 return found_row 104 return found_row
104 105
106 def _get_create_builds(self, **kwargs):
107 """ Create a build and return the build object """
108 build1 = Build.objects.create(**self.project1_build_success)
109 build2 = Build.objects.create(**self.project1_build_failure)
110
111 # add some targets to these builds so they have recipe links
112 # (and so we can find the row in the ToasterTable corresponding to
113 # a particular build)
114 Target.objects.create(build=build1, target='foo')
115 Target.objects.create(build=build2, target='bar')
116 return build1, build2
117
105 def test_show_tasks_with_suffix(self): 118 def test_show_tasks_with_suffix(self):
106 """ Task should be shown as suffix on build name """ 119 """ Task should be shown as suffix on build name """
107 build = Build.objects.create(**self.project1_build_success) 120 build = Build.objects.create(**self.project1_build_success)
@@ -146,7 +159,6 @@ class TestAllBuildsPage(SeleniumTestCase):
146 self.assertEqual(len(run_again_button), 0, 159 self.assertEqual(len(run_again_button), 0,
147 'should not see a rebuild button for cli builds') 160 'should not see a rebuild button for cli builds')
148 161
149
150 def test_tooltips_on_project_name(self): 162 def test_tooltips_on_project_name(self):
151 """ 163 """
152 Test tooltips shown next to project name in the main table 164 Test tooltips shown next to project name in the main table
@@ -188,14 +200,7 @@ class TestAllBuildsPage(SeleniumTestCase):
188 recent builds area; failed builds should not have links on the time column, 200 recent builds area; failed builds should not have links on the time column,
189 or in the recent builds area 201 or in the recent builds area
190 """ 202 """
191 build1 = Build.objects.create(**self.project1_build_success) 203 build1, build2 = self._get_create_builds()
192 build2 = Build.objects.create(**self.project1_build_failure)
193
194 # add some targets to these builds so they have recipe links
195 # (and so we can find the row in the ToasterTable corresponding to
196 # a particular build)
197 Target.objects.create(build=build1, target='foo')
198 Target.objects.create(build=build2, target='bar')
199 204
200 url = reverse('all-builds') 205 url = reverse('all-builds')
201 self.get(url) 206 self.get(url)
@@ -223,3 +228,23 @@ class TestAllBuildsPage(SeleniumTestCase):
223 links = build2_row.find_elements(By.CSS_SELECTOR, 'td.time a') 228 links = build2_row.find_elements(By.CSS_SELECTOR, 'td.time a')
224 msg = 'should not be a link on the build time for a failed build' 229 msg = 'should not be a link on the build time for a failed build'
225 self.assertEquals(len(links), 0, msg) 230 self.assertEquals(len(links), 0, msg)
231
232 def test_builds_table_search_box(self):
233 """ Test the search box in the builds table on the all builds page """
234 self._get_create_builds()
235
236 url = reverse('all-builds')
237 self.get(url)
238
239 # Check search box is present and works
240 self.wait_until_present('#allbuildstable tbody tr')
241 search_box = self.find('#search-input-allbuildstable')
242 self.assertTrue(search_box.is_displayed())
243
244 # Check that we can search for a build by recipe name
245 search_box.send_keys('foo')
246 search_btn = self.find('#search-submit-allbuildstable')
247 search_btn.click()
248 self.wait_until_present('#allbuildstable tbody tr')
249 rows = self.find_all('#allbuildstable tbody tr')
250 self.assertTrue(len(rows) >= 1)