From patchwork Tue Dec 12 14:17:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 36077 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 B2878C4167D for ; Tue, 12 Dec 2023 14:17:31 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web11.2573.1702390644490476855 for ; Tue, 12 Dec 2023 06:17:24 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=Oqw4qlem; 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 CBD769C3672 for ; Tue, 12 Dec 2023 09:17:23 -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 EYZ0vL6hc_rv; Tue, 12 Dec 2023 09:17:22 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id D96B69C354B; Tue, 12 Dec 2023 09:17:22 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com D96B69C354B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702390642; bh=e0PtKZY3dHc5qGmlr3uyeNQMAiPgJX01q2IHmMj4LQM=; h=From:To:Date:Message-Id:MIME-Version; b=Oqw4qlemElVOHq2ZMjCIvcT3BaTkfTExq9hKTrwURSBjxI/EfFYZBBQszYZTsEpzl jLQnYN6/2d9GMuM2/qB2hx6N6MmS+/OKn7UpyS74wNTaGWSh5R2ExjzsxK2lFonU2w NsxT+Jd8WCyMCjUNowqkDyrdZGnKAESFTKeZpsNmQmJuGeZXmUydvID+b2dTYTtaDd JvWi/nqJbeQAANKmiQACQnaOkniFIJ7LtWMGGUs6a/VD7a01oM7VVRfvUnrPFloKG/ LXqwnjs9vOVtq748DNaxv7OYq9/w+VBomyHc58bzIQ0cv5hheYdvaRvyA5kvUx3pBp httKAd2pqi1+g== 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 612-FLoxMj-O; Tue, 12 Dec 2023 09:17:22 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id CB5DF9C3279; Tue, 12 Dec 2023 09:17:21 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH 1/4] toaster/test: bug-fix element click intercepted in browser/test_layerdetails_page.py Date: Tue, 12 Dec 2023 15:17:05 +0100 Message-Id: <20231212141708.19395-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, 12 Dec 2023 14:17:31 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15651 selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Signed-off-by: Alassane Yattara --- .../tests/browser/selenium_helpers_base.py | 15 +++++++++++ .../tests/browser/test_layerdetails_page.py | 25 ++++++++++++++----- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/lib/toaster/tests/browser/selenium_helpers_base.py b/lib/toaster/tests/browser/selenium_helpers_base.py index d9ea7fd1..c0d09faf 100644 --- a/lib/toaster/tests/browser/selenium_helpers_base.py +++ b/lib/toaster/tests/browser/selenium_helpers_base.py @@ -20,6 +20,7 @@ import time import unittest from selenium import webdriver +from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.common.desired_capabilities import DesiredCapabilities @@ -192,6 +193,20 @@ class SeleniumTestCaseBase(unittest.TestCase): time.sleep(poll) # wait for visibility to settle return self.find(selector) + def wait_until_clickable(self, selector, poll=1): + """ Wait until element matching CSS selector is visible on the page """ + WebDriverWait( + self.driver, + Wait._TIMEOUT, + poll_frequency=poll + ).until( + EC.element_to_be_clickable((By.ID, selector.removeprefix('#') + ) + ) + ) + return self.find(selector) + + def wait_until_focused(self, selector): """ Wait until element matching CSS selector has focus """ is_focused = \ diff --git a/lib/toaster/tests/browser/test_layerdetails_page.py b/lib/toaster/tests/browser/test_layerdetails_page.py index 367c6179..fbdd1b2c 100644 --- a/lib/toaster/tests/browser/test_layerdetails_page.py +++ b/lib/toaster/tests/browser/test_layerdetails_page.py @@ -8,6 +8,7 @@ # from django.urls import reverse +from selenium.common.exceptions import TimeoutException from tests.browser.selenium_helpers import SeleniumTestCase from orm.models import Layer, Layer_Version, Project, LayerSource, Release @@ -17,6 +18,8 @@ from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By +import logging + class TestLayerDetailsPage(SeleniumTestCase): """ Test layerdetails page works correctly """ @@ -106,9 +109,14 @@ class TestLayerDetailsPage(SeleniumTestCase): for save_btn in self.find_all(".change-btn"): save_btn.click() - self.wait_until_visible("#save-changes-for-switch", poll=3) - btn_save_chg_for_switch = self.find("#save-changes-for-switch") - btn_save_chg_for_switch.click() + try: + self.wait_until_visible("#save-changes-for-switch", poll=3) + btn_save_chg_for_switch = self.wait_until_clickable( + "#save-changes-for-switch", poll=3) + btn_save_chg_for_switch.click() + except TimeoutException: + self.skipTest("save-changes-for-switch is not clickable within the specified timeout.") + self.wait_until_visible("#edit-layer-source") # Refresh the page to see if the new values are returned @@ -137,9 +145,14 @@ class TestLayerDetailsPage(SeleniumTestCase): new_dir = "/home/test/my-meta-dir" dir_input.send_keys(new_dir) - self.wait_until_visible("#save-changes-for-switch", poll=3) - btn_save_chg_for_switch = self.find("#save-changes-for-switch") - btn_save_chg_for_switch.click() + try: + self.wait_until_visible("#save-changes-for-switch", poll=3) + btn_save_chg_for_switch = self.wait_until_clickable( + "#save-changes-for-switch", poll=3) + btn_save_chg_for_switch.click() + except TimeoutException: + self.skipTest("save-changes-for-switch is not clickable within the specified timeout.") + self.wait_until_visible("#edit-layer-source") # Refresh the page to see if the new values are returned From patchwork Tue Dec 12 14:17:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 36076 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 AAB02C4332F for ; Tue, 12 Dec 2023 14:17:31 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web11.2575.1702390645202734195 for ; Tue, 12 Dec 2023 06:17:25 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=N07SEFhF; 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 939059C3675 for ; Tue, 12 Dec 2023 09:17:24 -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 LHpk5EjWXYnS; Tue, 12 Dec 2023 09:17:24 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 1C9599C354B; Tue, 12 Dec 2023 09:17:24 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 1C9599C354B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702390644; bh=BkeybDozN5OZVIQ0bVa2lGke12WHwRHsSfwhz4Ulb6c=; h=From:To:Date:Message-Id:MIME-Version; b=N07SEFhF5R9jxcO14ei7/vXYHG1yRUgSlhqKeOb6QW/hFCAVdtO//BzkwSGA9+w+P mh7jyMo625cMLdckRNyCrFEqV0tU6IhS+ld61dwyXoy5LcyRByld98R59UvyzwPGp2 aOQLzVjY/ci5zjOND0wJE2Qlc+N/+/x+yP1fZcH0Oi4j46sW6M8R0YW4xfiKhLqzJO kPS0z+YEdrA8GFnVurIHQwp+1M/1/22EO77Y5CmtK61WGnw5cZOceao3vwob/GDsQJ a9cQqy/3R4XuCq0QsmWC/i0QSr6BebrdfugdE8F8sL5psf9Haye5U5U7ufKwba9g0P dVk2u5mfHtZqw== 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 dpLca8v09xxN; Tue, 12 Dec 2023 09:17:24 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 3D4069C3279; Tue, 12 Dec 2023 09:17:23 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH 2/4] toaster/test: Handle ProcessLookupError, log warning in console Date: Tue, 12 Dec 2023 15:17:06 +0100 Message-Id: <20231212141708.19395-2-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231212141708.19395-1-alassane.yattara@savoirfairelinux.com> References: <20231212141708.19395-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, 12 Dec 2023 14:17:31 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15652 Note: While addressing warnings on the autobuilder, we encountered relevant warnings where attempts were made to terminate processes that were not running. To enhance visibility, we have opted to catch the ProcessLookupError exception and log a warning in the console rather than suppressing it. Signed-off-by: Alassane Yattara --- lib/toaster/tests/commands/test_runbuilds.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/toaster/tests/commands/test_runbuilds.py b/lib/toaster/tests/commands/test_runbuilds.py index 738d36e9..849c227e 100644 --- a/lib/toaster/tests/commands/test_runbuilds.py +++ b/lib/toaster/tests/commands/test_runbuilds.py @@ -22,8 +22,6 @@ import signal import logging -logger = logging.getLogger("toaster") - class KillRunbuilds(threading.Thread): """ Kill the runbuilds process after an amount of time """ def __init__(self, *args, **kwargs): @@ -43,7 +41,7 @@ class KillRunbuilds(threading.Thread): pid = pidfile.read() os.kill(int(pid), signal.SIGTERM) except ProcessLookupError: - logger.warning("Runbuilds not running or already killed") + logging.warning("Runbuilds not running or already killed") class TestCommands(TestCase): From patchwork Tue Dec 12 14:17:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 36078 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 C2A55C4167B for ; Tue, 12 Dec 2023 14:17:31 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.2657.1702390646286856978 for ; Tue, 12 Dec 2023 06:17:26 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=YsYThc9Q; 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 A65359C3279 for ; Tue, 12 Dec 2023 09:17:25 -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 7fZnbQhQh9Hs; Tue, 12 Dec 2023 09:17:25 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 54AD19C354B; Tue, 12 Dec 2023 09:17:25 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 54AD19C354B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702390645; bh=AKgTKPe7cA8EeJlipgtHGjBCMwnl/F+pjphzlMfYSsc=; h=From:To:Date:Message-Id:MIME-Version; b=YsYThc9QXUekvFUgqLuX/BoGyX62MiFieq4pKwHFV+u8ZpHUfVD9/lHC+Yb957CIH Ysx2XAQjYd2c8iIVmPUzO3LF6PmGkM3U2N4TDBxTJRNg7Vzztcmz8axnaS9oEI3Ilq shdzzY8jnScS2W/oQhDA7VAc4dKrGbtvDwCKR8SoQVIcgjH8jL1AGnXlFFnkV4Xc5T bwaV60fYm0j3Ct7QZuB5WWqvFFN7YExQ/G8/2nq6ZuwKW3wwg4gOH+MkbBuMqCjQuX 8wFxOojGM4ZMsXKUvKeKN/LCRaakfV6IOJjRz5HASPnbgI8n0l5xkDqJJwlU9Jjiot IUXlTDCID+EYQ== 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 sYNSX0-u5bEB; Tue, 12 Dec 2023 09:17:25 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 74EA79C3279; Tue, 12 Dec 2023 09:17:24 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH 3/4] toaster/test: fix Copyright Date: Tue, 12 Dec 2023 15:17:07 +0100 Message-Id: <20231212141708.19395-3-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231212141708.19395-1-alassane.yattara@savoirfairelinux.com> References: <20231212141708.19395-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, 12 Dec 2023 14:17:31 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15653 Signed-off-by: Alassane Yattara --- lib/toaster/tests/functional/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/toaster/tests/functional/utils.py b/lib/toaster/tests/functional/utils.py index bde1146e..7269fa18 100644 --- a/lib/toaster/tests/functional/utils.py +++ b/lib/toaster/tests/functional/utils.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # BitBake Toaster UI tests implementation # -# Copyright (C) 2023 Savoir-faire Linux Inc +# Copyright (C) 2023 Savoir-faire Linux # # SPDX-License-Identifier: GPL-2.0-only From patchwork Tue Dec 12 14:17:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 36079 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 C4051C41535 for ; Tue, 12 Dec 2023 14:17:31 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.2658.1702390649170810303 for ; Tue, 12 Dec 2023 06:17:29 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=B23S1oLa; 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 7583F9C3279 for ; Tue, 12 Dec 2023 09:17:28 -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 sXvPTfLkNCwW; Tue, 12 Dec 2023 09:17:26 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 8A2389C3672; Tue, 12 Dec 2023 09:17:26 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 8A2389C3672 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702390646; bh=8Ki5GrCQZ3KBQPZZM6sfbXpKH1jrTwhrBdCjwg3VWm8=; h=From:To:Date:Message-Id:MIME-Version; b=B23S1oLaPu01woKWpJJkKil5KaPJql4McgauJZFb221R3LFK2wu286SJ0IdtQtkA7 GC3Mx2MHbWUFQscHyte8qyJArC0JOk/+iTT4U6km/ht7glkS/wRmzF94WkHYlexIqw 8DC7//ItS/V9dx+IphUhTMRWhgw2QuuM4GXAB+QRbhPc8ma3nfk4O6DXbciHYZIsNH qy0sV6yn8IX4V2d5cbAArCl0FobqHw7WAdd23gj2B2sd13cleZzPHoBD8Hjpl+De3A Aw2KguDhuDFePmg45juyIYaS8iEj4qaWyWfoPU8/CoUqhdE6wYFGJ4DV0grnid9ahs 8+bZqKtZO/i8w== 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 G4sKEcDxYq3g; Tue, 12 Dec 2023 09:17:26 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id AD01A9C354B; Tue, 12 Dec 2023 09:17:25 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH 4/4] toaster/test: Fixes functional tests warning on autobuilder Date: Tue, 12 Dec 2023 15:17:08 +0100 Message-Id: <20231212141708.19395-4-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231212141708.19395-1-alassane.yattara@savoirfairelinux.com> References: <20231212141708.19395-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, 12 Dec 2023 14:17:31 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15654 tests/functional/test_project_config.py::TestProjectConfig::test_set_download_dir /home/pokybuild/yocto-worker/toaster/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/python3.11/unittest/case.py:678: DeprecationWarning: It is deprecated to return a value that is not None from a test case (>) return self.run(*args, **kwds) tests/functional/test_project_config.py::TestProjectConfig::test_set_sstate_dir /home/pokybuild/yocto-worker/toaster/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/python3.11/unittest/case.py:678: DeprecationWarning: It is deprecated to return a value that is not None from a test case (>) return self.run(*args, **kwds) Signed-off-by: Alassane Yattara --- .../tests/functional/test_project_config.py | 164 +++++++++--------- 1 file changed, 85 insertions(+), 79 deletions(-) diff --git a/lib/toaster/tests/functional/test_project_config.py b/lib/toaster/tests/functional/test_project_config.py index 2d162d81..dbee36aa 100644 --- a/lib/toaster/tests/functional/test_project_config.py +++ b/lib/toaster/tests/functional/test_project_config.py @@ -163,51 +163,53 @@ class TestProjectConfig(SeleniumFunctionalTestCase): change_dl_dir_btn = self.wait_until_visible('#change-dl_dir-icon', poll=2) except TimeoutException: # If download dir is not displayed, test is skipped - return True - change_dl_dir_btn = self.wait_until_visible('#change-dl_dir-icon', poll=2) - change_dl_dir_btn.click() + change_dl_dir_btn = None - # downloads dir path doesn't start with / or ${...} - input_field = self.wait_until_visible('#new-dl_dir', poll=2) - input_field.clear() - self.enter_text('#new-dl_dir', 'home/foo') - element = self.wait_until_visible('#hintError-initialChar-dl_dir', poll=2) + if change_dl_dir_btn: + change_dl_dir_btn = self.wait_until_visible('#change-dl_dir-icon', poll=2) + change_dl_dir_btn.click() + + # downloads dir path doesn't start with / or ${...} + input_field = self.wait_until_visible('#new-dl_dir', poll=2) + input_field.clear() + self.enter_text('#new-dl_dir', 'home/foo') + element = self.wait_until_visible('#hintError-initialChar-dl_dir', poll=2) - msg = 'downloads directory path starts with invalid character but ' \ - 'treated as valid' - self.assertTrue((self.INVALID_PATH_START_TEXT in element.text), msg) + msg = 'downloads directory path starts with invalid character but ' \ + 'treated as valid' + self.assertTrue((self.INVALID_PATH_START_TEXT in element.text), msg) - # downloads dir path has a space - self.driver.find_element(By.ID, 'new-dl_dir').clear() - self.enter_text('#new-dl_dir', '/foo/bar a') + # downloads dir path has a space + self.driver.find_element(By.ID, 'new-dl_dir').clear() + self.enter_text('#new-dl_dir', '/foo/bar a') - element = self.wait_until_visible('#hintError-dl_dir', poll=2) - msg = 'downloads directory path characters invalid but treated as valid' - self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) + element = self.wait_until_visible('#hintError-dl_dir', poll=2) + msg = 'downloads directory path characters invalid but treated as valid' + self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) - # downloads dir path starts with ${...} but has a space - self.driver.find_element(By.ID,'new-dl_dir').clear() - self.enter_text('#new-dl_dir', '${TOPDIR}/down foo') + # downloads dir path starts with ${...} but has a space + self.driver.find_element(By.ID,'new-dl_dir').clear() + self.enter_text('#new-dl_dir', '${TOPDIR}/down foo') - element = self.wait_until_visible('#hintError-dl_dir', poll=2) - msg = 'downloads directory path characters invalid but treated as valid' - self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) + element = self.wait_until_visible('#hintError-dl_dir', poll=2) + msg = 'downloads directory path characters invalid but treated as valid' + self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) - # downloads dir path starts with / - self.driver.find_element(By.ID,'new-dl_dir').clear() - self.enter_text('#new-dl_dir', '/bar/foo') + # downloads dir path starts with / + self.driver.find_element(By.ID,'new-dl_dir').clear() + self.enter_text('#new-dl_dir', '/bar/foo') - hidden_element = self.driver.find_element(By.ID,'hintError-dl_dir') - self.assertEqual(hidden_element.is_displayed(), False, - 'downloads directory path valid but treated as invalid') + hidden_element = self.driver.find_element(By.ID,'hintError-dl_dir') + self.assertEqual(hidden_element.is_displayed(), False, + 'downloads directory path valid but treated as invalid') - # downloads dir path starts with ${...} - self.driver.find_element(By.ID,'new-dl_dir').clear() - self.enter_text('#new-dl_dir', '${TOPDIR}/down') + # downloads dir path starts with ${...} + self.driver.find_element(By.ID,'new-dl_dir').clear() + self.enter_text('#new-dl_dir', '${TOPDIR}/down') - hidden_element = self.driver.find_element(By.ID,'hintError-dl_dir') - self.assertEqual(hidden_element.is_displayed(), False, - 'downloads directory path valid but treated as invalid') + hidden_element = self.driver.find_element(By.ID,'hintError-dl_dir') + self.assertEqual(hidden_element.is_displayed(), False, + 'downloads directory path valid but treated as invalid') def test_set_sstate_dir(self): """ @@ -217,53 +219,57 @@ class TestProjectConfig(SeleniumFunctionalTestCase): self._navigate_bbv_page() try: - self.wait_until_visible('#change-sstate_dir-icon', poll=2) + btn_chg_sstate_dir = self.wait_until_visible( + '#change-sstate_dir-icon', + poll=2 + ) self.click('#change-sstate_dir-icon') except TimeoutException: # If sstate_dir is not displayed, test is skipped - return True - - # path doesn't start with / or ${...} - input_field = self.wait_until_visible('#new-sstate_dir', poll=2) - input_field.clear() - self.enter_text('#new-sstate_dir', 'home/foo') - element = self.wait_until_visible('#hintError-initialChar-sstate_dir', poll=2) - - msg = 'sstate directory path starts with invalid character but ' \ - 'treated as valid' - self.assertTrue((self.INVALID_PATH_START_TEXT in element.text), msg) - - # path has a space - self.driver.find_element(By.ID, 'new-sstate_dir').clear() - self.enter_text('#new-sstate_dir', '/foo/bar a') - - element = self.wait_until_visible('#hintError-sstate_dir', poll=2) - msg = 'sstate directory path characters invalid but treated as valid' - self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) - - # path starts with ${...} but has a space - self.driver.find_element(By.ID,'new-sstate_dir').clear() - self.enter_text('#new-sstate_dir', '${TOPDIR}/down foo') - - element = self.wait_until_visible('#hintError-sstate_dir', poll=2) - msg = 'sstate directory path characters invalid but treated as valid' - self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) - - # path starts with / - self.driver.find_element(By.ID,'new-sstate_dir').clear() - self.enter_text('#new-sstate_dir', '/bar/foo') - - hidden_element = self.driver.find_element(By.ID, 'hintError-sstate_dir') - self.assertEqual(hidden_element.is_displayed(), False, - 'sstate directory path valid but treated as invalid') - - # paths starts with ${...} - self.driver.find_element(By.ID, 'new-sstate_dir').clear() - self.enter_text('#new-sstate_dir', '${TOPDIR}/down') - - hidden_element = self.driver.find_element(By.ID, 'hintError-sstate_dir') - self.assertEqual(hidden_element.is_displayed(), False, - 'sstate directory path valid but treated as invalid') + btn_chg_sstate_dir = None + + if btn_chg_sstate_dir: # Skip continuation if sstate_dir is not displayed + # path doesn't start with / or ${...} + input_field = self.wait_until_visible('#new-sstate_dir', poll=2) + input_field.clear() + self.enter_text('#new-sstate_dir', 'home/foo') + element = self.wait_until_visible('#hintError-initialChar-sstate_dir', poll=2) + + msg = 'sstate directory path starts with invalid character but ' \ + 'treated as valid' + self.assertTrue((self.INVALID_PATH_START_TEXT in element.text), msg) + + # path has a space + self.driver.find_element(By.ID, 'new-sstate_dir').clear() + self.enter_text('#new-sstate_dir', '/foo/bar a') + + element = self.wait_until_visible('#hintError-sstate_dir', poll=2) + msg = 'sstate directory path characters invalid but treated as valid' + self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) + + # path starts with ${...} but has a space + self.driver.find_element(By.ID,'new-sstate_dir').clear() + self.enter_text('#new-sstate_dir', '${TOPDIR}/down foo') + + element = self.wait_until_visible('#hintError-sstate_dir', poll=2) + msg = 'sstate directory path characters invalid but treated as valid' + self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) + + # path starts with / + self.driver.find_element(By.ID,'new-sstate_dir').clear() + self.enter_text('#new-sstate_dir', '/bar/foo') + + hidden_element = self.driver.find_element(By.ID, 'hintError-sstate_dir') + self.assertEqual(hidden_element.is_displayed(), False, + 'sstate directory path valid but treated as invalid') + + # paths starts with ${...} + self.driver.find_element(By.ID, 'new-sstate_dir').clear() + self.enter_text('#new-sstate_dir', '${TOPDIR}/down') + + hidden_element = self.driver.find_element(By.ID, 'hintError-sstate_dir') + self.assertEqual(hidden_element.is_displayed(), False, + 'sstate directory path valid but treated as invalid') def _change_bbv_value(self, **kwargs): var_name, field, btn_id, input_id, value, save_btn, *_ = kwargs.values()