mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 00:39:46 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
2a2320001e
commit
6c5dff75f5
@@ -8,9 +8,11 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import time
|
||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from selenium.webdriver.support.select import Select
|
||||||
from tests.browser.selenium_helpers import SeleniumTestCase
|
from tests.browser.selenium_helpers import SeleniumTestCase
|
||||||
|
|
||||||
from orm.models import BitbakeVersion, Release, Project, Build
|
from orm.models import BitbakeVersion, Release, Project, Build
|
||||||
@@ -37,6 +39,17 @@ class TestAllProjectsPage(SeleniumTestCase):
|
|||||||
|
|
||||||
self.release = None
|
self.release = None
|
||||||
|
|
||||||
|
def _create_projects(self, nb_project=10):
|
||||||
|
projects = []
|
||||||
|
for i in range(1, nb_project + 1):
|
||||||
|
projects.append(
|
||||||
|
Project(
|
||||||
|
name='test project {}'.format(i),
|
||||||
|
release=self.release,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
Project.objects.bulk_create(projects)
|
||||||
|
|
||||||
def _add_build_to_default_project(self):
|
def _add_build_to_default_project(self):
|
||||||
""" Add a build to the default project (not used in all tests) """
|
""" Add a build to the default project (not used in all tests) """
|
||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
@@ -205,3 +218,24 @@ class TestAllProjectsPage(SeleniumTestCase):
|
|||||||
expected_url = reverse('project', args=(self.project.id,))
|
expected_url = reverse('project', args=(self.project.id,))
|
||||||
msg = 'link on project name should point to configuration but was %s' % link_url
|
msg = 'link on project name should point to configuration but was %s' % link_url
|
||||||
self.assertTrue(link_url.endswith(expected_url), msg)
|
self.assertTrue(link_url.endswith(expected_url), msg)
|
||||||
|
|
||||||
|
def test_allProject_table_search_box(self):
|
||||||
|
""" Test the search box in the all project table on the all projects page """
|
||||||
|
self._create_projects()
|
||||||
|
|
||||||
|
url = reverse('all-projects')
|
||||||
|
self.get(url)
|
||||||
|
|
||||||
|
# Chseck search box is present and works
|
||||||
|
self.wait_until_present('#projectstable tbody tr')
|
||||||
|
search_box = self.find('#search-input-projectstable')
|
||||||
|
self.assertTrue(search_box.is_displayed())
|
||||||
|
|
||||||
|
# Check that we can search for a project by project name
|
||||||
|
search_box.send_keys('test project 10')
|
||||||
|
search_btn = self.find('#search-submit-projectstable')
|
||||||
|
search_btn.click()
|
||||||
|
self.wait_until_present('#projectstable tbody tr')
|
||||||
|
time.sleep(1)
|
||||||
|
rows = self.find_all('#projectstable tbody tr')
|
||||||
|
self.assertTrue(len(rows) == 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user