summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/tests/browser/test_all_projects_page.py
diff options
context:
space:
mode:
authorAlassane Yattara <alassane.yattara@savoirfairelinux.com>2023-11-21 14:47:59 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-11-23 12:06:06 +0000
commit6c5dff75f5bf4bc7dd67599a27fce88622b5b59e (patch)
treedf385132fbff0fbde398c49a622b968f43b12ede /bitbake/lib/toaster/tests/browser/test_all_projects_page.py
parent2a2320001e2f4700d144d4c3bc914f8d4f68904d (diff)
downloadpoky-6c5dff75f5bf4bc7dd67599a27fce88622b5b59e.tar.gz
bitbake: toaster/tests: Add UI TestCase for Visualize all projects
Test the search box in the all project table on the all projects page (Bitbake rev: a2c0e65e90619268da916a235a97df890697d22f) Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/tests/browser/test_all_projects_page.py')
-rw-r--r--bitbake/lib/toaster/tests/browser/test_all_projects_page.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/tests/browser/test_all_projects_page.py b/bitbake/lib/toaster/tests/browser/test_all_projects_page.py
index 3389d32366..db25e72333 100644
--- a/bitbake/lib/toaster/tests/browser/test_all_projects_page.py
+++ b/bitbake/lib/toaster/tests/browser/test_all_projects_page.py
@@ -8,9 +8,11 @@
8# 8#
9 9
10import re 10import re
11import time
11 12
12from django.urls import reverse 13from django.urls import reverse
13from django.utils import timezone 14from django.utils import timezone
15from selenium.webdriver.support.select import Select
14from tests.browser.selenium_helpers import SeleniumTestCase 16from tests.browser.selenium_helpers import SeleniumTestCase
15 17
16from orm.models import BitbakeVersion, Release, Project, Build 18from orm.models import BitbakeVersion, Release, Project, Build
@@ -37,6 +39,17 @@ class TestAllProjectsPage(SeleniumTestCase):
37 39
38 self.release = None 40 self.release = None
39 41
42 def _create_projects(self, nb_project=10):
43 projects = []
44 for i in range(1, nb_project + 1):
45 projects.append(
46 Project(
47 name='test project {}'.format(i),
48 release=self.release,
49 )
50 )
51 Project.objects.bulk_create(projects)
52
40 def _add_build_to_default_project(self): 53 def _add_build_to_default_project(self):
41 """ Add a build to the default project (not used in all tests) """ 54 """ Add a build to the default project (not used in all tests) """
42 now = timezone.now() 55 now = timezone.now()
@@ -205,3 +218,24 @@ class TestAllProjectsPage(SeleniumTestCase):
205 expected_url = reverse('project', args=(self.project.id,)) 218 expected_url = reverse('project', args=(self.project.id,))
206 msg = 'link on project name should point to configuration but was %s' % link_url 219 msg = 'link on project name should point to configuration but was %s' % link_url
207 self.assertTrue(link_url.endswith(expected_url), msg) 220 self.assertTrue(link_url.endswith(expected_url), msg)
221
222 def test_allProject_table_search_box(self):
223 """ Test the search box in the all project table on the all projects page """
224 self._create_projects()
225
226 url = reverse('all-projects')
227 self.get(url)
228
229 # Chseck search box is present and works
230 self.wait_until_present('#projectstable tbody tr')
231 search_box = self.find('#search-input-projectstable')
232 self.assertTrue(search_box.is_displayed())
233
234 # Check that we can search for a project by project name
235 search_box.send_keys('test project 10')
236 search_btn = self.find('#search-submit-projectstable')
237 search_btn.click()
238 self.wait_until_present('#projectstable tbody tr')
239 time.sleep(1)
240 rows = self.find_all('#projectstable tbody tr')
241 self.assertTrue(len(rows) == 1)