From patchwork Fri Nov 10 17:25:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 34279 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 630D2C05027 for ; Fri, 10 Nov 2023 17:26:07 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web11.33652.1699637158563214302 for ; Fri, 10 Nov 2023 09:25:59 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=CNLRmKxR; 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 C461A9C34E1 for ; Fri, 10 Nov 2023 12:25:57 -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 3xx8qXyVQC-P; Fri, 10 Nov 2023 12:25:57 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 2D2DF9C34CA; Fri, 10 Nov 2023 12:25:57 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 2D2DF9C34CA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1699637157; bh=kIEwiVjvzZ70K0VDS0bIX9+mWNuiMSLUBeif/iWD8FI=; h=From:To:Date:Message-Id:MIME-Version; b=CNLRmKxR8IWkZ9hvDJi8mTUH8QilnJ+tQ4w3bLSR6Qnd+ZTWEm6KAULYu+dzKjVxh r6Lw/6kRhK2/CNd4rwciYf+yYqOUow+vTa0Bpxhq1eFP/Am/hx0o1Whe6eBDgMEPGo M3jVHG0LcV/1QILrOwZ1hIOwV/AkQlnqNQbFrridza31hA9kc+qeaaWGPUarNdj6OE OBddVPLaLTkT9l08H2saK5U4aVvev8bwylCzB+VnhzcGxWyYrC80kcnrB+HUj+Qd1d 3fmx2rxgMlrb21e0Dv/vnp8H87+onIyMaVWLC3thPMIsxycWgBdIoEdxGmS3rJKSO6 rmE8U2ndAZe1g== 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 qEb3XBd2XmxS; Fri, 10 Nov 2023 12:25:57 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 403F29C328E; Fri, 10 Nov 2023 12:25:56 -0500 (EST) From: Alassane Yattara To: toaster@lists.yoctoproject.org Cc: Alassane Yattara Subject: [PATCH 2/6] Toaster: Write UI TestCase -> Visualize all builds Date: Fri, 10 Nov 2023 18:25:35 +0100 Message-Id: <20231110172539.395060-2-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231110172539.395060-1-alassane.yattara@savoirfairelinux.com> References: <20231110172539.395060-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 ; Fri, 10 Nov 2023 17:26:07 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/5989 Check search box for a build by recipe name Test the search box in the builds table on the all builds page Signed-off-by: Alassane Yattara --- .../tests/browser/test_all_builds_page.py | 43 +++++++++++++++---- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/lib/toaster/tests/browser/test_all_builds_page.py b/lib/toaster/tests/browser/test_all_builds_page.py index d4312bb3..eb14f89d 100644 --- a/lib/toaster/tests/browser/test_all_builds_page.py +++ b/lib/toaster/tests/browser/test_all_builds_page.py @@ -11,6 +11,7 @@ import re, time from django.urls import reverse from django.utils import timezone +from selenium.webdriver.remote.webdriver import WebElement from tests.browser.selenium_helpers import SeleniumTestCase from orm.models import BitbakeVersion, Release, Project, Build, Target @@ -102,6 +103,18 @@ class TestAllBuildsPage(SeleniumTestCase): return found_row + def _get_create_builds(self, **kwargs): + """ Create a build and return the build object """ + build1 = Build.objects.create(**self.project1_build_success) + build2 = Build.objects.create(**self.project1_build_failure) + + # add some targets to these builds so they have recipe links + # (and so we can find the row in the ToasterTable corresponding to + # a particular build) + Target.objects.create(build=build1, target='foo') + Target.objects.create(build=build2, target='bar') + return build1, build2 + def test_show_tasks_with_suffix(self): """ Task should be shown as suffix on build name """ build = Build.objects.create(**self.project1_build_success) @@ -146,7 +159,6 @@ class TestAllBuildsPage(SeleniumTestCase): self.assertEqual(len(run_again_button), 0, 'should not see a rebuild button for cli builds') - def test_tooltips_on_project_name(self): """ Test tooltips shown next to project name in the main table @@ -188,14 +200,7 @@ class TestAllBuildsPage(SeleniumTestCase): recent builds area; failed builds should not have links on the time column, or in the recent builds area """ - build1 = Build.objects.create(**self.project1_build_success) - build2 = Build.objects.create(**self.project1_build_failure) - - # add some targets to these builds so they have recipe links - # (and so we can find the row in the ToasterTable corresponding to - # a particular build) - Target.objects.create(build=build1, target='foo') - Target.objects.create(build=build2, target='bar') + build1, build2 = self._get_create_builds() url = reverse('all-builds') self.get(url) @@ -223,3 +228,23 @@ class TestAllBuildsPage(SeleniumTestCase): links = build2_row.find_elements(By.CSS_SELECTOR, 'td.time a') msg = 'should not be a link on the build time for a failed build' self.assertEquals(len(links), 0, msg) + + def test_builds_table_search_box(self): + """ Test the search box in the builds table on the all builds page """ + self._get_create_builds() + + url = reverse('all-builds') + self.get(url) + + # Check search box is present and works + self.wait_until_present('#allbuildstable tbody tr') + search_box = self.find('#search-input-allbuildstable') + self.assertTrue(search_box.is_displayed()) + + # Check that we can search for a build by recipe name + search_box.send_keys('foo') + search_btn = self.find('#search-submit-allbuildstable') + search_btn.click() + self.wait_until_present('#allbuildstable tbody tr') + rows = self.find_all('#allbuildstable tbody tr') + self.assertTrue(len(rows) >= 1)