diff options
| -rw-r--r-- | bitbake/lib/toaster/tests/browser/test_all_projects_page.py | 34 |
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 | ||
| 10 | import re | 10 | import re |
| 11 | import time | ||
| 11 | 12 | ||
| 12 | from django.urls import reverse | 13 | from django.urls import reverse |
| 13 | from django.utils import timezone | 14 | from django.utils import timezone |
| 15 | from selenium.webdriver.support.select import Select | ||
| 14 | from tests.browser.selenium_helpers import SeleniumTestCase | 16 | from tests.browser.selenium_helpers import SeleniumTestCase |
| 15 | 17 | ||
| 16 | from orm.models import BitbakeVersion, Release, Project, Build | 18 | from 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) | ||
