From patchwork Tue Dec 12 14:16:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 36075 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 AFF11C4332F for ; Tue, 12 Dec 2023 14:17:11 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.2648.1702390621669218563 for ; Tue, 12 Dec 2023 06:17:01 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=Rfb7a06C; 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 10C919C354B for ; Tue, 12 Dec 2023 09:17:01 -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 EtHWi2JT3dxI; Tue, 12 Dec 2023 09:16:59 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 2E27D9C32E4; Tue, 12 Dec 2023 09:16:59 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 2E27D9C32E4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702390619; bh=8Ki5GrCQZ3KBQPZZM6sfbXpKH1jrTwhrBdCjwg3VWm8=; h=From:To:Date:Message-Id:MIME-Version; b=Rfb7a06C9KKXWjL2HJuGn/y5p/GuP8Pi/5e6t3fvKy3J4+MpoVwkmAlZHMlbeTp5E cJo+x7ZUY8H8QXbqlvJv07JYu84intIGawNmBJcyI43jLT+uHOtXnBZvK1j3LHTiar R5Strj0M3AkkUm6lnANB0btyhLg0BIflhD40aP4Gjx4auDTm7cHH5SOUFNY3xyyUz5 NZIHwRzbgriBgyFcyJl1HexfYMmzGTSFPMrD2RjGTCFXWGDjmK1M8HlEsQImsUzT4s NF1G3aTV/uUJkB0Ja9sBvS1y4lyylgGdPvDnvnm68cCdVGyv1JcI62i54ZAzz2fNaF yUbIeEa6n0EQA== 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 Bz30_pxUDPMg; Tue, 12 Dec 2023 09:16:59 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 54A789C354B; Tue, 12 Dec 2023 09:16:58 -0500 (EST) From: Alassane Yattara To: toaster@lists.yoctoproject.org Cc: Alassane Yattara Subject: [PATCH 4/4] toaster/test: Fixes functional tests warning on autobuilder Date: Tue, 12 Dec 2023 15:16:43 +0100 Message-Id: <20231212141643.17627-4-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231212141643.17627-1-alassane.yattara@savoirfairelinux.com> References: <20231212141643.17627-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:11 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/6084 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()