From patchwork Tue Nov 21 13:47:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 34961 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBB81C61D96 for ; Tue, 21 Nov 2023 13:48:19 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web11.40784.1700574494008005738 for ; Tue, 21 Nov 2023 05:48:14 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=HP9T8V3Y; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 43B719C3500 for ; Tue, 21 Nov 2023 08:48:13 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id 5RuBn4obBZjU; Tue, 21 Nov 2023 08:48:12 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 8A8A89C36C5; Tue, 21 Nov 2023 08:48:12 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 8A8A89C36C5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1700574492; bh=djfVLsXamiYxkxnSgTlSvpB11XtKkDD8DQe77RnLLgs=; h=From:To:Date:Message-Id:MIME-Version; b=HP9T8V3Yv5CgwRrfuHSVIROmeosq3TWbdEEYV3tPVPFMOB4Swd8+zoMw4q5D7FO1C xYwSJK6eTAeG5KcMeuJlb8TY+QhevY5qQrOM4HsQ/jpElK3dAkITuERSc7qlqy4m8T GeOx9PbPdZ5eC3tsJ2t3zzaslpOrgc0oE3DIpIITfLpA+SUwMvnDY3rh0zYP3z2x2l S9UCSUw8AgvbjR6BK1dEzyH3J5lekReZWs+mF42dMsgRNO+6mqWj/77dkB5NUrcPEX AWIe+UY818+G1n0xRxAMZiOvVqv6WuT1bYgjmkmjQM6ZNlNNC6dJufZG+1H7UcFNKS PLgIuRGIwD6vQ== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id 3mZhmvYDfpHW; Tue, 21 Nov 2023 08:48:12 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id AA51D9C36BF; Tue, 21 Nov 2023 08:48:11 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH 1/3] Toaster: Toaster: Write UI TestCase -> Visualize all projects Date: Tue, 21 Nov 2023 14:47:59 +0100 Message-Id: <20231121134801.97718-1-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Nov 2023 13:48:19 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15545 Test the search box in the all project table on the all projects page Signed-off-by: Alassane Yattara --- .../tests/browser/test_all_projects_page.py | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/lib/toaster/tests/browser/test_all_projects_page.py b/lib/toaster/tests/browser/test_all_projects_page.py index 3389d323..db25e723 100644 --- a/lib/toaster/tests/browser/test_all_projects_page.py +++ b/lib/toaster/tests/browser/test_all_projects_page.py @@ -8,9 +8,11 @@ # import re +import time from django.urls import reverse from django.utils import timezone +from selenium.webdriver.support.select import Select from tests.browser.selenium_helpers import SeleniumTestCase from orm.models import BitbakeVersion, Release, Project, Build @@ -37,6 +39,17 @@ class TestAllProjectsPage(SeleniumTestCase): 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): """ Add a build to the default project (not used in all tests) """ now = timezone.now() @@ -205,3 +218,24 @@ class TestAllProjectsPage(SeleniumTestCase): expected_url = reverse('project', args=(self.project.id,)) msg = 'link on project name should point to configuration but was %s' % link_url 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) From patchwork Tue Nov 21 13:48:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 34962 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA747C61D92 for ; Tue, 21 Nov 2023 13:48:19 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.40782.1700574494929030740 for ; Tue, 21 Nov 2023 05:48:15 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=Piv4/J0/; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 477E99C3500 for ; Tue, 21 Nov 2023 08:48:14 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id 5CX-Fg7z15z6; Tue, 21 Nov 2023 08:48:13 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id C0D109C36BF; Tue, 21 Nov 2023 08:48:13 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com C0D109C36BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1700574493; bh=JjqD5HKixp7hLeuqqEY/8qQk6P82Ru05ECeGDvQjuPE=; h=From:To:Date:Message-Id:MIME-Version; b=Piv4/J0/LiL4ceCw3k4xa3HMbxFc3sK5whRI/kweo4ceJCDKFyHxMtlWK6Taa+JXZ uPgI8FqbpPrr6cjBRxleJHMKR3Se1inz17/HeAfGIPOpwGPw17AUfmWCCEHrBGvdsN by5U6kQHacDUguzr7x//Y6WaQIxLHqkCDlLDbSrnHNLR3/s9+gCTuam63i9m4lZ3hf YyxjHDLFmlgG+ecx8xZGkr90mCM57PrK4PykL/jBct2FIKmoUSzPgAED0Kgwr8MzEZ ShfSmS81ViXj36a/oM8qbIO6GCaPCmyt1yV/U74gnaZozDDAa1I0503UOSui2C4ABm CMmYnaW9wgqXA== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id LM29WSIfDlv9; Tue, 21 Nov 2023 08:48:13 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id E0B229C2B49; Tue, 21 Nov 2023 08:48:12 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH 2/3] Toaster: Toaster: Write UI TestCase -> Visualize all projects Date: Tue, 21 Nov 2023 14:48:00 +0100 Message-Id: <20231121134801.97718-2-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231121134801.97718-1-alassane.yattara@savoirfairelinux.com> References: <20231121134801.97718-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Nov 2023 13:48:19 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15546 Test the edit column feature in the projects table on the all projects page Signed-off-by: Alassane Yattara --- .../tests/browser/test_all_projects_page.py | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/lib/toaster/tests/browser/test_all_projects_page.py b/lib/toaster/tests/browser/test_all_projects_page.py index db25e723..2b1d8cc1 100644 --- a/lib/toaster/tests/browser/test_all_projects_page.py +++ b/lib/toaster/tests/browser/test_all_projects_page.py @@ -239,3 +239,61 @@ class TestAllProjectsPage(SeleniumTestCase): time.sleep(1) rows = self.find_all('#projectstable tbody tr') self.assertTrue(len(rows) == 1) + + def test_allProject_table_editColumn(self): + """ Test the edit column feature in the projects table on the all projects page """ + self._create_projects() + + def test_edit_column(check_box_id): + # Check that we can hide/show table column + check_box = self.find(f'#{check_box_id}') + th_class = str(check_box_id).replace('checkbox-', '') + if check_box.is_selected(): + # check if column is visible in table + self.assertTrue( + self.find( + f'#projectstable thead th.{th_class}' + ).is_displayed(), + f"The {th_class} column is checked in EditColumn dropdown, but it's not visible in table" + ) + check_box.click() + # check if column is hidden in table + self.assertFalse( + self.find( + f'#projectstable thead th.{th_class}' + ).is_displayed(), + f"The {th_class} column is unchecked in EditColumn dropdown, but it's visible in table" + ) + else: + # check if column is hidden in table + self.assertFalse( + self.find( + f'#projectstable thead th.{th_class}' + ).is_displayed(), + f"The {th_class} column is unchecked in EditColumn dropdown, but it's visible in table" + ) + check_box.click() + # check if column is visible in table + self.assertTrue( + self.find( + f'#projectstable thead th.{th_class}' + ).is_displayed(), + f"The {th_class} column is checked in EditColumn dropdown, but it's not visible in table" + ) + url = reverse('all-projects') + self.get(url) + self.wait_until_present('#projectstable tbody tr') + + # Check edit column + edit_column = self.find('#edit-columns-button') + self.assertTrue(edit_column.is_displayed()) + edit_column.click() + # Check dropdown is visible + self.wait_until_visible('ul.dropdown-menu.editcol') + + # Check that we can hide the edit column + test_edit_column('checkbox-errors') + test_edit_column('checkbox-image_files') + test_edit_column('checkbox-last_build_outcome') + test_edit_column('checkbox-recipe_name') + test_edit_column('checkbox-warnings') From patchwork Tue Nov 21 13:48:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 34963 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2549C61D94 for ; Tue, 21 Nov 2023 13:48:19 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web11.40785.1700574496132152008 for ; Tue, 21 Nov 2023 05:48:16 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=fekBbDSL; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 74D6D9C36CD for ; Tue, 21 Nov 2023 08:48:15 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id KjP0ErIOrN1m; Tue, 21 Nov 2023 08:48:15 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 046579C36BF; Tue, 21 Nov 2023 08:48:15 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 046579C36BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1700574495; bh=gMAwcRDu6dn+fvWsoJukwtIYa0PqX6nF7Ewp49cvZWY=; h=From:To:Date:Message-Id:MIME-Version; b=fekBbDSLzpXFTDkrA1V6nU2strdA1YCA5l8tpoVxmT/67BeHgvi+hU8je8UFMUHxC ku2DGmPCZfTc2PpIRomXtPu1A7FQ8o1RR0jNXQKRMVUYM2Iz84z+G5rgZNqRCwg3b7 3csxML2BPKgqRrxeGY/4M/M9u6wKl+qZGXWxdmwNtWPVFObaAI99U1aks/xqxsqdFu HM9oGUwppRtpCsw0N7nsgvF/UncHWnP4CPcQQYjqK8cygmL4V6XoGiFTDgirB4m5De bHSAzzmpNlQMLlQWcFPP9j6aGq5GpEhktzfVVpVHvZI1HAEwPYX/aJWQdEo9wG8AfC S2rtnjpX53u0w== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id mrRl5DltrMF1; Tue, 21 Nov 2023 08:48:14 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 2465C9C2B49; Tue, 21 Nov 2023 08:48:13 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH 3/3] Toaster: Toaster: Write UI TestCase -> Visualize all projects Date: Tue, 21 Nov 2023 14:48:01 +0100 Message-Id: <20231121134801.97718-3-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231121134801.97718-1-alassane.yattara@savoirfairelinux.com> References: <20231121134801.97718-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Nov 2023 13:48:19 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15547 Test the show rows feature in the projects table on the all projects page Signed-off-by: Alassane Yattara --- .../tests/browser/test_all_projects_page.py | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/lib/toaster/tests/browser/test_all_projects_page.py b/lib/toaster/tests/browser/test_all_projects_page.py index 2b1d8cc1..a880dbcc 100644 --- a/lib/toaster/tests/browser/test_all_projects_page.py +++ b/lib/toaster/tests/browser/test_all_projects_page.py @@ -297,3 +297,37 @@ class TestAllProjectsPage(SeleniumTestCase): test_edit_column('checkbox-last_build_outcome') test_edit_column('checkbox-recipe_name') test_edit_column('checkbox-warnings') + + def test_allProject_table_show_rows(self): + """ Test the show rows feature in the projects table on the all projects page """ + self._create_projects(nb_project=200) + + def test_show_rows(row_to_show, show_row_link): + # Check that we can show rows == row_to_show + show_row_link.select_by_value(str(row_to_show)) + self.wait_until_present('#projectstable tbody tr') + sleep_time = 1 + if row_to_show == 150: + # wait more time for 150 rows + sleep_time = 2 + time.sleep(sleep_time) + self.assertTrue( + len(self.find_all('#projectstable tbody tr')) == row_to_show + ) + + url = reverse('all-projects') + self.get(url) + self.wait_until_present('#projectstable tbody tr') + + show_rows = self.driver.find_elements( + By.XPATH, + '//select[@class="form-control pagesize-projectstable"]' + ) + # Check show rows + for show_row_link in show_rows: + show_row_link = Select(show_row_link) + test_show_rows(10, show_row_link) + test_show_rows(25, show_row_link) + test_show_rows(50, show_row_link) + test_show_rows(100, show_row_link) + test_show_rows(150, show_row_link)